[Xfce4-commits] <thunar:master> Don't error during counting with multiple files.
Nick Schermer
noreply at xfce.org
Sun Sep 16 20:16:17 CEST 2012
Updating branch refs/heads/master
to e88682f80219f130ae543a170a73d1d2fc1f67b5 (commit)
from 1183d1a843d122bc121415f6968a67831b66c16d (commit)
commit e88682f80219f130ae543a170a73d1d2fc1f67b5
Author: Nick Schermer <nick at 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"));
+ }
}
More information about the Xfce4-commits
mailing list