[Xfce4-commits] <thunar:master> Add tooltips to sidepane.
Nick Schermer
noreply at xfce.org
Sat Oct 13 16:12:32 CEST 2012
Updating branch refs/heads/master
to bef88fd401bf1dadb680553c6521e7a072537935 (commit)
from 90b4f222bc0a72f986907ca7184c1b59ce22495b (commit)
commit bef88fd401bf1dadb680553c6521e7a072537935
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