[Xfce4-commits] <xfmpc:master> Add buttons to select the single and consume modes
Vincent Legout
noreply at xfce.org
Thu Feb 11 11:20:03 CET 2010
Updating branch refs/heads/master
to 8e1035dcf1b00008a2527a04cb750e0aa5a24d37 (commit)
from 6e8b1c6793913da4466ac9f8d3fc94a3d1d69834 (commit)
commit 8e1035dcf1b00008a2527a04cb750e0aa5a24d37
Author: Vincent Legout <vincent at legout.info>
Date: Thu Feb 11 17:52:08 2010 +0800
Add buttons to select the single and consume modes
Also update the state of the buttons when one mode is updated outside xfmpc
src/extended-interface.vala | 44 +++++++++++++++++++++++++++++++++---------
1 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/src/extended-interface.vala b/src/extended-interface.vala
index 9d5f17f..0d5f1f5 100644
--- a/src/extended-interface.vala
+++ b/src/extended-interface.vala
@@ -32,6 +32,11 @@ namespace Xfmpc {
private Gtk.Notebook notebook;
private Gtk.Menu context_menu;
+ private Gtk.CheckMenuItem random;
+ private Gtk.CheckMenuItem repeat;
+ private Gtk.CheckMenuItem single;
+ private Gtk.CheckMenuItem consume;
+
private enum Columns {
COLUMN_STRING,
COLUMN_POINTER,
@@ -123,6 +128,11 @@ namespace Xfmpc {
if (this.context_menu == null)
this.context_menu_new ((Gtk.Widget) this.context_button);
+ this.repeat.set_active (this.mpdclient.get_repeat ());
+ this.random.set_active (this.mpdclient.get_random ());
+ this.single.set_active (this.mpdclient.get_single ());
+ this.consume.set_active (this.mpdclient.get_consume ());
+
this.context_menu.popup (null, null,
(Gtk.MenuPositionFunc) this.position_context_menu,
0, get_current_event_time ());
@@ -153,15 +163,21 @@ namespace Xfmpc {
this.context_menu.attach_to_widget (attach_widget, (Gtk.MenuDetachFunc) menu_detach);
this.context_menu.deactivate.connect (cb_context_menu_deactivate);
- var mi = new Gtk.CheckMenuItem.with_label (_("Repeat"));
- mi.set_active (this.mpdclient.get_repeat ());
- mi.activate.connect (cb_repeat_switch);
- this.context_menu.append (mi);
+ this.repeat = new Gtk.CheckMenuItem.with_label (_("Repeat"));
+ this.repeat.activate.connect (cb_repeat_switch);
+ this.context_menu.append (this.repeat);
+
+ this.random = new Gtk.CheckMenuItem.with_label (_("Random"));
+ this.random.activate.connect (cb_random_switch);
+ this.context_menu.append (this.random);
+
+ this.single = new Gtk.CheckMenuItem.with_label (_("Single Mode"));
+ this.single.activate.connect (cb_single_switch);
+ this.context_menu.append (this.single);
- mi = new Gtk.CheckMenuItem.with_label (_("Random"));
- mi.set_active (this.mpdclient.get_random ());
- mi.activate.connect (cb_random_switch);
- this.context_menu.append (mi);
+ this.consume = new Gtk.CheckMenuItem.with_label (_("Consume"));
+ this.consume.toggled.connect (cb_consume_switch);
+ this.context_menu.append (this.consume);
var separator = new Gtk.SeparatorMenuItem ();
this.context_menu.append (separator);
@@ -218,11 +234,19 @@ namespace Xfmpc {
}
private void cb_repeat_switch () {
- this.mpdclient.set_repeat (!this.mpdclient.get_repeat ());
+ this.mpdclient.set_repeat (this.repeat.get_active ());
}
private void cb_random_switch () {
- this.mpdclient.set_random (!this.mpdclient.get_random ());
+ this.mpdclient.set_random (this.random.get_active ());
+ }
+
+ private void cb_single_switch () {
+ this.mpdclient.set_single (this.single.get_active ());
+ }
+
+ private void cb_consume_switch () {
+ this.mpdclient.set_consume (this.consume.get_active ());
}
private void cb_preferences () {
More information about the Xfce4-commits
mailing list