Updating branch refs/heads/nick/gseal+clean
         to 5c0f6c9dd19e2d4b87b2aedbc007aeea92e01431 (commit)
       from 0156959702eaf110e64532d44876033fc41fc617 (commit)

commit 5c0f6c9dd19e2d4b87b2aedbc007aeea92e01431
Author: Nick Schermer <n...@xfce.org>
Date:   Sun Sep 16 17:56:09 2012 +0200

    Don't error during counting with multiple files.
    
    Handle this differently, so the count job does not
    error, but if it turns out all content was unreadable
    the size label will show a "permission denied" error.

 thunar/thunar-deep-count-job.c |    6 +++---
 thunar/thunar-size-label.c     |   34 +++++++++++++++++++++-------------
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/thunar/thunar-deep-count-job.c b/thunar/thunar-deep-count-job.c
index 6613dfe..23d5a94 100644
--- a/thunar/thunar-deep-count-job.c
+++ b/thunar/thunar-deep-count-job.c
@@ -220,7 +220,8 @@ thunar_deep_count_job_process (ExoJob    *job,
               /* directory was unreadable */
               count_job->unreadable_directory_count += 1;
 
-              if (toplevel_file)
+              if (toplevel_file
+                  && g_list_length (count_job->files) < 2)
                 {
                   /* we only bail out if the job file is unreadable */
                   success = FALSE;
@@ -228,8 +229,7 @@ thunar_deep_count_job_process (ExoJob    *job,
               else
                 {
                   /* ignore errors from files other than the job file */
-                  g_error_free (*error);
-                  *error = NULL;
+                  g_clear_error (error);
                 }
             }
           else
diff --git a/thunar/thunar-size-label.c b/thunar/thunar-size-label.c
index e1462c8..3f0c12b 100644
--- a/thunar/thunar-size-label.c
+++ b/thunar/thunar-size-label.c
@@ -368,22 +368,30 @@ thunar_size_label_status_update (ThunarDeepCountJob *job,
   /* determine the total number of items */
   n = file_count + directory_count + unreadable_directory_count;
 
-  /* update the label */
-  size_string = g_format_size (total_size);
-  text = g_strdup_printf (ngettext ("%u item, totalling %s", "%u items, 
totalling %s", n), n, size_string);
-  g_free (size_string);
-
-  if (unreadable_directory_count > 0)
+  if (G_LIKELY (n > unreadable_directory_count))
     {
-      /* TRANSLATORS: this is shows if during the deep count size
-       * directories were not accessible */
-      unreable_text = g_strconcat (text, "\n", _("(some contents 
unreadable)"), NULL);
+      /* update the label */
+      size_string = g_format_size (total_size);
+      text = g_strdup_printf (ngettext ("%u item, totalling %s", "%u items, 
totalling %s", n), n, size_string);
+      g_free (size_string);
+      
+      if (unreadable_directory_count > 0)
+        {
+          /* TRANSLATORS: this is shows if during the deep count size
+           * directories were not accessible */
+          unreable_text = g_strconcat (text, "\n", _("(some contents 
unreadable)"), NULL);
+          g_free (text);
+          text = unreable_text;
+        }
+      
+      gtk_label_set_text (GTK_LABEL (size_label->label), text);
       g_free (text);
-      text = unreable_text;
     }
-
-  gtk_label_set_text (GTK_LABEL (size_label->label), text);
-  g_free (text);
+  else
+    {
+      /* nothing was readable, so permission was denied */
+      gtk_label_set_text (GTK_LABEL (size_label->label), _("Permission 
denied"));
+    }
 }
 
 
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to