changeset 32465:783ac40a7408

Add some GTK+3 compatible updates.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 05 Jan 2012 09:50:46 +0000
parents 8ffa03e3b0a2
children 759eade309a7
files pidgin/gtkwebviewtoolbar.c
diffstat 1 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkwebviewtoolbar.c	Thu Jan 05 09:40:32 2012 +0000
+++ b/pidgin/gtkwebviewtoolbar.c	Thu Jan 05 09:50:46 2012 +0000
@@ -43,6 +43,15 @@
 
 #include <gdk/gdkkeysyms.h>
 
+#if !GTK_CHECK_VERSION(2,18,0)
+#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE((x))
+#define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE((x))
+#if !GTK_CHECK_VERSION(2,12,0)
+#define gtk_widget_set_tooltip_text(w, t) \
+	gtk_tooltips_set_tip(priv->tooltips, (w), (t), NULL)
+#endif
+#endif
+
 #define GTK_WEBVIEWTOOLBAR_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbarPriv))
 
@@ -56,7 +65,9 @@
 	GtkWidget *wide_view;
 	GtkWidget *lean_view;
 
+#if !GTK_CHECK_VERSION(2,12,0)
 	GtkTooltips *tooltips;
+#endif
 
 	GtkWidget *font_label;
 	GtkWidget *font_menu;
@@ -769,7 +780,7 @@
 	g_object_set_data(G_OBJECT(button), "smiley_text", face);
 	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar);
 
-	gtk_tooltips_set_tip(priv->tooltips, button, face, NULL);
+	gtk_widget_set_tooltip_text(button, face);
 
 	/* these look really weird with borders */
 	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
@@ -783,7 +794,7 @@
 		g_snprintf(tip, sizeof(tip),
 			_("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"),
 			face);
-		gtk_tooltips_set_tip(priv->tooltips, button, tip, NULL);
+		gtk_widget_set_tooltip_text(button, tip);
 		gtk_widget_set_sensitive(button, FALSE);
 	} else if (psmiley) {
 		/* Remove the button if the smiley is destroyed */
@@ -1266,7 +1277,7 @@
 	if (event->button != 3)
 		return FALSE;
 
-	wide = GTK_WIDGET_VISIBLE(priv->bold);
+	wide = gtk_widget_get_visible(priv->bold);
 
 	menu = gtk_menu_new();
 	item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items"));
@@ -1282,7 +1293,7 @@
 static void
 button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item)
 {
-	if (GTK_WIDGET_VISIBLE(button))
+	if (gtk_widget_get_visible(button))
 		gtk_widget_hide(item);
 	else
 		gtk_widget_show(item);
@@ -1291,7 +1302,7 @@
 static void
 button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item)
 {
-	gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button));
+	gtk_widget_set_sensitive(item, gtk_widget_is_sensitive(button));
 }
 
 static void
@@ -1361,7 +1372,10 @@
 	}
 
 	g_free(priv->sml);
+
+#if !GTK_CHECK_VERSION(2,12,0)
 	gtk_object_sink(GTK_OBJECT(priv->tooltips));
+#endif
 
 	if (priv->font_menu)
 		gtk_widget_destroy(priv->font_menu);
@@ -1431,7 +1445,7 @@
 			g_signal_connect(G_OBJECT(button), "clicked",
 					 G_CALLBACK(buttons[iter].callback), toolbar);
 			*(buttons[iter].button) = button;
-			gtk_tooltips_set_tip(priv->tooltips, button, buttons[iter].tooltip, NULL);
+			gtk_widget_set_tooltip_text(button, buttons[iter].tooltip);
 		} else
 			button = gtk_vseparator_new();
 		gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
@@ -1490,7 +1504,9 @@
 	priv->smiley_dialog = NULL;
 	priv->image_dialog = NULL;
 
+#if !GTK_CHECK_VERSION(2,12,0)
 	priv->tooltips = gtk_tooltips_new();
+#endif
 
 	gtk_box_set_spacing(GTK_BOX(toolbar), 3);