From a11d2a44aea653b4ad25e6e67b88dbbdbec764ad Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Wed, 15 Dec 2010 15:01:50 +0000 Subject: Allow ContactView to be reused for different libfolks Individuals --- liszt/contact-view.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/liszt/contact-view.c b/liszt/contact-view.c index a0521696c..95dde0d23 100644 --- a/liszt/contact-view.c +++ b/liszt/contact-view.c @@ -28,6 +28,7 @@ enum struct _LolContactViewPrivate { FolksIndividual *individual; + gulong individual_signal_handler; ClutterActor *presence_texture; ClutterActor *name_text; @@ -121,13 +122,17 @@ lol_contact_view_set_avatar (LolContactView *self, gchar *tmp; if (file == NULL) - return; + { + clutter_actor_hide (priv->avatar_texture); + return; + } tmp = g_file_get_path (file); clutter_texture_set_from_file ( CLUTTER_TEXTURE (priv->avatar_texture), tmp, NULL); + clutter_actor_show (priv->avatar_texture); g_free (tmp); } @@ -277,13 +282,16 @@ lol_contact_view_set_property (GObject *object, { case PROP_INDIVIDUAL: { - if (priv->individual == NULL) + if (priv->individual != NULL) { - priv->individual = g_value_dup_object (value); - lol_contact_view_update_individual (self); - g_signal_connect (priv->individual, "notify", - G_CALLBACK (individual_notify_cb), self); + g_signal_handler_disconnect (priv->individual, + priv->individual_signal_handler); + g_object_unref (priv->individual); } + priv->individual = g_value_dup_object (value); + lol_contact_view_update_individual (self); + priv->individual_signal_handler = g_signal_connect (priv->individual, + "notify", G_CALLBACK (individual_notify_cb), self); } break; default: @@ -488,6 +496,8 @@ lol_contact_view_dispose (GObject *obj) if (self->priv->individual != NULL) { + g_signal_handler_disconnect (self->priv->individual, + self->priv->individual_signal_handler); g_object_unref (self->priv->individual); self->priv->individual = NULL; } -- cgit v1.2.3