diff pidgin/gtkimhtmltoolbar.c @ 32566:e84bdaa9d227

Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 08 Apr 2009 05:46:20 +0000
parents e23a74d7c97c
children 604bec1b4582
line wrap: on
line diff
--- a/pidgin/gtkimhtmltoolbar.c	Wed Apr 08 01:40:39 2009 +0000
+++ b/pidgin/gtkimhtmltoolbar.c	Wed Apr 08 05:46:20 2009 +0000
@@ -669,7 +669,11 @@
 	g_object_set_data(G_OBJECT(button), "smiley_text", face);
 	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar);
 
+#if GTK_CHECK_VERSION(2,12,0)
+	gtk_widget_set_tooltip_text(button, face);
+#else
 	gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL);
+#endif
 
 	/* these look really weird with borders */
 	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
@@ -683,7 +687,11 @@
 		g_snprintf(tip, sizeof(tip),
 			_("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"),
 			face);
+#if GTK_CHECK_VERSION(2,12,0)
+		gtk_widget_set_tooltip_text(button, tip);
+#else
 		gtk_tooltips_set_tip(toolbar->tooltips, button, tip, NULL);
+#endif
 		gtk_widget_set_sensitive(button, FALSE);
 	} else if (psmiley) {
 		/* Remove the button if the smiley is destroyed */
@@ -1147,7 +1155,9 @@
 	}
 
 	g_free(toolbar->sml);
+#if !GTK_CHECK_VERSION(2,12,0)
 	gtk_object_sink(GTK_OBJECT(toolbar->tooltips));
+#endif
 
 	menu = g_object_get_data(object, "font_menu");
 	if (menu)
@@ -1244,7 +1254,11 @@
 			g_signal_connect(G_OBJECT(button), "clicked",
 					 G_CALLBACK(buttons[iter].callback), toolbar);
 			*(buttons[iter].button) = button;
+#if GTK_CHECK_VERSION(2,12,0)
+			gtk_widget_set_tooltip_text(button, buttons[iter].tooltip);
+#else
 			gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL);
+#endif
 		} else
 			button = gtk_vseparator_new();
 		gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
@@ -1334,7 +1348,9 @@
 	toolbar->smiley_dialog = NULL;
 	toolbar->image_dialog = NULL;
 
+#if !GTK_CHECK_VERSION(2,12,0)
 	toolbar->tooltips = gtk_tooltips_new();
+#endif
 
 	gtk_box_set_spacing(GTK_BOX(toolbar), 3);