[empathy: 7/10] TpChat: add a :self-contact property.



commit 06c82312669b409db53928d6d5fbe21ad3f5569a
Author: Will Thompson <will willthompson co uk>
Date:   Wed Jan 18 16:57:51 2012 +0000

    TpChat: add a :self-contact property.

 libempathy/empathy-tp-chat.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 96eda77..fcef6e8 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -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",



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