[Xfce4-commits] <parole:master> Finished connecting Shuffle/Repeat buttons and menu items.

Christoph Mende noreply at xfce.org
Mon Jul 23 01:25:51 CEST 2012


Updating branch refs/heads/master
         to 0821e49e48be8f623668ed95f4a5cfe90816ada8 (commit)
       from 2a4d1de2dc070b1baf5c0c5d67e310f0662d0ad1 (commit)

commit 0821e49e48be8f623668ed95f4a5cfe90816ada8
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Jul 14 19:34:34 2012 -0400

    Finished connecting Shuffle/Repeat buttons and menu items.

 src/parole-medialist.c |   46 +++++++++++++++++++++++++++++-----------------
 src/parole-medialist.h |    6 ++++++
 src/parole-player.c    |   31 ++++---------------------------
 3 files changed, 39 insertions(+), 44 deletions(-)

diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index 41ace6b..9ada493 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -42,6 +42,7 @@
 #include "interfaces/save-playlist_ui.h"
 
 #include "parole-builder.h"
+#include "parole-player.h"
 #include "parole-medialist.h"
 #include "parole-mediachooser.h"
 #include "parole-open-location.h"
@@ -169,9 +170,8 @@ struct ParoleMediaListPrivate
     GtkTreeSelection    *sel;
     
     GtkWidget		*remove;
-    GtkWidget		*up;
-    GtkWidget		*down;
-    GtkWidget		*save;
+    GtkWidget		*shuffle;
+    GtkWidget		*repeat;
 };
 
 enum
@@ -191,10 +191,7 @@ G_DEFINE_TYPE (ParoleMediaList, parole_media_list, GTK_TYPE_VBOX)
 static void
 parole_media_list_set_widget_sensitive (ParoleMediaList *list, gboolean sensitive)
 {
-    gtk_widget_set_sensitive (GTK_WIDGET (list->priv->up), sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (list->priv->remove), sensitive);
-    gtk_widget_set_sensitive (GTK_WIDGET (list->priv->down), sensitive);
-    gtk_widget_set_sensitive (GTK_WIDGET (list->priv->save), sensitive);
 }
 
 /**
@@ -251,9 +248,6 @@ parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean emit, g
     
     if ( nch == 1 )
     {
-	gtk_widget_set_sensitive (list->priv->up, FALSE);
-	gtk_widget_set_sensitive (list->priv->down, FALSE);
-	gtk_widget_set_sensitive (list->priv->save, TRUE);
 	gtk_widget_set_sensitive (list->priv->remove, TRUE);
     }
     else
@@ -865,11 +859,6 @@ parole_media_list_remove_clicked_cb (GtkButton *button, ParoleMediaList *list)
 	 */
 	g_signal_emit (G_OBJECT (list), signals [MEDIA_CURSOR_CHANGED], 0, FALSE);
     }
-    else if ( nch == 1 )
-    {
-	gtk_widget_set_sensitive (list->priv->up, FALSE);
-	gtk_widget_set_sensitive (list->priv->down, FALSE);
-    }
 }
 
 /**
@@ -1516,10 +1505,9 @@ parole_media_list_init (ParoleMediaList *list)
 
     gtk_box_pack_start (GTK_BOX (list), box, TRUE, TRUE, 0);
 
-    list->priv->up = GTK_WIDGET (gtk_builder_get_object (builder, "media-up"));
-    list->priv->down = GTK_WIDGET (gtk_builder_get_object (builder, "media-down"));
     list->priv->remove = GTK_WIDGET (gtk_builder_get_object (builder, "remove-media"));
-    list->priv->save = GTK_WIDGET (gtk_builder_get_object (builder, "save-playlist"));
+    list->priv->repeat = GTK_WIDGET (gtk_builder_get_object (builder, "repeat-media"));
+    list->priv->shuffle = GTK_WIDGET (gtk_builder_get_object (builder, "shuffle-media"));
 
     g_object_unref (builder);
     
@@ -1910,3 +1898,27 @@ void parole_media_list_grab_focus (ParoleMediaList *list)
     if (GTK_WIDGET_VISIBLE (list->priv->view) )
 	gtk_widget_grab_focus (list->priv->view);
 }
+
+void 
+parole_media_list_set_repeat_toggled (ParoleMediaList *list,
+									  gboolean repeat_toggled)
+{
+	gboolean toggled;
+    
+    toggled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (list->priv->repeat));
+    
+    if (toggled != repeat_toggled)
+    	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON (list->priv->repeat), repeat_toggled );
+}
+																
+void 
+parole_media_list_set_shuffle_toggled (ParoleMediaList *list,
+									  gboolean shuffle_toggled)
+{
+	gboolean toggled;
+    
+    toggled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (list->priv->shuffle));
+    
+    if (toggled != shuffle_toggled)
+    	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON (list->priv->shuffle), shuffle_toggled );
+}
diff --git a/src/parole-medialist.h b/src/parole-medialist.h
index 321a23e..73ac6e6 100644
--- a/src/parole-medialist.h
+++ b/src/parole-medialist.h
@@ -124,6 +124,12 @@ void				 parole_media_list_save_list	    (ParoleMediaList *list);
 
 void				 parole_media_list_grab_focus       (ParoleMediaList *list);
 
+void				 parole_media_list_set_repeat_toggled		(ParoleMediaList *list,
+																gboolean repeat_toggled);
+																
+void 				 parole_media_list_set_shuffle_toggled		(ParoleMediaList *list,
+																gboolean shuffle_toggled);
+
 G_END_DECLS
 
 #endif /* __PAROLE_MEDIA_LIST_H */
diff --git a/src/parole-player.c b/src/parole-player.c
index 8dd2abd..5ce246f 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -295,15 +295,6 @@ struct ParolePlayerPrivate
         
 };
 
-enum
-{
-    SHUFFLE_TOGGLED,
-    REPEAT_TOGGLED,
-    LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0 };
-
 G_DEFINE_TYPE (ParolePlayer, parole_player, G_TYPE_OBJECT)
 
 void parole_show_about	(GtkWidget *widget)
@@ -1446,6 +1437,8 @@ void parole_player_shuffle_toggled_cb (GtkWidget *widget, ParolePlayer *player)
     g_object_set (G_OBJECT (player->priv->conf),
 		  "shuffle", toggled,
 		  NULL);
+		  
+	parole_media_list_set_shuffle_toggled(player->priv->list, toggled);
 }
 
 void parole_player_repeat_toggled_cb (GtkWidget *widget, ParolePlayer *player)
@@ -1457,6 +1450,8 @@ void parole_player_repeat_toggled_cb (GtkWidget *widget, ParolePlayer *player)
     g_object_set (G_OBJECT (player->priv->conf),
 		  "repeat", toggled,
 		  NULL);
+		  
+	parole_media_list_set_repeat_toggled(player->priv->list, toggled);
 }
 
 static void
@@ -2205,24 +2200,6 @@ parole_player_dbus_class_init (ParolePlayerClass *klass)
     dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
 				     &dbus_glib_parole_player_object_info);
 				     
-	signals[SHUFFLE_TOGGLED] = 
-        g_signal_new ("shuffle-toggled",
-                      PAROLE_TYPE_PLAYER,
-                      G_SIGNAL_RUN_LAST,
-                      G_STRUCT_OFFSET (ParolePlayerClass, shuffle_toggled),
-                      NULL, NULL,
-                      g_cclosure_marshal_VOID__BOOLEAN,
-                      G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-                      
-	signals[REPEAT_TOGGLED] = 
-        g_signal_new ("repeat-toggled",
-                      PAROLE_TYPE_PLAYER,
-                      G_SIGNAL_RUN_LAST,
-                      G_STRUCT_OFFSET (ParolePlayerClass, repeat_toggled),
-                      NULL, NULL,
-                      g_cclosure_marshal_VOID__BOOLEAN,
-                      G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-				     
 }
 
 static void


More information about the Xfce4-commits mailing list