[Xfce4-commits] [xfce/thunar] 05/10: Refactor code for moving thumbnail cache file on renames/moves

noreply at xfce.org noreply at xfce.org
Sat Apr 18 14:23:08 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 2e61dbeefb51867ed920dac6aa1b5afd49f20373
Author: Harald Judt <h.judt at gmx.at>
Date:   Wed Mar 25 17:42:45 2015 +0100

    Refactor code for moving thumbnail cache file on renames/moves
---
 thunar/thunar-file.c |   31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 7531b72..9a73108 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -682,22 +682,36 @@ thunar_file_monitor_update (GFile             *path,
 
 
 static void
-thunar_file_monitor_moved (ThunarFile *file,
-                           GFile      *renamed_file)
+thunar_file_move_thumbnail_cache_file (GFile *old_file,
+                                       GFile *new_file)
 {
   ThunarApplication    *application;
   ThunarThumbnailCache *thumbnail_cache;
-  GFile                *previous_file;
 
-  /* ref the old location */
-  previous_file = g_object_ref (G_OBJECT (file->gfile));
+  _thunar_return_if_fail (G_IS_FILE (old_file));
+  _thunar_return_if_fail (G_IS_FILE (new_file));
 
-  /* notify the thumbnail cache that we can now also move the thumbnail */
   application = thunar_application_get ();
   thumbnail_cache = thunar_application_get_thumbnail_cache (application);
-  thunar_thumbnail_cache_move_file (thumbnail_cache, previous_file, renamed_file);
+  thunar_thumbnail_cache_move_file (thumbnail_cache, old_file, new_file);
+
   g_object_unref (thumbnail_cache);
   g_object_unref (application);
+}
+
+
+
+static void
+thunar_file_monitor_moved (ThunarFile *file,
+                           GFile      *renamed_file)
+{
+  GFile *previous_file;
+
+  /* ref the old location */
+  previous_file = g_object_ref (G_OBJECT (file->gfile));
+
+  /* notify the thumbnail cache that we can now also move the thumbnail */
+  thunar_file_move_thumbnail_cache_file (previous_file, renamed_file);
 
   /* set the new file */
   file->gfile = g_object_ref (G_OBJECT (renamed_file));
@@ -793,6 +807,9 @@ thunar_file_monitor (GFileMonitor     *monitor,
           if (!other_file)
               return;
 
+          /* notify the thumbnail cache that we can now also move the thumbnail */
+          thunar_file_move_thumbnail_cache_file (event_path, other_path);
+
           /* reload the containing target folder */
           thunar_file_reload_parent (other_file);
 

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


More information about the Xfce4-commits mailing list