From a6aa3453164542303dc2d3d725f53d491d023a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Fri, 23 May 2008 01:58:44 +0200 Subject: [PATCH] Do not set a tooltip on tool items if the text is empty --- src/sokoke.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sokoke.c b/src/sokoke.c index 17bbc8cc..48ab43df 100644 --- a/src/sokoke.c +++ b/src/sokoke.c @@ -129,11 +129,17 @@ void sokoke_widget_set_tooltip_text(GtkWidget* widget, const gchar* text) #endif } -void sokoke_tool_item_set_tooltip_text(GtkToolItem* toolitem, const gchar* text) +void +sokoke_tool_item_set_tooltip_text (GtkToolItem* toolitem, const gchar* text) { // TODO: Use 2.12 api if available - GtkTooltips* tooltips = gtk_tooltips_new(); - gtk_tool_item_set_tooltip(toolitem, tooltips, text, NULL); + static GtkTooltips* tooltips = NULL; + + if (G_UNLIKELY (!tooltips)) + tooltips = gtk_tooltips_new(); + + if (text && *text) + gtk_tool_item_set_tooltip (toolitem, tooltips, text, NULL); } typedef struct