Do not set a tooltip on tool items if the text is empty
This commit is contained in:
parent
4a488da7b1
commit
a6aa345316
1 changed files with 9 additions and 3 deletions
12
src/sokoke.c
12
src/sokoke.c
|
@ -129,11 +129,17 @@ void sokoke_widget_set_tooltip_text(GtkWidget* widget, const gchar* text)
|
||||||
#endif
|
#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
|
// TODO: Use 2.12 api if available
|
||||||
GtkTooltips* tooltips = gtk_tooltips_new();
|
static GtkTooltips* tooltips = NULL;
|
||||||
gtk_tool_item_set_tooltip(toolitem, tooltips, text, NULL);
|
|
||||||
|
if (G_UNLIKELY (!tooltips))
|
||||||
|
tooltips = gtk_tooltips_new();
|
||||||
|
|
||||||
|
if (text && *text)
|
||||||
|
gtk_tool_item_set_tooltip (toolitem, tooltips, text, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
Loading…
Reference in a new issue