]> git.0d.be Git - empathy.git/commitdiff
TpChat: add a :self-contact property.
authorWill Thompson <will@willthompson.co.uk>
Wed, 18 Jan 2012 16:57:51 +0000 (16:57 +0000)
committerWill Thompson <will@willthompson.co.uk>
Wed, 18 Jan 2012 17:55:09 +0000 (17:55 +0000)
libempathy/empathy-tp-chat.c

index 96eda77b847abeae591081cffd5574afd4bf5c18..fcef6e8a76412f395c474d0d1ac60468fee8fa87 100644 (file)
@@ -69,6 +69,7 @@ static void tp_chat_iface_init         (EmpathyContactListIface *iface);
 enum {
        PROP_0,
        PROP_ACCOUNT,
+       PROP_SELF_CONTACT,
        PROP_REMOTE_CONTACT,
        PROP_N_MESSAGES_SENDING,
        PROP_TITLE,
@@ -948,6 +949,7 @@ tp_chat_got_renamed_contacts_cb (TpConnection            *connection,
                /* We change our nick */
                tp_clear_object (&self->priv->user);
                self->priv->user = g_object_ref (new);
+               g_object_notify (chat, "self-contact");
        }
 
        check_almost_ready (self);
@@ -1068,6 +1070,7 @@ tp_chat_got_self_contact_cb (TpConnection            *connection,
 
        self->priv->user = g_object_ref (contact);
        empathy_contact_set_is_user (self->priv->user, TRUE);
+       g_object_notify (chat, "self-contact");
        check_almost_ready (self);
 }
 
@@ -1083,6 +1086,9 @@ tp_chat_get_property (GObject    *object,
        case PROP_ACCOUNT:
                g_value_set_object (value, self->priv->account);
                break;
+       case PROP_SELF_CONTACT:
+               g_value_set_object (value, self->priv->user);
+               break;
        case PROP_REMOTE_CONTACT:
                g_value_set_object (value, self->priv->remote_contact);
                break;
@@ -1171,6 +1177,19 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
                                                              G_PARAM_CONSTRUCT_ONLY |
                                                              G_PARAM_STATIC_STRINGS));
 
+       /**
+        * EmpathyTpChat:self-contact:
+        *
+        * Not to be confused with TpChannel:group-self-contact.
+        */
+       g_object_class_install_property (object_class,
+                                        PROP_SELF_CONTACT,
+                                        g_param_spec_object ("self-contact",
+                                                             "The local contact",
+                                                             "The EmpathyContact for the local user on this channel",
+                                                             EMPATHY_TYPE_CONTACT,
+                                                             G_PARAM_READABLE));
+
        g_object_class_install_property (object_class,
                                         PROP_REMOTE_CONTACT,
                                         g_param_spec_object ("remote-contact",