# HG changeset patch # User Elliott Sales de Andrade # Date 1239169580 0 # Node ID e84bdaa9d227320ab7a1b281606ef1c6024a8f06 # Parent 865ed80b17e131df0c82b3768e7457bc2a745e65 Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+. diff -r 865ed80b17e1 -r e84bdaa9d227 pidgin/gtkblist.c --- a/pidgin/gtkblist.c Wed Apr 08 01:40:39 2009 +0000 +++ b/pidgin/gtkblist.c Wed Apr 08 05:46:20 2009 +0000 @@ -5269,6 +5269,9 @@ 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 @@ gtkblist->changing_style = FALSE; g_object_unref (tooltips); +#endif } /******************************************/ diff -r 865ed80b17e1 -r e84bdaa9d227 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Wed Apr 08 01:40:39 2009 +0000 +++ b/pidgin/gtkconv.c Wed Apr 08 05:46:20 2009 +0000 @@ -5195,7 +5195,9 @@ 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 @@ 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 @@ 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 @@ 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); diff -r 865ed80b17e1 -r e84bdaa9d227 pidgin/gtkconv.h --- a/pidgin/gtkconv.h Wed Apr 08 01:40:39 2009 +0000 +++ b/pidgin/gtkconv.h Wed Apr 08 05:46:20 2009 +0000 @@ -121,7 +121,11 @@ gboolean make_sound; +#if GTK_CHECK_VERSION(2,12,0) + gpointer depr2; +#else GtkTooltips *tooltips; +#endif GtkWidget *tab_cont; GtkWidget *tabby; diff -r 865ed80b17e1 -r e84bdaa9d227 pidgin/gtkdocklet-x11.c --- a/pidgin/gtkdocklet-x11.c Wed Apr 08 01:40:39 2009 +0000 +++ b/pidgin/gtkdocklet-x11.c Wed Apr 08 05:46:20 2009 +0000 @@ -39,7 +39,9 @@ /* 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 @@ 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 @@ gtk_tooltips_set_tip(tooltips, image->parent, "", NULL); gtk_tooltips_disable(tooltips); } +#endif } #if GTK_CHECK_VERSION(2,2,0) diff -r 865ed80b17e1 -r e84bdaa9d227 pidgin/gtkimhtmltoolbar.c --- 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); diff -r 865ed80b17e1 -r e84bdaa9d227 pidgin/gtkimhtmltoolbar.h --- a/pidgin/gtkimhtmltoolbar.h Wed Apr 08 01:40:39 2009 +0000 +++ b/pidgin/gtkimhtmltoolbar.h Wed Apr 08 05:46:20 2009 +0000 @@ -46,7 +46,11 @@ GtkWidget *imhtml; +#if GTK_CHECK_VERSION(2,12,0) + gpointer depr1; +#else GtkTooltips *tooltips; +#endif GtkWidget *bold; GtkWidget *italic; diff -r 865ed80b17e1 -r e84bdaa9d227 pidgin/gtkmenutray.c --- a/pidgin/gtkmenutray.c Wed Apr 08 01:40:39 2009 +0000 +++ b/pidgin/gtkmenutray.c Wed Apr 08 05:46:20 2009 +0000 @@ -104,9 +104,11 @@ 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 @@ 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 @@ 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 } diff -r 865ed80b17e1 -r e84bdaa9d227 pidgin/gtkmenutray.h --- a/pidgin/gtkmenutray.h Wed Apr 08 01:40:39 2009 +0000 +++ b/pidgin/gtkmenutray.h Wed Apr 08 05:46:20 2009 +0000 @@ -40,7 +40,11 @@ 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 */