Move tooltip API from sokoke to compat

This commit is contained in:
Christian Dywan 2008-06-08 19:45:33 +02:00
parent 13f8171e24
commit 0cf86e0ee0
7 changed files with 43 additions and 42 deletions

View file

@ -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
/**

View file

@ -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

View file

@ -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:

View file

@ -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);

View file

@ -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 (

View file

@ -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;

View file

@ -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,