[Rhythmbox-devel] [PATCH] add --shuffle option
- From: James Willcox <jwillcox gnome org>
- To: rhythmbox-devel gnome org
- Subject: [Rhythmbox-devel] [PATCH] add --shuffle option
- Date: Thu, 01 Apr 2004 14:49:07 -0500
Hey,
This patch makes the 'shuffle' property read/write and adds a --shuffle
option to toggle it.
James
Index: shell/main.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/main.c,v
retrieving revision 1.48
diff -u -r1.48 main.c
--- shell/main.c 27 Feb 2004 17:54:02 -0000 1.48
+++ shell/main.c 1 Apr 2004 19:45:37 -0000
@@ -73,6 +73,7 @@
static gboolean focus = FALSE;
static gboolean previous = FALSE;
static gboolean next = FALSE;
+static gboolean shuffle = FALSE;
static gboolean print_play_time = FALSE;
static gboolean print_song_length = FALSE;
static long seek_time = 0;
@@ -99,6 +100,8 @@
{ "previous", 0, POPT_ARG_NONE, &previous, 0, N_("Jump to previous song"), NULL },
{ "next", 0, POPT_ARG_NONE, &next, 0, N_("Jump to next song"), NULL },
+ { "shuffle", 0, POPT_ARG_NONE, &shuffle, 0, N_("Toggle shuffling"), NULL },
+
{ "debug", 'd', POPT_ARG_NONE, &debug, 0, N_("Enable debugging code"), NULL },
{ "no-update", 0, POPT_ARG_NONE, &no_update, 0, N_("Do not update the library"), NULL },
{ "no-registration", 'n', POPT_ARG_NONE, &no_registration, 0, N_("Do not register the shell"), NULL },
@@ -274,6 +277,32 @@
}
static void
+rb_toggle_shuffle (GNOME_Rhythmbox shell)
+{
+ Bonobo_PropertyBag pb;
+ gboolean shuffle;
+
+ pb = GNOME_Rhythmbox_getPlayerProperties (shell, &ev);
+
+ g_return_if_fail (!BONOBO_EX (&ev));
+
+ shuffle = bonobo_pbclient_get_boolean (pb,
+ "shuffle",
+ &ev);
+ g_return_if_fail (!BONOBO_EX (&ev));
+
+
+ bonobo_pbclient_set_boolean (pb,
+ "shuffle",
+ shuffle ? FALSE : TRUE,
+ &ev);
+ g_return_if_fail (!BONOBO_EX (&ev));
+
+ bonobo_object_release_unref ((Bonobo_Unknown)pb, &ev);
+}
+
+
+static void
rb_handle_cmdline (char **argv, int argc,
gboolean already_running)
{
@@ -369,6 +398,11 @@
{
GNOME_Rhythmbox_next (shell, &ev);
grab_focus = FALSE;
+ }
+
+ if (shuffle)
+ {
+ rb_toggle_shuffle (shell);
}
for (i = 1; i < argc; i++)
Index: shell/rb-shell.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell.c,v
retrieving revision 1.267
diff -u -r1.267 rb-shell.c
--- shell/rb-shell.c 29 Mar 2004 21:11:33 -0000 1.267
+++ shell/rb-shell.c 1 Apr 2004 19:45:38 -0000
@@ -1010,6 +1010,11 @@
CORBA_Environment *ev,
gpointer user_data)
{
+ RBShell *shell = RB_SHELL (user_data);
+ RBShellPlayer *player;
+
+ player = RB_SHELL_PLAYER (shell->priv->player_shell);
+
switch (arg_id) {
case PROP_VISIBILITY:
@@ -1018,6 +1023,22 @@
case PROP_SONG:
bonobo_exception_set (ev, ex_Bonobo_PropertyBag_ReadOnly);
break;
+
+ case PROP_SHUFFLE:
+ {
+ gboolean repeat;
+ gboolean shuffle;
+
+
+ rb_shell_player_get_playback_state (player, &shuffle,
+ &repeat);
+ shuffle = BONOBO_ARG_GET_BOOLEAN (arg);
+
+ rb_shell_player_set_playback_state (player,
+ shuffle,
+ repeat);
+ break;
+ }
default:
bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound);
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]