[Xfce4-commits] <thunar:nick/new-shortcuts-pane-model> Add tooltips to sidepane.

Nick Schermer noreply at xfce.org
Thu Oct 11 22:24:01 CEST 2012


Updating branch refs/heads/nick/new-shortcuts-pane-model
         to b2a32b5260af24a8a37af59abf84c67b105a027a (commit)
       from 674980f42b30e2c23a8bba6327b0a28d46a35eb1 (commit)

commit b2a32b5260af24a8a37af59abf84c67b105a027a
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Oct 11 22:17:37 2012 +0200

    Add tooltips to sidepane.

 thunar/thunar-shortcuts-model.c |   22 ++++++++++++++++++++++
 thunar/thunar-shortcuts-model.h |    1 +
 thunar/thunar-shortcuts-view.c  |    1 +
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index 15c0cb5..0651aeb 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -435,6 +435,9 @@ thunar_shortcuts_model_get_column_type (GtkTreeModel *tree_model,
     case THUNAR_SHORTCUTS_MODEL_COLUMN_NAME:
       return G_TYPE_STRING;
 
+    case THUNAR_SHORTCUTS_MODEL_COLUMN_TOOLTIP:
+      return G_TYPE_STRING;
+
     case THUNAR_SHORTCUTS_MODEL_COLUMN_FILE:
       return THUNAR_TYPE_FILE;
 
@@ -521,6 +524,7 @@ thunar_shortcuts_model_get_value (GtkTreeModel *tree_model,
 {
   ThunarShortcut *shortcut;
   gboolean        can_eject;
+  GFile          *file;
 
   _thunar_return_if_fail (iter->stamp == THUNAR_SHORTCUTS_MODEL (tree_model)->stamp);
   _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_MODEL (tree_model));
@@ -564,6 +568,24 @@ thunar_shortcuts_model_get_value (GtkTreeModel *tree_model,
         g_value_set_static_string (value, "");
       break;
 
+    case THUNAR_SHORTCUTS_MODEL_COLUMN_TOOLTIP:
+      g_value_init (value, G_TYPE_STRING);
+      if (shortcut->file != NULL)
+        file = g_object_ref (thunar_file_get_file (shortcut->file));
+      else if (shortcut->location != NULL)
+        file = g_object_ref (shortcut->location);
+      else if (shortcut->device != NULL)
+        file = thunar_device_get_root (shortcut->device);
+      else
+        file = NULL;
+
+      if (G_LIKELY (file != NULL))
+        {
+          g_value_take_string (value, g_file_get_parse_name (file));
+          g_object_unref (file);
+        }
+      break;
+
     case THUNAR_SHORTCUTS_MODEL_COLUMN_FILE:
       g_value_init (value, THUNAR_TYPE_FILE);
       g_value_set_object (value, shortcut->file);
diff --git a/thunar/thunar-shortcuts-model.h b/thunar/thunar-shortcuts-model.h
index f09cbec..0f9bcc1 100644
--- a/thunar/thunar-shortcuts-model.h
+++ b/thunar/thunar-shortcuts-model.h
@@ -42,6 +42,7 @@ typedef enum
   THUNAR_SHORTCUTS_MODEL_COLUMN_ITEM,
   THUNAR_SHORTCUTS_MODEL_COLUMN_VISIBLE,
   THUNAR_SHORTCUTS_MODEL_COLUMN_NAME,
+  THUNAR_SHORTCUTS_MODEL_COLUMN_TOOLTIP,
   THUNAR_SHORTCUTS_MODEL_COLUMN_FILE,
   THUNAR_SHORTCUTS_MODEL_COLUMN_LOCATION,
   THUNAR_SHORTCUTS_MODEL_COLUMN_GICON,
diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c
index 831ccb5..c29fec3 100644
--- a/thunar/thunar-shortcuts-view.c
+++ b/thunar/thunar-shortcuts-view.c
@@ -243,6 +243,7 @@ thunar_shortcuts_view_init (ThunarShortcutsView *view)
   /* configure the tree view */
   gtk_tree_view_set_enable_search (GTK_TREE_VIEW (view), FALSE);
   gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
+  gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (view), THUNAR_SHORTCUTS_MODEL_COLUMN_TOOLTIP);
 
   /* grab a reference on the provider factory */
   view->provider_factory = thunarx_provider_factory_get_default ();


More information about the Xfce4-commits mailing list