empathy r1395 - trunk/libempathy-gtk



Author: xclaesse
Date: Wed Aug 27 13:04:43 2008
New Revision: 1395
URL: http://svn.gnome.org/viewvc/empathy?rev=1395&view=rev

Log:
Keep a ref to the tooltip_widget so it is not recreated all the time.

Modified:
   trunk/libempathy-gtk/empathy-contact-list-view.c

Modified: trunk/libempathy-gtk/empathy-contact-list-view.c
==============================================================================
--- trunk/libempathy-gtk/empathy-contact-list-view.c	(original)
+++ trunk/libempathy-gtk/empathy-contact-list-view.c	Wed Aug 27 13:04:43 2008
@@ -114,6 +114,19 @@
 
 G_DEFINE_TYPE (EmpathyContactListView, empathy_contact_list_view, GTK_TYPE_TREE_VIEW);
 
+static void
+contact_list_view_tooltip_destroy_cb (GtkWidget              *widget,
+				      EmpathyContactListView *view)
+{
+	EmpathyContactListViewPriv *priv = GET_PRIV (view);
+	
+	if (priv->tooltip_widget) {
+		DEBUG ("Tooltip destroyed");
+		g_object_unref (priv->tooltip_widget);
+		priv->tooltip_widget = NULL;
+	}
+}
+
 static gboolean
 contact_list_view_query_tooltip_cb (EmpathyContactListView *view,
 				    gint                    x,
@@ -152,8 +165,10 @@
 	if (!priv->tooltip_widget) {
 		priv->tooltip_widget = empathy_contact_widget_new (contact,
 			EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP);
-		g_object_add_weak_pointer (G_OBJECT (priv->tooltip_widget),
-					   (gpointer) &priv->tooltip_widget);
+		g_object_ref (priv->tooltip_widget);
+		g_signal_connect (priv->tooltip_widget, "destroy",
+				  G_CALLBACK (contact_list_view_tooltip_destroy_cb),
+				  view);
 	} else {
 		empathy_contact_widget_set_contact (priv->tooltip_widget,
 						    contact);
@@ -966,6 +981,9 @@
 	if (priv->store) {
 		g_object_unref (priv->store);
 	}
+	if (priv->tooltip_widget) {
+		g_object_unref (priv->tooltip_widget);
+	}
 
 	G_OBJECT_CLASS (empathy_contact_list_view_parent_class)->finalize (object);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]