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.
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;
36 private int value
= 0;
37 private MPD
.Song song
= null;
38 private unowned MPD
.Server server
= null;
40 public int get_rating ()
44 bool button_press_event_callback(Gdk
.EventButton event
, void *userdata
)
49 public Rating (MPD
.Server server
, MPD
.Song song
, int value
)
52 this
.song
= song
.copy();
54 /* this fixes vala bitching */
55 this
.activate
.connect(() => {
56 MPD
.Sticker
.Song
.set(this
.server
, this
.song
.file
, "rating", (value
).to_string());
60 var hbox
= new Gtk
.Box(Gtk
.Orientation
.HORIZONTAL
,6);
61 for (int i
=0; i
< 5; i
++ ){
62 var image
= new Gtk
.Image
.from_icon_name("rating", Gtk
.IconSize
.MENU
);
63 hbox
.pack_start(image
, false, false, 0);
64 if(i
> (value
/2.0 -0.01)) {
65 image
.set_sensitive(false);