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>
This commit is contained in:
Dirk Hohndel 2013-01-31 17:09:20 +11:00
parent b87a10a696
commit 5fd901591c

View file

@ -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);