summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-04 18:33:12 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-07 16:16:07 +0100
commit61fa4f25d4934ffb077d70e39aaf5b175615efde (patch)
treea2aeb16d101849d2aa75a0975eb5a6f5ddcb0836
parente71b11a7f3535f7faad184cefd739ccbcb10ae58 (diff)
TpChannel: stop implementing TpChannelIface, and make those properties read-only
Implementing TpChannelIface meant that channel-type, handle-type and handle had to be settable at construct-time. That is no longer a supported thing to do: everyone should be using the immutable properties dict.
-rw-r--r--telepathy-glib/call-channel.c1
-rw-r--r--telepathy-glib/channel.c72
-rw-r--r--telepathy-glib/dbus-tube-channel.c1
-rw-r--r--telepathy-glib/file-transfer-channel.c1
-rw-r--r--telepathy-glib/stream-tube-channel.c1
-rw-r--r--telepathy-glib/text-channel.c1
-rw-r--r--telepathy-logger/call-channel.c1
-rw-r--r--telepathy-logger/text-channel.c1
8 files changed, 42 insertions, 37 deletions
diff --git a/telepathy-glib/call-channel.c b/telepathy-glib/call-channel.c
index 2e922440f..e607fb1aa 100644
--- a/telepathy-glib/call-channel.c
+++ b/telepathy-glib/call-channel.c
@@ -1164,7 +1164,6 @@ _tp_call_channel_new (TpClientFactory *factory,
"connection", conn,
"bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
- "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
"factory", factory,
NULL);
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c
index ffaca6a86..2ad2689f9 100644
--- a/telepathy-glib/channel.c
+++ b/telepathy-glib/channel.c
@@ -114,10 +114,7 @@ enum {
static guint signals[N_SIGNALS] = { 0 };
-G_DEFINE_TYPE_WITH_CODE (TpChannel,
- tp_channel,
- TP_TYPE_PROXY,
- G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_IFACE, NULL))
+G_DEFINE_TYPE (TpChannel, tp_channel, TP_TYPE_PROXY)
/**
* TP_CHANNEL_FEATURE_CORE:
@@ -537,20 +534,6 @@ tp_channel_set_property (GObject *object,
self->priv->connection = TP_CONNECTION (g_value_dup_object (value));
break;
- case PROP_CHANNEL_TYPE:
- _tp_channel_maybe_set_channel_type (self, g_value_get_string (value));
- break;
-
- case PROP_HANDLE_TYPE:
- _tp_channel_maybe_set_handle_type (self, g_value_get_uint (value),
- (g_value_get_uint (value) != TP_UNKNOWN_HANDLE_TYPE));
- break;
-
- case PROP_HANDLE:
- _tp_channel_maybe_set_handle (self, g_value_get_uint (value),
- (g_value_get_uint (value) != 0));
- break;
-
case PROP_CHANNEL_PROPERTIES:
{
GHashTable *asv = g_value_get_boxed (value);
@@ -1154,12 +1137,47 @@ tp_channel_class_init (TpChannelClass *klass)
proxy_class->must_have_unique_name = TRUE;
proxy_class->list_features = tp_channel_list_features;
- g_object_class_override_property (object_class, PROP_CHANNEL_TYPE,
- "channel-type");
- g_object_class_override_property (object_class, PROP_HANDLE_TYPE,
- "handle-type");
- g_object_class_override_property (object_class, PROP_HANDLE,
- "handle");
+ /**
+ * TpChannel:channel-type:
+ *
+ * The D-Bus interface representing the type of this channel.
+ * This is not guaranteed to be available until tp_proxy_prepare_async()
+ * has finished preparing %TP_CHANNEL_FEATURE_CORE; it may be %NULL
+ * until then.
+ */
+ param_spec = g_param_spec_string ("channel-type", "Telepathy channel type",
+ "The D-Bus interface representing the type of this channel.",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_CHANNEL_TYPE, param_spec);
+
+ /**
+ * TpChannel:handle-type:
+ *
+ * The #TpEntityType of this channel's associated handle, or
+ * %TP_ENTITY_TYPE_NONE (which is numerically 0) if no handle,
+ * or %TP_UNKNOWN_HANDLE_TYPE if this property is not available yet.
+ * This is not guaranteed to be available until tp_proxy_prepare_async()
+ * has finished preparing %TP_CHANNEL_FEATURE_CORE.
+ */
+ param_spec = g_param_spec_uint ("handle-type", "Telepathy entity type",
+ "The TpEntityType of this channel's associated handle",
+ 0, G_MAXUINT32, TP_UNKNOWN_HANDLE_TYPE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_HANDLE_TYPE, param_spec);
+
+ /**
+ * TpChannel:handle:
+ *
+ * This channel's associated handle, or 0 if no handle or unknown.
+ * This is not guaranteed to be known until tp_proxy_prepare_async()
+ * has finished preparing %TP_CHANNEL_FEATURE_CORE.
+ */
+ param_spec = g_param_spec_uint ("handle", "Handle",
+ "The TpHandle representing the contact, chatroom, etc. with which "
+ "this channel communicates",
+ 0, G_MAXUINT32, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_HANDLE, param_spec);
/**
* TpChannel:identifier:
@@ -1434,16 +1452,10 @@ _tp_channel_new (TpClientFactory *factory,
if (!tp_dbus_check_valid_object_path (object_path, error))
goto finally;
- /* An unfortunate collision between the default value in
- * TpChannelIface (0), and the default we want (-1), means that
- * we have to pass TP_UNKNOWN_HANDLE_TYPE to the constructor
- * explicitly, even if providing channel-properties. */
-
ret = TP_CHANNEL (g_object_new (TP_TYPE_CHANNEL,
"connection", conn,
"bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
- "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
"factory", factory,
NULL));
diff --git a/telepathy-glib/dbus-tube-channel.c b/telepathy-glib/dbus-tube-channel.c
index 1b7f90b05..ca89327ad 100644
--- a/telepathy-glib/dbus-tube-channel.c
+++ b/telepathy-glib/dbus-tube-channel.c
@@ -471,7 +471,6 @@ _tp_dbus_tube_channel_new (TpClientFactory *factory,
"connection", conn,
"bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
- "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
"factory", factory,
NULL);
diff --git a/telepathy-glib/file-transfer-channel.c b/telepathy-glib/file-transfer-channel.c
index 49b779b10..20b109f9b 100644
--- a/telepathy-glib/file-transfer-channel.c
+++ b/telepathy-glib/file-transfer-channel.c
@@ -1058,7 +1058,6 @@ _tp_file_transfer_channel_new (TpClientFactory *factory,
"connection", conn,
"bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
- "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
"factory", factory,
NULL);
diff --git a/telepathy-glib/stream-tube-channel.c b/telepathy-glib/stream-tube-channel.c
index cd36699b1..99a712241 100644
--- a/telepathy-glib/stream-tube-channel.c
+++ b/telepathy-glib/stream-tube-channel.c
@@ -508,7 +508,6 @@ _tp_stream_tube_channel_new (TpClientFactory *factory,
"connection", conn,
"bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
- "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
"factory", factory,
NULL);
diff --git a/telepathy-glib/text-channel.c b/telepathy-glib/text-channel.c
index daf9ac4a7..bf571ad58 100644
--- a/telepathy-glib/text-channel.c
+++ b/telepathy-glib/text-channel.c
@@ -1127,7 +1127,6 @@ _tp_text_channel_new (TpClientFactory *factory,
"connection", conn,
"bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
- "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
"factory", factory,
NULL);
diff --git a/telepathy-logger/call-channel.c b/telepathy-logger/call-channel.c
index 42d003b14..c9796e8db 100644
--- a/telepathy-logger/call-channel.c
+++ b/telepathy-logger/call-channel.c
@@ -462,7 +462,6 @@ _tpl_call_channel_new (TpClientFactory *factory,
"connection", conn,
"bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
- "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", tp_chan_props,
NULL);
diff --git a/telepathy-logger/text-channel.c b/telepathy-logger/text-channel.c
index a067f6713..ea67a61ca 100644
--- a/telepathy-logger/text-channel.c
+++ b/telepathy-logger/text-channel.c
@@ -735,7 +735,6 @@ _tpl_text_channel_new (TpClientFactory *factory,
"connection", conn,
"bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
- "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", tp_chan_props,
NULL);