Re-add rating.
[gmpc.git] / src / Widgets / gmpc-menu-item-rating.vala
blob6df106201485e0422d97e3666f5b2ef29148f51f
1 /* Gnome Music Player Client (GMPC)
2 * Copyright (C) 2004-2014 Qball Cow <qball@sarine.nl>
3 * Project homepage: http://gmpc.wikia.com/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 using GLib;
21 using Config;
22 using Gtk;
23 using Gdk;
24 using Cairo;
25 using MPD;
26 using Gmpc;
29 private const bool use_transition_mir = Gmpc.use_transition;
31 public class Gmpc.MenuItem.Rating : Gtk.MenuItem
33 private const string some_unique_name = Config.VERSION;
34 public Gtk.VBox hbox = null;
35 public Gmpc.Rating rating = null;
37 public int get_rating ()
39 return 0;
41 bool button_press_event_callback(Gdk.EventButton event, void *userdata)
43 this.rating.button_press_event_callback(this.rating.event_box, event);
44 return true;
47 bool button_release_event_callback(Gdk.EventButton event, void *userdata)
49 return true;
52 public Rating (MPD.Server server, MPD.Song song)
54 /* this fixes vala bitching */
55 GLib.Signal.connect_swapped(this, "button-press-event",
56 (GLib.Callback)button_press_event_callback,this);
57 GLib.Signal.connect_swapped(this, "button-release-event",
58 (GLib.Callback)button_release_event_callback,this);
60 this.hbox = new Gtk.VBox(false,6);
61 this.rating = new Gmpc.Rating(server,song);
63 this.hbox.pack_start(new Gtk.Label(_("Rating:")),false,true,0);
64 this.hbox.pack_start(this.rating,false,true,0);
65 this.add(this.hbox);
66 this.show_all();