aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-prefs-locations.c
diff options
context:
space:
mode:
authorMichael Terry <mike@mterry.name>2011-03-30 09:12:30 -0400
committerMichael Terry <mike@mterry.name>2011-03-30 09:12:30 -0400
commitaf19585a970b79fdb5c566b1008d41830ced41c1 (patch)
tree3b4bd31a71f78c3c4db3bb1afb18ab928db6d63f /src/datetime-prefs-locations.c
parentd455a0cfb2d3f1fd9e244c5db636ad766dcc287d (diff)
downloadayatana-indicator-datetime-af19585a970b79fdb5c566b1008d41830ced41c1.tar.gz
ayatana-indicator-datetime-af19585a970b79fdb5c566b1008d41830ced41c1.tar.bz2
ayatana-indicator-datetime-af19585a970b79fdb5c566b1008d41830ced41c1.zip
add tooltip to error icon
Diffstat (limited to 'src/datetime-prefs-locations.c')
-rw-r--r--src/datetime-prefs-locations.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c
index 2862022..9c23a40 100644
--- a/src/datetime-prefs-locations.c
+++ b/src/datetime-prefs-locations.c
@@ -154,6 +154,27 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model,
return FALSE; // Do normal action too
}
+static gboolean
+query_tooltip (GtkTreeView * tree, gint x, gint y, gboolean keyboard_mode,
+ GtkTooltip * tooltip, GtkCellRenderer * cell)
+{
+ GtkTreeModel * model;
+ GtkTreeIter iter;
+ if (!gtk_tree_view_get_tooltip_context (tree, &x, &y, keyboard_mode,
+ &model, NULL, &iter))
+ return FALSE;
+
+ const gchar * icon;
+ gtk_tree_model_get (model, &iter, COL_ICON, &icon, -1);
+ if (icon == NULL)
+ return FALSE;
+
+ GtkTreeViewColumn * col = gtk_tree_view_get_column (tree, 0);
+ gtk_tree_view_set_tooltip_cell (tree, tooltip, NULL, col, cell);
+ gtk_tooltip_set_text (tooltip, _("You need to complete this location for it to appear in the menu."));
+ return TRUE;
+}
+
static void
handle_edit_started (GtkCellRendererText * renderer, GtkCellEditable * editable,
gchar * path, TimezoneCompletion * completion)
@@ -371,6 +392,9 @@ datetime_setup_locations_dialog (CcTimezoneMap * map)
gtk_tree_view_column_pack_start (loc_col, cell, FALSE);
gtk_tree_view_column_add_attribute (loc_col, cell, "icon-name", COL_ICON);
+ gtk_widget_set_has_tooltip (tree, TRUE);
+ g_signal_connect (tree, "query-tooltip", G_CALLBACK (query_tooltip), cell);
+
cell = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1,
_("Time"), cell,