Remove sqlite3 build dep.
[gmpc.git] / src / Tools / gmpc-auto-reset-priority.vala
blobb1ecdfabb93af34b992ac14e6ba894ac934bff0f
2 /* Gnome Music Player Client (GMPC)
3 * Copyright (C) 2004-2012 Qball Cow <qball@gmpclient.org>
4 * Project homepage: http://gmpclient.org/
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 using Config;
21 using Gtk;
22 using Gmpc;
23 using Gmpc.Plugin;
25 private const bool use_transition_arp = Gmpc.use_transition;
26 private const string some_unique_name_arp = Config.VERSION;
28 public class Gmpc.Tools.AutoResetPriority : Gmpc.Plugin.Base
30 private const int[] version = {0,0,2};
32 public override unowned int[] get_version()
34 return this.version;
37 public override unowned string get_name()
39 return _("Auto reset priority");
42 construct
44 /* Mark the plugin as an internal dummy */
45 this.plugin_type = 8+4;
46 /* Attach status changed signal */
47 gmpcconn.status_changed.connect(status_changed);
51 private void status_changed(Connection conn, MPD.Server server, MPD.Status.Changed what)
53 if(!this.get_enabled()) return;
54 if((what&MPD.Status.Changed.SONGID) == MPD.Status.Changed.SONGID)
56 weak MPD.Song? song = server.playlist_get_current_song();
57 if(song != null) {
58 if(song.priority > 0 ) {
59 MPD.PlayQueue.set_priority(server, song.id, 0);