From 5fd901591cf2b2a2c613856425150e42235f7ecf Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 31 Jan 2013 17:09:20 +1100 Subject: Add tooltip that tells user how to edit dive information This adds the tooltip just to the Dive Notes page of the notebook area - that's where people are tempted to try to do "edit in-place" which we currently don't support. Signed-off-by: Dirk Hohndel --- gtk-gui.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gtk-gui.c b/gtk-gui.c index 8cb5c47e3..1c4672ac2 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -1488,6 +1488,17 @@ static gboolean on_key_press(GtkWidget *w, GdkEventKey *event, GtkWidget *diveli return FALSE; } +static gboolean notebook_tooltip (GtkWidget *widget, gint x, gint y, + gboolean keyboard_mode, GtkTooltip *tooltip, gpointer data) +{ + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widget)) == 0) { + gtk_tooltip_set_text(tooltip, _("To edit dive information\ndouble click on it in the dive list")); + return TRUE; + } else { + return FALSE; + } +} + void init_ui(int *argcp, char ***argvp) { GtkWidget *win; @@ -1597,6 +1608,10 @@ void init_ui(int *argcp, char ***argvp) nb_page = total_stats_widget(); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new(_("Stats"))); + /* add tooltip that tells people how to edit things */ + g_object_set(notebook, "has-tooltip", TRUE, NULL); + g_signal_connect(notebook, "query-tooltip", G_CALLBACK(notebook_tooltip), NULL); + /* handle some keys globally (to deal with gtk focus issues) */ g_signal_connect (G_OBJECT (win), "key_press_event", G_CALLBACK (on_key_press), dive_list); -- cgit v1.2.3-70-g09d2