Commit 3c47e7a7 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Delay function completion tooltip. [#668683]

2012-02-21  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* gnumeric-expr-entry.c (gee_delete_tooltip): return info on
	tooltip visibility, clear appearance timer
	(cb_show_tooltip): new
	(gee_create_tooltip): don't show tooltip
	(gee_set_tooltip): show tooltip
	(gee_set_tooltip_completion): delay first tooltip
parent 9a8c99d4
......@@ -5,6 +5,7 @@ Andreas:
* Implement ctrl-click cell deselection. [#610696]
* Fix LaTeX export of cyrillic. [#666340]
* Fix function tool tip. [#668685]
* Delay function completion tooltip. [#668683]
* Import inline text from xlsx files. [#668936]
* Fix rich text import from xlsx. [#669083]
* Fix data shuffle. [#669184]
......
2012-02-21 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* gnumeric-expr-entry.c (gee_delete_tooltip): return info on
tooltip visibility, clear appearance timer
(cb_show_tooltip): new
(gee_create_tooltip): don't show tooltip
(gee_set_tooltip): show tooltip
(gee_set_tooltip_completion): delay first tooltip
2012-01-27 Morten Welinder <terra@gnome.org>
* gnumeric-expr-entry.c (gnm_expr_entry_find_range): Default to
......
......@@ -137,6 +137,7 @@ struct _GnmExprEntry {
gint args;
gboolean had_stuff;
gulong handlerid;
guint timerid;
gboolean enabled;
gboolean is_expr;
gboolean completion_se_valid;
......@@ -728,9 +729,16 @@ gee_update_env (GnmExprEntry *gee)
}
static void
static gboolean
gee_delete_tooltip (GnmExprEntry *gee, gboolean remove_completion)
{
gboolean has_tooltip = (gee->tooltip.tooltip != NULL &&
gee->tooltip.timerid == 0);
if (gee->tooltip.timerid) {
g_source_remove (gee->tooltip.timerid);
gee->tooltip.timerid = 0;
}
if (gee->tooltip.tooltip) {
gtk_widget_destroy (gee->tooltip.tooltip);
gee->tooltip.tooltip = NULL;
......@@ -750,6 +758,7 @@ gee_delete_tooltip (GnmExprEntry *gee, gboolean remove_completion)
gee->tooltip.completion = NULL;
gee->tooltip.completion_se_valid = FALSE;
}
return has_tooltip;
}
void
......@@ -764,6 +773,16 @@ cb_gee_focus_out_event (GtkWidget *widget,
GdkEventFocus *event,
gpointer user_data);
static gboolean
cb_show_tooltip (gpointer user_data)
{
GnmExprEntry *gee = GNM_EXPR_ENTRY (user_data);
gtk_widget_show_all (gee->tooltip.tooltip);
gee->tooltip.timerid = 0;
return FALSE;
}
static GtkWidget *
gee_create_tooltip (GnmExprEntry *gee, gchar const *str,
gchar const *marked_str, gboolean set_tabs)
......@@ -829,8 +848,6 @@ gee_create_tooltip (GnmExprEntry *gee, gchar const *str,
root_x + allocation.x,
root_y + allocation.y + allocation.height);
gtk_widget_show_all (tip);
return tip;
}
......@@ -919,6 +936,7 @@ gee_set_tooltip (GnmExprEntry *gee, GnmFunc *fd, gint args, gboolean had_stuff)
gee->tooltip.tooltip = gee_create_tooltip
(gee, str->str, _("\n\n<i>Ctrl-F4 to close tooltip</i>"), FALSE);
gtk_widget_show_all (gee->tooltip.tooltip);
gee->tooltip.args = args;
gee->tooltip.had_stuff = (max == 0 && args == 0 && had_stuff);
......@@ -934,10 +952,10 @@ gee_set_tooltip_completion (GnmExprEntry *gee, GSList *list, guint start, guint
gint max = 10;
GSList *list_c = list;
gchar const *name = NULL;
gboolean show_tool_tip;
gboolean show_tool_tip, had_tool_tip;
gboolean localized_function_names = gee->sheet->convs->localized_function_names;
gee_delete_tooltip (gee, TRUE);
had_tool_tip = gee_delete_tooltip (gee, TRUE);
str = g_string_new (NULL);
for (; list_c != NULL && ++i < max; list_c = list_c->next) {
......@@ -974,9 +992,18 @@ gee_set_tooltip_completion (GnmExprEntry *gee, GSList *list, guint start, guint
gee->tooltip.completion_end = end;
gee->tooltip.completion_se_valid = TRUE;
show_tool_tip = gnm_conf_get_core_gui_editing_function_name_tooltips ();
if (show_tool_tip)
if (show_tool_tip) {
gee->tooltip.tooltip = gee_create_tooltip
(gee, str->str, str_marked->str, TRUE);
if (had_tool_tip)
gtk_widget_show_all (gee->tooltip.tooltip);
else
gee->tooltip.timerid = g_timeout_add_full
(G_PRIORITY_DEFAULT, 750,
cb_show_tooltip,
gee,
NULL);
}
g_string_free (str, TRUE);
g_string_free (str_marked, TRUE);
g_slist_free_full (list, (GDestroyNotify) gnm_func_unref);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment