]> spindle.queued.net Git - midori/commitdiff
Do not set a tooltip on tool items if the text is empty
authorEnrico Tröger <enrico.troeger@uvena.de>
Thu, 22 May 2008 23:58:44 +0000 (01:58 +0200)
committerChristian Dywan <christian@twotoasts.de>
Thu, 22 May 2008 23:58:44 +0000 (01:58 +0200)
src/sokoke.c

index 17bbc8cca9f1962c880d530655654529075b6157..48ab43df8cdcb94ce121fd114c2ca3a9b978fd9f 100644 (file)
@@ -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