[Xfce4-commits] <parole:master> Cleaned up Media Chooser interface and code.

Sean Davis noreply at xfce.org
Tue Jul 24 03:18:01 CEST 2012


Updating branch refs/heads/master
         to abb837f464253d96d3e914b9add428b9e8763428 (commit)
       from cf9d75184df39a68b94b1a444aa8b09b0b1ad988 (commit)

commit abb837f464253d96d3e914b9add428b9e8763428
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Mon Jul 23 21:16:50 2012 -0400

    Cleaned up Media Chooser interface and code.

 data/interfaces/mediachooser.ui |  112 ++++++++++++++-------------------------
 data/pixmaps/Makefile.am        |    5 +-
 data/pixmaps/loader.gif         |  Bin 673 -> 0 bytes
 src/parole-mediachooser.c       |   81 ++++------------------------
 4 files changed, 52 insertions(+), 146 deletions(-)

diff --git a/data/interfaces/mediachooser.ui b/data/interfaces/mediachooser.ui
index 486e00c..ed98224 100644
--- a/data/interfaces/mediachooser.ui
+++ b/data/interfaces/mediachooser.ui
@@ -20,27 +20,35 @@
           <object class="GtkHButtonBox" id="dialog-action_area1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="layout_style">edge</property>
+            <property name="layout_style">end</property>
             <child>
-              <object class="GtkHBox" id="info">
+              <object class="GtkHBox" id="hbox1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <child>
-                  <placeholder/>
+                  <object class="GtkSpinner" id="spinner">
+                    <property name="can_focus">False</property>
+                    <property name="no_show_all">True</property>
+                    <property name="active">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
                 </child>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="position">0</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkHBox" id="hbox1">
+              <object class="GtkHButtonBox" id="hbuttonbox1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">5</property>
-                <property name="homogeneous">True</property>
                 <child>
                   <object class="GtkButton" id="close">
                     <property name="label">gtk-cancel</property>
@@ -64,7 +72,7 @@
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
                     <property name="use_action_appearance">False</property>
-                    <property name="image">image1</property>
+                    <property name="image">image4</property>
                     <property name="use_underline">True</property>
                     <signal name="clicked" handler="parole_media_chooser_add_clicked" swapped="no"/>
                   </object>
@@ -78,7 +86,6 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="pack_type">end</property>
                 <property name="position">1</property>
               </packing>
             </child>
@@ -91,73 +98,17 @@
           </packing>
         </child>
         <child>
-          <object class="GtkVBox" id="vbox">
+          <object class="GtkFileChooserWidget" id="filechooserwidget">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <child>
-              <object class="GtkFileChooserWidget" id="filechooserwidget">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="border_width">5</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">1</property>
-                <signal name="file-activated" handler="media_chooser_file_activate_cb" swapped="no"/>
-                <signal name="current-folder-changed" handler="media_chooser_folder_changed_cb" swapped="no"/>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="recursive">
-                <property name="label" translatable="yes">Scan folders recursively</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
-                <property name="draw_indicator">True</property>
-                <signal name="toggled" handler="parole_media_chooser_recursive_toggled_cb" swapped="no"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="replace">
-                <property name="label" translatable="yes">Replace playlist with opened files</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
-                <property name="draw_indicator">True</property>
-                <signal name="toggled" handler="parole_media_chooser_replace_toggled_cb" swapped="no"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="play-added-files">
-                <property name="label" translatable="yes">Start playing opened files</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
-                <property name="draw_indicator">True</property>
-                <signal name="toggled" handler="start_playing_toggled_cb" swapped="no"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
+            <property name="border_width">5</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">1</property>
+            <property name="create_folders">False</property>
+            <property name="local_only">False</property>
+            <property name="select_multiple">True</property>
+            <signal name="file-activated" handler="media_chooser_file_activate_cb" swapped="no"/>
+            <signal name="current-folder-changed" handler="media_chooser_folder_changed_cb" swapped="no"/>
           </object>
           <packing>
             <property name="expand">True</property>
@@ -173,4 +124,19 @@
     <property name="can_focus">False</property>
     <property name="stock">gtk-open</property>
   </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-open</property>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-open</property>
+  </object>
+  <object class="GtkImage" id="image4">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-open</property>
+  </object>
 </interface>
diff --git a/data/pixmaps/Makefile.am b/data/pixmaps/Makefile.am
index a1d4d08..44c3121 100644
--- a/data/pixmaps/Makefile.am
+++ b/data/pixmaps/Makefile.am
@@ -1,9 +1,8 @@
 pixmaps =					\
-	parole.png				\
-	loader.gif
+	parole.png
 
 pixmaps_DATA =					\
 	$(pixmaps)
 
 EXTRA_DIST =					\
-	$(pixmaps)
\ No newline at end of file
+	$(pixmaps)
diff --git a/data/pixmaps/loader.gif b/data/pixmaps/loader.gif
deleted file mode 100644
index d0bce15..0000000
Binary files a/data/pixmaps/loader.gif and /dev/null differ
diff --git a/src/parole-mediachooser.c b/src/parole-mediachooser.c
index 148000a..9ac46a2 100644
--- a/src/parole-mediachooser.c
+++ b/src/parole-mediachooser.c
@@ -29,8 +29,6 @@
 #include <gtk/gtk.h>
 #include <glib.h>
 
-//#include <libxfce4util/libxfce4util.h>
-
 #include <src/misc/parole-file.h>
 
 #include "interfaces/mediachooser_ui.h"
@@ -61,22 +59,13 @@ void	media_chooser_folder_changed_cb (GtkWidget *widget,
 void	media_chooser_file_activate_cb  (GtkFileChooser *filechooser,
 					 ParoleMediaChooser *chooser);
 
-void	parole_media_chooser_recursive_toggled_cb (GtkToggleButton *recursive,
-						   gpointer data);
-    
-void    parole_media_chooser_replace_toggled_cb (GtkToggleButton *button,
-						 gpointer data);    
-
-void    start_playing_toggled_cb (GtkToggleButton *button,
-				  gpointer data);
-
 struct ParoleMediaChooser
 {
-    GObject         		 parent;
+    GObject             parent;
     
-    ParoleConf                  *conf;
+    ParoleConf          *conf;
     GtkWidget			*window;
-    GtkWidget 			*info;
+    GtkWidget 			*spinner;
     
 };
 
@@ -117,7 +106,6 @@ parole_media_chooser_add (ParoleMediaChooser *chooser, GtkWidget *file_chooser)
     GSList *media_files = NULL;
     GSList *files;
     GtkFileFilter *filter;
-    GtkWidget *recursive;
     gboolean scan_recursive;
     gchar *file;
     guint    i;
@@ -129,9 +117,9 @@ parole_media_chooser_add (ParoleMediaChooser *chooser, GtkWidget *file_chooser)
     if ( G_UNLIKELY (files == NULL) )
 	return;
 	
-    recursive = g_object_get_data (G_OBJECT (chooser), "recursive");
-    
-    scan_recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (recursive));
+	g_object_get (G_OBJECT (chooser->conf),
+		  "scan-recursive", &scan_recursive,
+		  NULL);
     
     len = g_slist_length (files);
     
@@ -168,18 +156,9 @@ parole_media_chooser_add_idle (gpointer data)
 static void
 parole_media_chooser_open (ParoleMediaChooser *chooser)
 {
-    GtkWidget *img;
-    gchar *path;
-
     parole_window_busy_cursor (chooser->window->window);
-    
-    path = g_build_filename (PIXMAPS_DIR, "loader.gif", NULL);
-    
-    img = gtk_image_new_from_file (path);
-    g_free (path);
-    
-    gtk_box_pack_start (GTK_BOX (chooser->info), img, FALSE, FALSE, 0);
-    gtk_widget_show_all (chooser->info);
+
+    gtk_widget_show( chooser->spinner );
     
     g_idle_add ((GSourceFunc) parole_media_chooser_add_idle, chooser);
 }
@@ -204,42 +183,6 @@ void media_chooser_file_activate_cb (GtkFileChooser *filechooser, ParoleMediaCho
     parole_media_chooser_open (chooser);
 }
 
-void parole_media_chooser_recursive_toggled_cb (GtkToggleButton *recursive,
-						gpointer data)
-{
-    ParoleMediaChooser *chooser;
-
-    chooser = PAROLE_MEDIA_CHOOSER (data);
-    
-    g_object_set (G_OBJECT (chooser->conf),
-		  "scan-recursive", gtk_toggle_button_get_active (recursive),
-		  NULL);
-}
-
-void    parole_media_chooser_replace_toggled_cb (GtkToggleButton *button,
-						 gpointer data)
-{
-    ParoleMediaChooser *chooser;
-
-    chooser = PAROLE_MEDIA_CHOOSER (data);
-    
-    g_object_set (G_OBJECT (chooser->conf),
-		  "replace-playlist", gtk_toggle_button_get_active (button),
-		  NULL);
-}
-
-void start_playing_toggled_cb (GtkToggleButton *button,
-			       gpointer data)
-{
-    ParoleMediaChooser *chooser;
-
-    chooser = PAROLE_MEDIA_CHOOSER (data);
-    
-    g_object_set (G_OBJECT (chooser->conf),
-		  "play-opened-files", gtk_toggle_button_get_active (button),
-		  NULL);
-}
-
 static void
 parole_media_chooser_open_internal (ParoleMediaChooser *media_chooser)
 {
@@ -256,7 +199,9 @@ parole_media_chooser_open_internal (ParoleMediaChooser *media_chooser)
     builder = parole_builder_new_from_string (mediachooser_ui, mediachooser_ui_length);
     
     media_chooser->window = GTK_WIDGET (gtk_builder_get_object (builder, "chooser"));
-    media_chooser->info = GTK_WIDGET (gtk_builder_get_object (builder, "info"));
+    media_chooser->spinner = GTK_WIDGET (gtk_builder_get_object (builder, "spinner"));
+    
+    gtk_widget_hide( media_chooser->spinner );
     
     file_chooser = GTK_WIDGET (gtk_builder_get_object (builder, "filechooserwidget"));
     
@@ -283,10 +228,6 @@ parole_media_chooser_open_internal (ParoleMediaChooser *media_chooser)
     replace = GTK_WIDGET (gtk_builder_get_object (builder, "replace"));
     play_opened = GTK_WIDGET (gtk_builder_get_object (builder, "play-added-files"));
     
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (recursive), scan_recursive);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (replace), replace_playlist);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (play_opened), play);
-    
     g_object_set_data (G_OBJECT (media_chooser), "file-chooser", file_chooser);
     g_object_set_data (G_OBJECT (media_chooser), "recursive", recursive);
     


More information about the Xfce4-commits mailing list