[Xfce4-commits] [xfce/thunar] 09/10: Implement reloading file information on manual reload

noreply at xfce.org noreply at xfce.org
Sat Apr 18 14:23:12 CEST 2015


This is an automated email from the git hooks/post-receive script.

hjudt pushed a commit to branch master
in repository xfce/thunar.

commit b2012f58da7ba8e8bf28aaca2b5cde45552ce0c3
Author: Harald Judt <h.judt at gmx.at>
Date:   Fri Apr 17 11:47:37 2015 +0200

    Implement reloading file information on manual reload
---
 thunar/thunar-folder.c        |   25 ++++++++++++++++++++++---
 thunar/thunar-folder.h        |    3 ++-
 thunar/thunar-standard-view.c |    4 ++--
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c
index 2e0b95b..9e6fc17 100644
--- a/thunar/thunar-folder.c
+++ b/thunar/thunar-folder.c
@@ -109,6 +109,7 @@ struct _ThunarFolder
   ThunarFile        *corresponding_file;
   GList             *new_files;
   GList             *files;
+  gboolean           reload_info;
 
   GList             *content_type_ptr;
   guint              content_type_idle_id;
@@ -248,6 +249,7 @@ thunar_folder_init (ThunarFolder *folder)
   g_signal_connect (G_OBJECT (folder->file_monitor), "file-destroyed", G_CALLBACK (thunar_folder_file_destroyed), folder);
 
   folder->monitor = NULL;
+  folder->reload_info = FALSE;
 }
 
 
@@ -545,6 +547,18 @@ thunar_folder_finished (ExoJob       *job,
         }
     }
 
+  /* schedule a reload of the file information of all files if requested */
+  if (folder->reload_info)
+    {
+      for (lp = folder->files; lp != NULL; lp = lp->next)
+        thunar_file_reload_idle (lp->data);
+
+      /* reload folder information too */
+      thunar_file_reload_idle (folder->corresponding_file);
+
+      folder->reload_info = FALSE;
+    }
+
   /* we did it, the folder is loaded */
   g_signal_handlers_disconnect_matched (folder->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, folder);
   g_object_unref (folder->job);
@@ -578,7 +592,7 @@ thunar_folder_file_changed (ThunarFileMonitor *file_monitor,
   if (G_UNLIKELY (folder->corresponding_file == file))
     {
       /* ...and if so, reload the folder */
-      thunar_folder_reload (folder);
+      thunar_folder_reload (folder, FALSE);
     }
 }
 
@@ -855,7 +869,7 @@ thunar_folder_get_for_file (ThunarFile *file)
       g_object_set_qdata (G_OBJECT (file), thunar_folder_quark, folder);
 
       /* schedule the loading of the folder */
-      thunar_folder_reload (folder);
+      thunar_folder_reload (folder, FALSE);
     }
 
   return folder;
@@ -923,15 +937,20 @@ thunar_folder_get_loading (const ThunarFolder *folder)
 /**
  * thunar_folder_reload:
  * @folder : a #ThunarFolder instance.
+ * @reload_info : reload all information for the files too
  *
  * Tells the @folder object to reread the directory
  * contents from the underlying media.
  **/
 void
-thunar_folder_reload (ThunarFolder *folder)
+thunar_folder_reload (ThunarFolder *folder,
+                      gboolean      reload_info)
 {
   _thunar_return_if_fail (THUNAR_IS_FOLDER (folder));
 
+  /* reload file info too? */
+  folder->reload_info = reload_info;
+
   /* stop metadata collector */
   if (folder->content_type_idle_id != 0)
     g_source_remove (folder->content_type_idle_id);
diff --git a/thunar/thunar-folder.h b/thunar/thunar-folder.h
index 9c1411c..1701b45 100644
--- a/thunar/thunar-folder.h
+++ b/thunar/thunar-folder.h
@@ -42,7 +42,8 @@ ThunarFile   *thunar_folder_get_corresponding_file (const ThunarFolder *folder);
 GList        *thunar_folder_get_files              (const ThunarFolder *folder);
 gboolean      thunar_folder_get_loading            (const ThunarFolder *folder);
 
-void          thunar_folder_reload                 (ThunarFolder       *folder);
+void          thunar_folder_reload                 (ThunarFolder       *folder,
+                                                    gboolean            reload_info);
 
 G_END_DECLS;
 
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 06b9376..fa65d46 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -1714,7 +1714,7 @@ thunar_standard_view_reload (ThunarView *view,
   /* determine the folder for the view model */
   folder = thunar_list_model_get_folder (standard_view->model);
   if (G_LIKELY (folder != NULL))
-    thunar_folder_reload (folder);
+    thunar_folder_reload (folder, reload_info);
 
   /* schedule thumbnail reload update */
   if (!standard_view->priv->thumbnailing_scheduled)
@@ -3286,7 +3286,7 @@ thunar_standard_view_drag_data_received (GtkWidget          *view,
                     {
                       /* reload the folder corresponding to the file */
                       folder = thunar_folder_get_for_file (file);
-                      thunar_folder_reload (folder);
+                      thunar_folder_reload (folder, FALSE);
                       g_object_unref (G_OBJECT (folder));
                     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list