[Telepathy-commits] [telepathy-mission-control/master] Add _mcd_channel_create_proxy()
Alberto Mardegan
alberto.mardegan at nokia.com
Mon Feb 2 00:00:14 PST 2009
mcd_channel_set_object_path will eventually disappear.
---
src/mcd-channel.c | 31 +++++++++++++++++++++++++++++++
src/mcd-channel.h | 5 +++++
src/mcd-connection.c | 8 ++++----
3 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/src/mcd-channel.c b/src/mcd-channel.c
index 9f8ed2c..3bf0332 100644
--- a/src/mcd-channel.c
+++ b/src/mcd-channel.c
@@ -926,6 +926,37 @@ mcd_channel_set_object_path (McdChannel *channel, TpConnection *connection,
return FALSE;
}
+/**
+ * mcd_channel_create_proxy:
+ * @channel: the #McdChannel.
+ * @connection: the #TpConnection on which the channel exists.
+ * @object_path: the D-Bus object path of an existing channel.
+ * @properties: #GHashTable of immutable channel properties, or %NULL.
+ *
+ * This method makes @channel create a #TpChannel object for @object_path.
+ * It must not be called if @channel has already a #TpChannel associated with
+ * it.
+ *
+ * Returns: %TRUE if the #TpChannel has been created, %FALSE otherwise.
+ */
+gboolean
+_mcd_channel_create_proxy (McdChannel *channel, TpConnection *connection,
+ const gchar *object_path,
+ const GHashTable *properties)
+{
+ if (mcd_channel_set_object_path (channel, connection, object_path))
+ {
+ if (properties)
+ _mcd_channel_set_immutable_properties
+ (channel,
+ g_boxed_copy (TP_HASH_TYPE_QUALIFIED_PROPERTY_VALUE_MAP,
+ properties));
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
void
mcd_channel_set_status (McdChannel *channel, McdChannelStatus status)
{
diff --git a/src/mcd-channel.h b/src/mcd-channel.h
index 5f3dbc1..6869be0 100644
--- a/src/mcd-channel.h
+++ b/src/mcd-channel.h
@@ -110,6 +110,11 @@ McdChannel *mcd_channel_new_request (GHashTable *properties,
gboolean mcd_channel_set_object_path (McdChannel *channel,
TpConnection *connection,
const gchar *object_path);
+G_GNUC_INTERNAL
+gboolean _mcd_channel_create_proxy (McdChannel *channel,
+ TpConnection *connection,
+ const gchar *object_path,
+ const GHashTable *properties);
void mcd_channel_set_status (McdChannel *channel, McdChannelStatus status);
McdChannelStatus mcd_channel_get_status (McdChannel * channel);
diff --git a/src/mcd-connection.c b/src/mcd-connection.c
index a49b797..6d1f03a 100644
--- a/src/mcd-connection.c
+++ b/src/mcd-connection.c
@@ -2067,7 +2067,8 @@ request_channel_cb (TpConnection *proxy, const gchar *channel_path,
/* TODO: construct the a{sv} of immutable properties */
/* Everything here is well and fine. We can create the channel proxy. */
- if (!mcd_channel_set_object_path (channel, priv->tp_conn, channel_path))
+ if (!_mcd_channel_create_proxy (channel, priv->tp_conn,
+ channel_path, NULL))
{
mcd_mission_abort ((McdMission *)channel);
return;
@@ -2196,10 +2197,9 @@ common_request_channel_cb (TpConnection *proxy, gboolean yours,
}
}
- _mcd_channel_set_immutable_properties (channel,
- _mcd_deepcopy_asv (properties));
/* Everything here is well and fine. We can create the channel. */
- if (!mcd_channel_set_object_path (channel, priv->tp_conn, channel_path))
+ if (!_mcd_channel_create_proxy (channel, priv->tp_conn,
+ channel_path, properties))
{
mcd_mission_abort ((McdMission *)channel);
return;
--
1.5.6.5
More information about the Telepathy-commits
mailing list