diff --git a/midori/compat.c b/midori/compat.c index d9ff8bb7..5ebbfa39 100644 --- a/midori/compat.c +++ b/midori/compat.c @@ -11,6 +11,33 @@ #include "compat.h" +#if !GTK_CHECK_VERSION(2, 12, 0) + +void +sokoke_widget_set_tooltip_text (GtkWidget* widget, const gchar* text) +{ + static GtkTooltips* tooltips; + if (!tooltips) + tooltips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tooltips, widget, text, NULL); +} + +void +gtk_tool_item_set_tooltip_text (GtkToolItem* toolitem, + const gchar* text) +{ + if (text && *text) + { + static GtkTooltips* tooltips = NULL; + if (G_UNLIKELY (!tooltips)) + tooltips = gtk_tooltips_new(); + + gtk_tool_item_set_tooltip (toolitem, tooltips, text, NULL); + } +} + +#endif + #ifndef WEBKIT_CHECK_VERSION /** diff --git a/midori/compat.h b/midori/compat.h index 1547b11d..a539ed5f 100644 --- a/midori/compat.h +++ b/midori/compat.h @@ -16,6 +16,18 @@ G_BEGIN_DECLS +#if !GTK_CHECK_VERSION(2, 12, 0) + +void +gtk_widget_set_tooltip_text (GtkWidget* widget, + const gchar* text); + +void +gtk_tool_item_set_tooltip_text (GtkToolItem* toolitem, + const gchar* text); + +#endif + #ifndef WEBKIT_CHECK_VERSION gfloat diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 2fa5c5eb..d68ad086 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2759,7 +2759,7 @@ midori_browser_init (MidoriBrowser* browser) g_signal_connect (toolitem, "clicked", G_CALLBACK (midori_browser_bookmarkbar_folder_activate_cb), browser); - sokoke_tool_item_set_tooltip_text(toolitem, desc); + gtk_tool_item_set_tooltip_text (toolitem, desc); g_object_set_data (G_OBJECT (toolitem), "KatzeXbelItem", item); break; case KATZE_XBEL_ITEM_KIND_BOOKMARK: @@ -2769,7 +2769,7 @@ midori_browser_init (MidoriBrowser* browser) g_signal_connect (toolitem, "clicked", G_CALLBACK (midori_browser_menu_bookmarks_item_activate_cb), browser); - sokoke_tool_item_set_tooltip_text(toolitem, desc); + gtk_tool_item_set_tooltip_text (toolitem, desc); g_object_set_data (G_OBJECT (toolitem), "KatzeXbelItem", item); break; case KATZE_XBEL_ITEM_KIND_SEPARATOR: diff --git a/midori/midori-panel.c b/midori/midori-panel.c index 9c321d1e..5bf45178 100644 --- a/midori/midori-panel.c +++ b/midori/midori-panel.c @@ -210,7 +210,7 @@ midori_panel_init (MidoriPanel* panel) gtk_toolbar_insert (GTK_TOOLBAR (labelbar), toolitem, -1); toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_CLOSE); gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), _("Close panel")); - sokoke_tool_item_set_tooltip_text (GTK_TOOL_ITEM (toolitem), _("Close panel")); + gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (toolitem), _("Close panel")); g_signal_connect (toolitem, "clicked", G_CALLBACK (midori_panel_button_close_clicked_cb), panel); gtk_toolbar_insert (GTK_TOOLBAR (labelbar), toolitem, -1); diff --git a/midori/midori-webview.c b/midori/midori-webview.c index 827c601c..f2b8e0dd 100644 --- a/midori/midori-webview.c +++ b/midori/midori-webview.c @@ -666,7 +666,7 @@ midori_web_view_set_property (GObject* object, if (priv->tab_label) { gtk_label_set_text (GTK_LABEL (priv->tab_label), title); - sokoke_widget_set_tooltip_text (priv->tab_label, title); + gtk_widget_set_tooltip_text (priv->tab_label, title); } if (priv->proxy_menu_item) gtk_label_set_text (GTK_LABEL (gtk_bin_get_child (GTK_BIN ( diff --git a/midori/sokoke.c b/midori/sokoke.c index 157252d5..20dc48e0 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -130,36 +130,6 @@ sokoke_container_show_children (GtkContainer* container) gtk_container_foreach (container, (GtkCallback)(gtk_widget_show_all), NULL); } -void -sokoke_widget_set_tooltip_text (GtkWidget* widget, const gchar* text) -{ - #if GTK_CHECK_VERSION(2, 12, 0) - gtk_widget_set_tooltip_text (widget, text); - #else - static GtkTooltips* tooltips; - if (!tooltips) - tooltips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tooltips, widget, text, NULL); - #endif -} - -void -sokoke_tool_item_set_tooltip_text (GtkToolItem* toolitem, const gchar* text) -{ - if (text && *text) - { - #if GTK_CHECK_VERSION(2, 12, 0) - gtk_tool_item_set_tooltip_text (toolitem, text); - #else - static GtkTooltips* tooltips = NULL; - if (G_UNLIKELY (!tooltips)) - tooltips = gtk_tooltips_new(); - - gtk_tool_item_set_tooltip (toolitem, tooltips, text, NULL); - #endif - } -} - typedef struct { GtkWidget* widget; diff --git a/midori/sokoke.h b/midori/sokoke.h index 89e3ba2e..af12b399 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -45,14 +45,6 @@ sokoke_widget_set_visible (GtkWidget* widget, void sokoke_container_show_children (GtkContainer* container); -void -sokoke_widget_set_tooltip_text (GtkWidget* widget, - const gchar* text); - -void -sokoke_tool_item_set_tooltip_text (GtkToolItem* toolitem, - const gchar* text); - void sokoke_widget_popup (GtkWidget* widget, GtkMenu* menu,