[next] telepathy-glib: TpChannel: stop implementing TpChannelIface, and make those properties read-only

Simon McVittie smcv at kemper.freedesktop.org
Tue Apr 8 12:11:44 PDT 2014


Module: telepathy-glib
Branch: next
Commit: 5838154d973474bf0628e08d7d7767e9fafe061e
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=5838154d973474bf0628e08d7d7767e9fafe061e

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Apr  4 18:33:12 2014 +0100

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.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77139
Reviewed-by: Xavier Claessens

---

 telepathy-glib/call-channel.c          |    1 -
 telepathy-glib/channel.c               |   72 +++++++++++++++++++-------------
 telepathy-glib/dbus-tube-channel.c     |    1 -
 telepathy-glib/file-transfer-channel.c |    1 -
 telepathy-glib/stream-tube-channel.c   |    1 -
 telepathy-glib/text-channel.c          |    1 -
 telepathy-logger/call-channel.c        |    1 -
 telepathy-logger/text-channel.c        |    1 -
 8 files changed, 42 insertions(+), 37 deletions(-)

diff --git a/telepathy-glib/call-channel.c b/telepathy-glib/call-channel.c
index 2e92244..e607fb1 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 ffaca6a..2ad2689 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 1b7f90b..ca89327 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 49b779b..20b109f 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 cd36699..99a7122 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 daf9ac4..bf571ad 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 42d003b..c9796e8 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 a067f67..ea67a61 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);
 



More information about the telepathy-commits mailing list