[Telepathy-commits] [telepathy-mission-control/master] Use new TP API
Alberto Mardegan
alberto.mardegan at nokia.com
Mon Feb 2 00:00:14 PST 2009
Implement mcd_channel_new_from_properties() by using
tp_channel_new_from_properties().
---
configure.ac | 2 +-
src/mcd-channel.c | 41 ++++++++++++++---------------------------
2 files changed, 15 insertions(+), 28 deletions(-)
diff --git a/configure.ac b/configure.ac
index aecfbca..be59d84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -204,7 +204,7 @@ PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.51, dbus-glib-1 >= 0.51], have_dbus=yes, ha
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
-PKG_CHECK_MODULES(TELEPATHY, telepathy-glib >= 0.7.18)
+PKG_CHECK_MODULES(TELEPATHY, telepathy-glib >= 0.7.19)
AC_SUBST(TELEPATHY_LIBS)
AC_SUBST(TELEPATHY_CFLAGS)
diff --git a/src/mcd-channel.c b/src/mcd-channel.c
index cc93220..ed37eb6 100644
--- a/src/mcd-channel.c
+++ b/src/mcd-channel.c
@@ -676,7 +676,7 @@ mcd_channel_class_init (McdChannelClass * klass)
"Telepathy Channel",
"Telepathy Channel",
TP_TYPE_CHANNEL,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property
(object_class, PROP_CHANNEL_STATUS,
g_param_spec_enum ("channel-status",
@@ -816,37 +816,24 @@ mcd_channel_new_from_properties (TpConnection *connection,
const GHashTable *properties)
{
McdChannel *channel;
- const gchar *type;
- guint handle_type, handle;
-
- type = tp_asv_get_string (properties, TP_IFACE_CHANNEL ".ChannelType");
+ TpChannel *tp_chan;
+ GError *error = NULL;
- handle_type = tp_asv_get_uint32 (properties,
- TP_IFACE_CHANNEL ".TargetHandleType",
- NULL);
- handle = tp_asv_get_uint32 (properties,
- TP_IFACE_CHANNEL ".TargetHandle", NULL);
- g_debug ("%s: type = %s, handle_type = %u, handle = %u", G_STRFUNC,
- type, handle_type, handle);
- channel = g_object_new (MCD_TYPE_CHANNEL,
- "type", type,
- "handle", handle,
- "handle-type", handle_type,
- NULL);
- if (mcd_channel_set_object_path (channel, connection, object_path))
+ tp_chan = tp_channel_new_from_properties (connection, object_path,
+ properties, &error);
+ if (G_UNLIKELY (error))
{
- _mcd_channel_set_immutable_properties
- (channel,
- g_boxed_copy (TP_HASH_TYPE_QUALIFIED_PROPERTY_VALUE_MAP,
- properties));
- return channel;
- }
- else
- {
- g_object_unref (channel);
+ g_warning ("%s: got error: %s", G_STRFUNC, error->message);
+ g_error_free (error);
return NULL;
}
+
+ channel = g_object_new (MCD_TYPE_CHANNEL,
+ "tp-channel", tp_chan,
+ NULL);
+ g_object_unref (tp_chan);
+ return channel;
}
/**
--
1.5.6.5
More information about the Telepathy-commits
mailing list