[empathy: 4/13] tp-call: use the Requested property to check if the call is an incoming one or not



commit eafc9830daea1f750be9b68d7360a8b4b8345e5a
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Jun 21 16:21:34 2010 +0200

    tp-call: use the Requested property to check if the call is an incoming one or not

 libempathy/empathy-tp-call.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index 3aae89f..4c78649 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -61,7 +61,6 @@ enum
   PROP_0,
   PROP_CHANNEL,
   PROP_CONTACT,
-  PROP_IS_INCOMING,
   PROP_STATUS,
   PROP_AUDIO_STREAM,
   PROP_VIDEO_STREAM
@@ -279,9 +278,7 @@ tp_call_got_contact_cb (TpConnection            *connection,
     }
 
   priv->contact = g_object_ref (contact);
-  priv->is_incoming = TRUE;
   priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
-  g_object_notify (G_OBJECT (call), "is-incoming");
   g_object_notify (G_OBJECT (call), "contact");
   g_object_notify (G_OBJECT (call), "status");
 }
@@ -333,9 +330,7 @@ empathy_tp_call_to (EmpathyTpCall *call, EmpathyContact *contact,
   g_assert (audio || video);
 
   priv->contact = g_object_ref (contact);
-  priv->is_incoming = FALSE;
   priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
-  g_object_notify (G_OBJECT (call), "is-incoming");
   g_object_notify (G_OBJECT (call), "contact");
   g_object_notify (G_OBJECT (call), "status");
 
@@ -407,6 +402,8 @@ tp_call_constructor (GType type,
   GObject *object;
   EmpathyTpCall *call;
   EmpathyTpCallPriv *priv;
+  GHashTable *props;
+  gboolean requested;
 
   object = G_OBJECT_CLASS (empathy_tp_call_parent_class)->constructor (type,
       n_construct_params, construct_params);
@@ -430,6 +427,12 @@ tp_call_constructor (GType type,
   tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1,
       tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call));
 
+  /* Is the call incoming? */
+  props = tp_channel_borrow_immutable_properties (priv->channel);
+  requested = tp_asv_get_boolean (props, TP_PROP_CHANNEL_REQUESTED, NULL);
+
+  priv->is_incoming = !requested;
+
   /* Update status when members changes */
   tp_call_update_status (call);
   g_signal_connect_swapped (priv->channel, "group-members-changed",
@@ -513,9 +516,6 @@ tp_call_get_property (GObject *object,
     case PROP_CONTACT:
       g_value_set_object (value, priv->contact);
       break;
-    case PROP_IS_INCOMING:
-      g_value_set_boolean (value, priv->is_incoming);
-      break;
     case PROP_STATUS:
       g_value_set_uint (value, priv->status);
       break;
@@ -553,10 +553,6 @@ empathy_tp_call_class_init (EmpathyTpCallClass *klass)
       g_param_spec_object ("contact", "Call contact", "Call contact",
       EMPATHY_TYPE_CONTACT,
       G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-  g_object_class_install_property (object_class, PROP_IS_INCOMING,
-      g_param_spec_boolean ("is-incoming", "Is media stream incoming",
-      "Is media stream incoming", FALSE, G_PARAM_READABLE |
-      G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
   g_object_class_install_property (object_class, PROP_STATUS,
       g_param_spec_uint ("status", "Call status",
       "Call status", 0, 255, 0, G_PARAM_READABLE | G_PARAM_STATIC_NICK |



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