[Xfce4-commits] <thunar:master> Add special tooltip for the trash in shortcuts.

Nick Schermer noreply at xfce.org
Sun Dec 2 19:08:01 CET 2012


Updating branch refs/heads/master
         to e2f3815ed0e40b423d2b4f9fdee31a440fe14614 (commit)
       from 632227e17b8ab7b3b8ac892a82535130a36488ea (commit)

commit e2f3815ed0e40b423d2b4f9fdee31a440fe14614
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Dec 2 19:06:42 2012 +0100

    Add special tooltip for the trash in shortcuts.

 thunar/thunar-shortcuts-model.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index 49ed7a7..c1dcfa8 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -528,6 +528,8 @@ thunar_shortcuts_model_get_value (GtkTreeModel *tree_model,
   gboolean        can_eject;
   GFile          *file;
   gchar          *disk_usage;
+  guint32         trash_items;
+  gchar          *trash_string;
 
   _thunar_return_if_fail (iter->stamp == THUNAR_SHORTCUTS_MODEL (tree_model)->stamp);
   _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_MODEL (tree_model));
@@ -590,6 +592,22 @@ thunar_shortcuts_model_get_value (GtkTreeModel *tree_model,
             }
           break;
         }
+      else if ((shortcut->group & THUNAR_SHORTCUT_GROUP_PLACES_TRASH) != 0)
+        {
+          trash_items = thunar_file_get_item_count (shortcut->file);
+          if (trash_items == 0)
+            {
+              g_value_set_static_string (value, _("Trash is empty"));
+            }
+          else
+            {
+              trash_string = g_strdup_printf (ngettext ("Trash contains %d file",
+                                                        "Trash contains %d files",
+                                                        trash_items), trash_items);
+              g_value_take_string (value, trash_string);
+            }
+          break;
+        }
       else if (shortcut->tooltip == NULL)
         {
           if (shortcut->file != NULL)


More information about the Xfce4-commits mailing list