[Xfce4-commits] <parole:master> Fix the way to add files from the terminal

Ali Abdallah noreply at xfce.org
Tue Nov 24 15:48:01 CET 2009


Updating branch refs/heads/master
         to eafcfd1145c2cc48e3d25d0e8ecadce3288b4e08 (commit)
       from 61bcd0c9ae48e86089ce7c023448c5a9c0213d4b (commit)

commit eafcfd1145c2cc48e3d25d0e8ecadce3288b4e08
Author: Ali Abdallah <ali at ali-xfce.org>
Date:   Tue Nov 24 15:24:49 2009 +0100

    Fix the way to add files from the terminal

 src/parole-medialist.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index 5b63f20..02d41c1 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -206,18 +206,13 @@ parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean emit, g
     {
 	path = gtk_tree_model_get_path (GTK_TREE_MODEL (list_store), &iter);
 	row = gtk_tree_row_reference_new (GTK_TREE_MODEL (list_store), path);
+	if ( select_row )
+	    parole_media_list_select_path (list, path);
 	gtk_tree_path_free (path);
 	g_signal_emit (G_OBJECT (list), signals [MEDIA_ACTIVATED], 0, row);
 	gtk_tree_row_reference_free (row);
     }
   
-    if ( select_row )
-    {
-	path = gtk_tree_model_get_path (GTK_TREE_MODEL (list_store), &iter);
-	parole_media_list_select_path (list, path);
-	gtk_tree_path_free (path);
-    }
-    
     /*
      * Unref it as the list store will have
      * a reference anyway.
@@ -239,8 +234,8 @@ parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean emit, g
 }
 
 static void
-parole_media_list_files_opened_cb (ParoleMediaChooser *chooser, gboolean replace,
-				   GSList *files, ParoleMediaList *list)
+parole_media_list_files_open (ParoleMediaList *list, GSList *files, 
+			      gboolean replace, gboolean emit)
 {
     ParoleFile *file;
     guint len;
@@ -251,9 +246,10 @@ parole_media_list_files_opened_cb (ParoleMediaChooser *chooser, gboolean replace
     
     if ( len != 0 )
     {
-	parole_media_list_clear_list (list);
+	if ( replace )
+	    parole_media_list_clear_list (list);
 	file = g_slist_nth_data (files, 0);
-	parole_media_list_add (list, file, TRUE, TRUE);
+	parole_media_list_add (list, file, emit, TRUE);
     }
     
     for ( i = 1; i < len; i++)
@@ -264,6 +260,13 @@ parole_media_list_files_opened_cb (ParoleMediaChooser *chooser, gboolean replace
 }
 
 static void
+parole_media_list_files_opened_cb (ParoleMediaChooser *chooser, gboolean replace,
+				   GSList *files, ParoleMediaList *list)
+{
+    parole_media_list_files_open (list, files, replace, TRUE);
+}
+
+static void
 parole_media_list_location_opened_cb (ParoleOpenLocation *obj, const gchar *location, ParoleMediaList *list)
 {
     ParoleFile *file;
@@ -1093,7 +1096,7 @@ void parole_media_list_load (ParoleMediaList *list)
 gboolean
 parole_media_list_add_by_path (ParoleMediaList *list, const gchar *path, gboolean emit)
 {
-    GSList *file_list = NULL;
+    GSList *files_list = NULL;
     GtkFileFilter *filter;
     guint len;
     gboolean ret = FALSE;
@@ -1101,14 +1104,15 @@ parole_media_list_add_by_path (ParoleMediaList *list, const gchar *path, gboolea
     filter = parole_get_supported_media_filter ();
     g_object_ref_sink (filter);
     
-    parole_get_media_files (filter, path, TRUE, &file_list);
+    parole_get_media_files (filter, path, TRUE, &files_list);
+    
+    parole_media_list_files_open (list, files_list, FALSE, emit);
     
-    parole_media_list_files_opened_cb (NULL, FALSE, file_list, list);
-    len = g_slist_length (file_list);
+    len = g_slist_length (files_list);
     ret = len == 0 ? FALSE : TRUE;
     
     g_object_unref (filter);
-    g_slist_free (file_list);
+    g_slist_free (files_list);
     return ret;
 }
 



More information about the Xfce4-commits mailing list