pidgin: 94f37ea0: Show tooltip for ellipsized tab titles.

sadrul at pidgin.im sadrul at pidgin.im
Thu Jan 28 20:44:45 EST 2010


-----------------------------------------------------------------
Revision: 94f37ea0c09905f4121d63eff0dc9b4bd91d98bf
Ancestor: 501e5b77fa18b2d5241ecdd978f2d87382de8f28
Author: Federico Mena Quintero <federico at novell.com>
Date: 2010-01-28T19:57:00
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/94f37ea0c09905f4121d63eff0dc9b4bd91d98bf

Modified files:
        pidgin/gtkconv.c

ChangeLog: 

Show tooltip for ellipsized tab titles.

(Some bits changed from the original patch for GTK+ version
 compatibility)

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	96f43914d1afcbabc9bae69cc31c3dcc1010f374
+++ pidgin/gtkconv.c	38f2b96cab4ed67da3f9e2254b300a217a3f8316
@@ -9508,6 +9508,24 @@ close_button_entered_cb(GtkWidget *widge
 	return FALSE;
 }
 
+static gboolean
+gtkconv_tab_set_tip(GtkWidget *widget, GdkEventCrossing *event, PidginConversation *gtkconv)
+{
+#if GTK_CHECK_VERSION(2, 12, 0)
+#define gtk_tooltips_set_tip(tips, w, l, p)  gtk_widget_set_tooltip_text(w, l)
+#endif
+	PangoLayout *layout;
+
+	layout = gtk_label_get_layout(GTK_LABEL(gtkconv->tab_label));
+	gtk_tooltips_set_tip(gtkconv->tooltips, widget,
+			pango_layout_is_ellipsized(layout) ? gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)) : NULL,
+			NULL);
+	return FALSE;
+#if GTK_CHECK_VERSION(2, 12, 0)
+#undef gtk_tooltips_set_tip
+#endif
+}
+
 void
 pidgin_conv_window_add_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
 {
@@ -9666,6 +9684,8 @@ pidgin_conv_tab_pack(PidginWindow *win, 
 	gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE);
 #endif
 	gtk_container_add(GTK_CONTAINER(ebox), gtkconv->tabby);
+	g_signal_connect(G_OBJECT(ebox), "enter-notify-event",
+			G_CALLBACK(gtkconv_tab_set_tip), gtkconv);
 
 	if (gtkconv->tab_label->parent == NULL) {
 		/* Pack if it's a new widget */


More information about the Commits mailing list