diff pidgin/gtkconv.c @ 29307:9c3e0f2e82ea

Show tooltip for ellipsized tab titles. (Some bits changed from the original patch for GTK+ version compatibility) committer: Sadrul Habib Chowdhury <imadil@gmail.com>
author Federico Mena Quintero <federico@novell.com>
date Thu, 28 Jan 2010 19:57:00 +0000
parents 5c2bbeef2eb8
children 06740353bfc7 5f6571bb128d 422889fb57e0
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Thu Jan 28 17:44:28 2010 +0000
+++ b/pidgin/gtkconv.c	Thu Jan 28 19:57:00 2010 +0000
@@ -9508,6 +9508,24 @@
 	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 @@
 	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 */