summaryrefslogtreecommitdiff
path: root/thunar/thunar-file.c
diff options
context:
space:
mode:
authorHarald Judt <h.judt@gmx.at>2015-03-25 17:42:45 +0100
committerHarald Judt <h.judt@gmx.at>2015-04-17 13:08:38 +0200
commit2e61dbeefb51867ed920dac6aa1b5afd49f20373 (patch)
treecc9f42405dace18f8b7a983f90d7db908cf9b539 /thunar/thunar-file.c
parent3c1f0a5effcda9fc0d22d6e215c8310cda30f924 (diff)
downloadthunar-2e61dbeefb51867ed920dac6aa1b5afd49f20373.tar.gz
Refactor code for moving thumbnail cache file on renames/moves
Diffstat (limited to 'thunar/thunar-file.c')
-rw-r--r--thunar/thunar-file.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 7531b723..9a73108a 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);