cpw.qulogic.gtk3: a59c150c: Replace GtkTooltips code with GtkTooltip...

qulogic at pidgin.im qulogic at pidgin.im
Fri Apr 10 03:35:59 EDT 2009


-----------------------------------------------------------------
Revision: a59c150cbb9987c4d280a53fab7b29132bd23fff
Ancestor: 2f74488ded7cd1eab2d144578340b6d13f570b7a
Author: qulogic at pidgin.im
Date: 2009-04-08T05:46:20
Branch: im.pidgin.cpw.qulogic.gtk3
URL: http://d.pidgin.im/viewmtn/revision/info/a59c150cbb9987c4d280a53fab7b29132bd23fff

Modified files:
        pidgin/gtkblist.c pidgin/gtkconv.c pidgin/gtkconv.h
        pidgin/gtkdocklet-x11.c pidgin/gtkimhtmltoolbar.c
        pidgin/gtkimhtmltoolbar.h pidgin/gtkmenutray.c
        pidgin/gtkmenutray.h

ChangeLog: 

Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.

-------------- next part --------------
============================================================
--- pidgin/gtkblist.c	441e0954ce32a74d88167a0b588ea3202b9b39f1
+++ pidgin/gtkblist.c	a21fca8dbce1553fc92db0b0fe73534d2efea3c2
@@ -5269,6 +5269,9 @@ headline_style_set (GtkWidget *widget,
 headline_style_set (GtkWidget *widget,
 		    GtkStyle  *prev_style)
 {
+#if GTK_CHECK_VERSION(2,12,0)
+	/* TODO: Need to figure out how to do this in 2.12+ */
+#else
 	GtkTooltips *tooltips;
 	GtkStyle *style;
 
@@ -5295,6 +5298,7 @@ headline_style_set (GtkWidget *widget,
 	gtkblist->changing_style = FALSE;
 
 	g_object_unref (tooltips);
+#endif
 }
 
 /******************************************/
============================================================
--- pidgin/gtkconv.c	48ccd8ac1e2c6604ab4967892b4796f7acb6cceb
+++ pidgin/gtkconv.c	be6c13a8a9e0c632d8d6355b12475e97902889ad
@@ -5195,7 +5195,9 @@ private_gtkconv_new(PurpleConversation *
 	gtkconv->send_history = g_list_append(NULL, NULL);
 
 	/* Setup some initial variables. */
+#if !GTK_CHECK_VERSION(2,12,0)
 	gtkconv->tooltips = gtk_tooltips_new();
+#endif
 	gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
 	gtkconv->unseen_count = 0;
 
@@ -5388,7 +5390,9 @@ pidgin_conv_destroy(PurpleConversation *
 		g_free(gtkconv->u.chat);
 	}
 
+#if !GTK_CHECK_VERSION(2,12,0)
 	gtk_object_sink(GTK_OBJECT(gtkconv->tooltips));
+#endif
 
 	gtkconv->send_history = g_list_first(gtkconv->send_history);
 	g_list_foreach(gtkconv->send_history, (GFunc)g_free, NULL);
@@ -6603,8 +6607,13 @@ pidgin_conv_update_fields(PurpleConversa
 			topic = purple_conv_chat_get_topic(chat);
 
 			gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : "");
+#if GTK_CHECK_VERSION(2,12,0)
+			gtk_widget_set_tooltip_text(gtkchat->topic_text,
+			                            topic ? topic : "");
+#else
 			gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text,
 			                     topic ? topic : "", NULL);
+#endif
 		}
 	}
 
@@ -9372,8 +9381,12 @@ pidgin_conv_window_add_gtkconv(PidginWin
 	g_signal_connect(G_OBJECT(gtkconv->close), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_image);
 	gtk_widget_show(close_image);
 	gtk_container_add(GTK_CONTAINER(gtkconv->close), close_image);
+#if GTK_CHECK_VERSION(2,12,0)
+	gtk_widget_set_tooltip_text(gtkconv->close, _("Close conversation"));
+#else
 	gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close,
 	                     _("Close conversation"), NULL);
+#endif
 
 	g_signal_connect(G_OBJECT(gtkconv->close), "button-press-event",
 			 G_CALLBACK(close_conv_cb), gtkconv);
============================================================
--- pidgin/gtkconv.h	87813d273d8cdf6d1def152c675db1fce58301c6
+++ pidgin/gtkconv.h	8d12af9deeca085299b4bb69753094e22ce98a40
@@ -121,7 +121,11 @@ struct _PidginConversation
 
 	gboolean make_sound;
 
+#if GTK_CHECK_VERSION(2,12,0)
+	gpointer depr2;
+#else
 	GtkTooltips *tooltips;
+#endif
 
 	GtkWidget *tab_cont;
 	GtkWidget *tabby;
============================================================
--- pidgin/gtkdocklet-x11.c	71cf10cd25d151fb7c5d87bf3549dd77ec61591b
+++ pidgin/gtkdocklet-x11.c	1952320ab91829d8df3b9797f5f488453b967a7b
@@ -39,7 +39,9 @@ static GtkWidget *image = NULL;
 /* globals */
 static EggTrayIcon *docklet = NULL;
 static GtkWidget *image = NULL;
+#if !GTK_CHECK_VERSION(2,12,0)
 static GtkTooltips *tooltips = NULL;
+#endif
 static GdkPixbuf *blank_icon = NULL;
 static int embed_timeout = 0;
 static int docklet_height = 0;
@@ -164,6 +166,13 @@ docklet_x11_set_tooltip(gchar *tooltip)
 static void
 docklet_x11_set_tooltip(gchar *tooltip)
 {
+#if GTK_CHECK_VERSION(2,12,0)
+	if (tooltip) {
+		gtk_widget_set_tooltip_text(image->parent, tooltip);
+	} else {
+		gtk_widget_set_tooltip_text(image->parent, ""); /* NULL? */
+	}
+#else
 	if (!tooltips)
 		tooltips = gtk_tooltips_new();
 
@@ -175,6 +184,7 @@ docklet_x11_set_tooltip(gchar *tooltip)
 		gtk_tooltips_set_tip(tooltips, image->parent, "", NULL);
 		gtk_tooltips_disable(tooltips);
 	}
+#endif
 }
 
 #if GTK_CHECK_VERSION(2,2,0)
============================================================
--- pidgin/gtkimhtmltoolbar.c	5cb24f071177b208678b5635b0acad2f821ce10f
+++ pidgin/gtkimhtmltoolbar.c	6c76e9600c56e9b691698619869e3326def91a1f
@@ -669,7 +669,11 @@ sort_smileys(struct smiley_button_list *
 	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 @@ sort_smileys(struct smiley_button_list *
 		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 @@ gtk_imhtmltoolbar_finalize (GObject *obj
 	}
 
 	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 @@ static void gtk_imhtmltoolbar_create_old
 			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 @@ static void gtk_imhtmltoolbar_init (GtkI
 	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);
 
============================================================
--- pidgin/gtkimhtmltoolbar.h	24ae7a82d3db734c84694c6e7f259046ee51d88a
+++ pidgin/gtkimhtmltoolbar.h	cb2ba98d2e6b56bef159c25bd0b086adf3a2d7b1
@@ -46,7 +46,11 @@ struct _GtkIMHtmlToolbar {
 
 	GtkWidget *imhtml;
 
+#if GTK_CHECK_VERSION(2,12,0)
+	gpointer depr1;
+#else
 	GtkTooltips *tooltips;
+#endif
 
 	GtkWidget *bold;
 	GtkWidget *italic;
============================================================
--- pidgin/gtkmenutray.c	afc8cd8ee380a02cb91fedced599b2514a9884f9
+++ pidgin/gtkmenutray.c	9458ec707fd2fe2b91efe0772f0f2438c85d3c47
@@ -104,9 +104,11 @@ pidgin_menu_tray_finalize(GObject *obj)
 		gtk_widget_destroy(GTK_WIDGET(tray->tray));
 #endif
 
+#if !GTK_CHECK_VERSION(2,12,0)
 	if (tray->tooltips) {
 		gtk_object_sink(GTK_OBJECT(tray->tooltips));
 	}
+#endif
 
 	G_OBJECT_CLASS(parent_class)->finalize(obj);
 }
@@ -244,13 +246,15 @@ pidgin_menu_tray_set_tooltip(PidginMenuT
 void
 pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const char *tooltip)
 {
+#if !GTK_CHECK_VERSION(2,12,0)
 	if (!menu_tray->tooltips)
 		menu_tray->tooltips = gtk_tooltips_new();
+#endif
 
 	/* Should we check whether widget is a child of menu_tray? */
 
 	/*
-	 * If the widget does not have it's own window, then it
+	 * If the widget does not have its own window, then it
 	 * must have automatically been added to an event box
 	 * when it was added to the menu tray.  If this is the
 	 * case, we want to set the tooltip on the widget's parent,
@@ -259,6 +263,10 @@ pidgin_menu_tray_set_tooltip(PidginMenuT
 	if (GTK_WIDGET_NO_WINDOW(widget))
 		widget = widget->parent;
 
+#if GTK_CHECK_VERSION(2,12,0)
+	gtk_widget_set_tooltip_text(widget, tooltip);
+#else
 	gtk_tooltips_set_tip(menu_tray->tooltips, widget, tooltip, NULL);
+#endif
 }
 
============================================================
--- pidgin/gtkmenutray.h	fc23965ccf2c83d3b29f73197aa61cb13b803028
+++ pidgin/gtkmenutray.h	33f92aaa8e55421da7aad5b20686f4813662cbaa
@@ -40,7 +40,11 @@ struct _PidginMenuTray {
 struct _PidginMenuTray {
 	GtkMenuItem gparent;					/**< The parent instance */
 	GtkWidget *tray;						/**< The tray */
+#if GTK_CHECK_VERSION(2,12,0)
+	gpointer depr1;
+#else
 	GtkTooltips *tooltips;					/**< Tooltips */
+#endif
 };
 
 /** A PidginMenuTrayClass */


More information about the Commits mailing list