[telepathy-gabble/master] Implement Name, Disposition and Creator properties on Call Content objects
Sjoerd Simons
sjoerd.simons at collabora.co.uk
Tue Dec 29 05:35:21 PST 2009
---
src/call-channel.c | 19 +++++++++++++---
src/call-content.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 70 insertions(+), 5 deletions(-)
diff --git a/src/call-channel.c b/src/call-channel.c
index 5f4256a..df9ed1e 100644
--- a/src/call-channel.c
+++ b/src/call-channel.c
@@ -53,7 +53,7 @@ static void async_initable_iface_init (GAsyncInitableIface *iface);
static void call_channel_setup (GabbleCallChannel *self);
static const char *call_channel_add_content (GabbleCallChannel *self,
- GabbleJingleContent *c);
+ GabbleJingleContent *c, GabbleCallContentDisposition disposition);
static void call_session_state_changed_cb (GabbleJingleSession *session,
GParamSpec *param, GabbleCallChannel *self);
@@ -179,7 +179,9 @@ gabble_call_channel_constructed (GObject *obj)
&priv->transport_ns,
NULL);
- call_channel_add_content (self, content);
+ call_channel_add_content (self, content,
+ GABBLE_CALL_CONTENT_DISPOSITION_INITIAL);
+
g_object_get (content, "media-type", &mtype, NULL);
switch (mtype)
{
@@ -654,19 +656,28 @@ call_session_state_changed_cb (GabbleJingleSession *session,
static const gchar *
call_channel_add_content (GabbleCallChannel *self,
- GabbleJingleContent *c)
+ GabbleJingleContent *c,
+ GabbleCallContentDisposition disposition)
{
GabbleCallChannelPrivate *priv = self->priv;
gchar *object_path;
GabbleCallContent *content;
+ TpHandle creator;
object_path = g_strdup_printf ("%s/Content%p", priv->object_path, c);
+ if (gabble_jingle_content_is_created_by_us (c))
+ creator = ((TpBaseConnection *) priv->conn)->self_handle;
+ else
+ creator = priv->session->peer;
+
content = g_object_new (GABBLE_TYPE_CALL_CONTENT,
"connection", priv->conn,
"object-path", object_path,
"jingle-content", c,
"target-handle", priv->target,
+ "disposition", disposition,
+ "creator", creator,
NULL);
g_free (object_path);
@@ -706,7 +717,7 @@ call_channel_create_content (GabbleCallChannel *self,
g_assert (c != NULL);
- return call_channel_add_content (self, c);
+ return call_channel_add_content (self, c, disposition);
}
diff --git a/src/call-content.c b/src/call-content.c
index a80e538..115c66e 100644
--- a/src/call-content.c
+++ b/src/call-content.c
@@ -69,6 +69,10 @@ enum
PROP_JINGLE_CONTENT,
PROP_TARGET_HANDLE,
+ PROP_NAME,
+ PROP_CREATOR,
+ PROP_DISPOSITION,
+
PROP_CONTACT_CODEC_MAP,
PROP_MEDIA_TYPE,
PROP_STREAMS,
@@ -87,6 +91,10 @@ struct _GabbleCallContentPrivate
GabbleCallContentCodecoffer *offer;
gint offers;
+ gchar *name;
+ GabbleCallContentDisposition disposition;
+ TpHandle creator;
+
GList *streams;
gboolean dispose_has_run;
};
@@ -159,6 +167,22 @@ gabble_call_content_get_property (GObject *object,
g_ptr_array_free (arr, TRUE);
break;
}
+ case PROP_NAME:
+ {
+ gchar *name;
+ g_object_get (priv->content, "name", &name, NULL);
+ if (name != NULL)
+ g_value_take_string (value, name);
+ else
+ g_value_set_static_string (value, "");
+ break;
+ }
+ case PROP_CREATOR:
+ g_value_set_uint (value, priv->creator);
+ break;
+ case PROP_DISPOSITION:
+ g_value_set_uint (value, priv->disposition);
+ break;
case PROP_CONTACT_CODEC_MAP:
{
GHashTable *map;
@@ -227,6 +251,12 @@ gabble_call_content_set_property (GObject *object,
case PROP_CONNECTION:
priv->conn = g_value_get_object (value);
break;
+ case PROP_CREATOR:
+ priv->creator = g_value_get_uint (value);
+ break;
+ case PROP_DISPOSITION:
+ priv->disposition = g_value_get_uint (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -281,7 +311,10 @@ gabble_call_content_class_init (
GObjectClass *object_class = G_OBJECT_CLASS (gabble_call_content_class);
GParamSpec *param_spec;
static TpDBusPropertiesMixinPropImpl content_props[] = {
+ { "Name", "name", NULL },
{ "Type", "media-type", NULL },
+ { "Creator", "creator", NULL },
+ { "Disposition", "disposition", NULL },
{ "Streams", "streams", NULL },
{ NULL }
};
@@ -343,13 +376,33 @@ gabble_call_content_class_init (
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
+ param_spec = g_param_spec_string ("name", "Name",
+ "The name of this content if any",
+ "",
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_NAME, param_spec);
+
param_spec = g_param_spec_uint ("media-type", "Media Type",
- "The media type of this channel",
+ "The media type of this content",
0, G_MAXUINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_MEDIA_TYPE,
param_spec);
+ param_spec = g_param_spec_uint ("creator", "Creator",
+ "The creator content",
+ 0, G_MAXUINT, 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_CREATOR,
+ param_spec);
+
+ param_spec = g_param_spec_uint ("disposition", "Disposition",
+ "The disposition of this content",
+ 0, G_MAXUINT, 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_DISPOSITION,
+ param_spec);
+
param_spec = g_param_spec_boxed ("streams", "Stream",
"The streams of this content",
TP_ARRAY_TYPE_OBJECT_PATH_LIST,
@@ -403,6 +456,7 @@ gabble_call_content_finalize (GObject *object)
/* free any data held directly by the object here */
g_free (priv->object_path);
+ g_free (priv->name);
G_OBJECT_CLASS (gabble_call_content_parent_class)->finalize (object);
}
--
1.5.6.5
More information about the telepathy-commits
mailing list