diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-01-31 17:09:20 +1100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-31 17:11:25 +1100 |
commit | 5fd901591cf2b2a2c613856425150e42235f7ecf (patch) | |
tree | 1b8e69de2eb2fac5e0f7a6b050612c25a8f47ed2 /gtk-gui.c | |
parent | b87a10a69621d572752f1c164f1cca6202f6485d (diff) | |
download | subsurface-5fd901591cf2b2a2c613856425150e42235f7ecf.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r-- | gtk-gui.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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); |