[Xfce4-commits] <thunar:master> Add thumbnail cache update support to the link job.

Jannis Pohlmann noreply at xfce.org
Mon Feb 14 14:10:09 CET 2011


Updating branch refs/heads/master
         to 9317f1b660ac0e3753c5a6cc6341a1b59d609381 (commit)
       from ee3d81ed900dfd3e23b374504f34cc264abb3d2f (commit)

commit 9317f1b660ac0e3753c5a6cc6341a1b59d609381
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Mon Feb 7 22:17:35 2011 +0100

    Add thumbnail cache update support to the link job.
    
    This does wonders when linking stuff from slow remote locations into
    your local system.

 thunar/thunar-io-jobs.c         |   44 +++++++++++++++++++++++++++++---------
 thunar/thunar-thumbnail-cache.c |    2 +-
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/thunar/thunar-io-jobs.c b/thunar/thunar-io-jobs.c
index 7eb46db..dc92df1 100644
--- a/thunar/thunar-io-jobs.c
+++ b/thunar/thunar-io-jobs.c
@@ -408,6 +408,11 @@ _thunar_io_jobs_unlink (ThunarJob   *job,
   /* we know the total list of files to process */
   thunar_job_set_total_files (THUNAR_JOB (job), file_list);
 
+  /* take a reference on the thumbnail cache */
+  application = thunar_application_get ();
+  thumbnail_cache = thunar_application_get_thumbnail_cache (application);
+  g_object_unref (application);
+
   /* remove all the files */
   for (lp = file_list; lp != NULL && !exo_job_is_cancelled (EXO_JOB (job)); lp = lp->next)
     {
@@ -421,11 +426,9 @@ again:
       /* try to delete the file */
       if (g_file_delete (lp->data, exo_job_get_cancellable (EXO_JOB (job)), &err))
         {
-          application = thunar_application_get ();
-          thumbnail_cache = thunar_application_get_thumbnail_cache (application);
+          /* notify the thumbnail cache that the corresponding thumbnail can also
+           * be deleted now */
           thunar_thumbnail_cache_delete_file (thumbnail_cache, lp->data);
-          g_object_unref (thumbnail_cache);
-          g_object_unref (application);
         }
       else
         {
@@ -471,6 +474,9 @@ again:
         }
     }
 
+  /* release the thumbnail cache */
+  g_object_unref (thumbnail_cache);
+
   /* release the file list */
   thunar_g_file_list_free (file_list);
 
@@ -658,13 +664,15 @@ _thunar_io_jobs_link (ThunarJob   *job,
                       GValueArray *param_values,
                       GError     **error)
 {
-  GError *err = NULL;
-  GFile  *real_target_file;
-  GList  *new_files_list = NULL;
-  GList  *source_file_list;
-  GList  *sp;
-  GList  *target_file_list;
-  GList  *tp;
+  ThunarThumbnailCache *thumbnail_cache;
+  ThunarApplication    *application;
+  GError               *err = NULL;
+  GFile                *real_target_file;
+  GList                *new_files_list = NULL;
+  GList                *source_file_list;
+  GList                *sp;
+  GList                *target_file_list;
+  GList                *tp;
 
   _thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
   _thunar_return_val_if_fail (param_values != NULL, FALSE);
@@ -677,6 +685,11 @@ _thunar_io_jobs_link (ThunarJob   *job,
   /* we know the total list of paths to process */
   thunar_job_set_total_files (THUNAR_JOB (job), source_file_list);
 
+  /* take a reference on the thumbnail cache */
+  application = thunar_application_get ();
+  thumbnail_cache = thunar_application_get_thumbnail_cache (application);
+  g_object_unref (application);
+
   /* process all files */
   for (sp = source_file_list, tp = target_file_list;
        err == NULL && sp != NULL && tp != NULL;
@@ -697,6 +710,12 @@ _thunar_io_jobs_link (ThunarJob   *job,
             {
               new_files_list = thunar_g_file_list_prepend (new_files_list, 
                                                            real_target_file);
+
+              /* notify the thumbnail cache that we need to copy the original
+               * thumbnail for the symlink to have one too */
+              thunar_thumbnail_cache_copy_file (thumbnail_cache, sp->data, 
+                                                real_target_file);
+
             }
   
           /* release the real target file */
@@ -704,6 +723,9 @@ _thunar_io_jobs_link (ThunarJob   *job,
         }
     }
 
+  /* release the thumbnail cache */
+  g_object_unref (thumbnail_cache);
+
   if (err != NULL)
     {
       thunar_g_file_list_free (new_files_list);
diff --git a/thunar/thunar-thumbnail-cache.c b/thunar/thunar-thumbnail-cache.c
index fe62dc3..4725498 100644
--- a/thunar/thunar-thumbnail-cache.c
+++ b/thunar/thunar-thumbnail-cache.c
@@ -467,7 +467,7 @@ thunar_thumbnail_cache_move_file (ThunarThumbnailCache *cache,
           cache->move_queue_idle_id = 0;
         }
 
-      /* add the files to the move queues */
+      /* add the files to the move queue */
       cache->move_source_queue = g_list_prepend (cache->move_source_queue, 
                                                  g_object_ref (source_file));
       cache->move_target_queue = g_list_prepend (cache->move_target_queue,



More information about the Xfce4-commits mailing list