[Telepathy-commits] [telepathy-gabble/master] GabbleTubesChannel: add the Requested property

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Aug 19 10:53:56 PDT 2008


20080722163202-53eee-1f2af74c966e695a744d0db238a59fc6bf3f88c8.gz
---
 src/tubes-channel.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/tubes-channel.c b/src/tubes-channel.c
index 4ac4be8..ca71f03 100644
--- a/src/tubes-channel.c
+++ b/src/tubes-channel.c
@@ -88,6 +88,7 @@ enum
   PROP_HANDLE_TYPE,
   PROP_HANDLE,
   PROP_TARGET_ID,
+  PROP_REQUESTED,
   PROP_CONNECTION,
   PROP_INTERFACES,
   PROP_MUC,
@@ -197,6 +198,7 @@ gabble_tubes_channel_get_property (GObject *object,
 {
   GabbleTubesChannel *chan = GABBLE_TUBES_CHANNEL (object);
   GabbleTubesChannelPrivate *priv = GABBLE_TUBES_CHANNEL_GET_PRIVATE (chan);
+  TpBaseConnection *base_conn = (TpBaseConnection *) priv->conn;
 
   switch (property_id)
     {
@@ -215,7 +217,7 @@ gabble_tubes_channel_get_property (GObject *object,
       case PROP_TARGET_ID:
           {
             TpHandleRepoIface *repo = tp_base_connection_get_handles (
-                (TpBaseConnection *) priv->conn, priv->handle_type);
+                base_conn, priv->handle_type);
 
             g_value_set_string (value,
                 tp_handle_inspect (repo, priv->handle));
@@ -250,12 +252,16 @@ gabble_tubes_channel_get_property (GObject *object,
         else
           {
             TpHandleRepoIface *repo = tp_base_connection_get_handles (
-                (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT);
+                base_conn, TP_HANDLE_TYPE_CONTACT);
 
             g_value_set_string (value,
                 tp_handle_inspect (repo, priv->initiator));
           }
         break;
+      case PROP_REQUESTED:
+        g_value_set_boolean (value,
+            (priv->initiator == base_conn->self_handle));
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
         break;
@@ -2431,6 +2437,7 @@ gabble_tubes_channel_class_init (
       { NULL }
   };
   static TpDBusPropertiesMixinPropImpl future_props[] = {
+      { "Requested", "requested", NULL },
       { "TargetID", "target-id", NULL },
       { "InitiatorHandle", "initiator-handle", NULL },
       { "InitiatorID", "initiator-id", NULL },
@@ -2526,6 +2533,13 @@ gabble_tubes_channel_class_init (
   g_object_class_install_property (object_class, PROP_INITIATOR_ID,
       param_spec);
 
+  param_spec = g_param_spec_boolean ("requested", "Requested?",
+      "True if this channel was requested by the local user",
+      FALSE,
+      G_PARAM_READABLE |
+      G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME);
+  g_object_class_install_property (object_class, PROP_REQUESTED, param_spec);
+
   gabble_tubes_channel_class->dbus_props_class.interfaces = prop_interfaces;
   tp_dbus_properties_mixin_class_init (object_class,
       G_STRUCT_OFFSET (GabbleTubesChannelClass, dbus_props_class));
-- 
1.5.6.3




More information about the Telepathy-commits mailing list