[next] telepathy-glib: tp_proxy_get_interface_by_id: remove

Simon McVittie smcv at kemper.freedesktop.org
Thu Mar 27 12:59:54 PDT 2014


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

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Wed Mar 26 18:32:59 2014 +0000

tp_proxy_get_interface_by_id: remove

---

 .../telepathy-glib/telepathy-glib-sections.txt     |    1 -
 telepathy-glib/proxy-subclass.h                    |    3 -
 telepathy-glib/proxy.c                             |   73 ++------------------
 telepathy-glib/versions/main-1.0.abi               |    1 -
 tests/dbus/get-interface-after-invalidate.c        |    6 +-
 5 files changed, 10 insertions(+), 74 deletions(-)

diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
index dd7c6ae..04c1064 100644
--- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
@@ -2999,7 +2999,6 @@ tp_cli_generic_add_signals
 <INCLUDE>telepathy-glib/proxy-subclass.h</INCLUDE>
 tp_proxy_add_interface_by_id
 tp_proxy_add_interfaces
-tp_proxy_get_interface_by_id
 tp_proxy_check_interface_by_id
 tp_proxy_invalidate
 <SUBSECTION>
diff --git a/telepathy-glib/proxy-subclass.h b/telepathy-glib/proxy-subclass.h
index f143a1d..2640b23 100644
--- a/telepathy-glib/proxy-subclass.h
+++ b/telepathy-glib/proxy-subclass.h
@@ -45,9 +45,6 @@ TpProxySignalConnection *tp_proxy_signal_connection_v1_new (TpProxy *self,
     GCallback callback, gpointer user_data, GDestroyNotify destroy,
     GObject *weak_object, GError **error);
 
-GDBusProxy *tp_proxy_get_interface_by_id (TpProxy *self, GQuark iface,
-    GError **error);
-
 void tp_proxy_add_interface_by_id (TpProxy *self, GQuark iface);
 void tp_proxy_add_interfaces (TpProxy *self, const gchar * const *interfaces);
 
diff --git a/telepathy-glib/proxy.c b/telepathy-glib/proxy.c
index 82ec315..d1a7264 100644
--- a/telepathy-glib/proxy.c
+++ b/telepathy-glib/proxy.c
@@ -334,9 +334,7 @@ struct _TpProxyPrivate {
 
     GError *invalidated;
 
-    /* GQuark for interface => either a ref'd GDBusProxy *,
-     * or the TpProxy itself used as a dummy value to indicate that
-     * the GDBusProxy has not been needed yet */
+    /* GQuark for interface => the TpProxy itself (just a dummy value) */
     GData *interfaces;
 
     /* feature => FeatureState */
@@ -383,58 +381,6 @@ enum {
 static guint signals[N_SIGNALS] = {0};
 
 /**
- * tp_proxy_get_interface_by_id: (skip)
- * @self: the TpProxy
- * @iface: quark representing the interface required
- * @error: used to raise an error in the #TP_DBUS_ERRORS domain if @iface
- *         is invalid, @self has been invalidated or @self does not implement
- *         @iface
- *
- * <!-- -->
- *
- * Returns: a borrowed reference to a #GDBusProxy
- * for which the bus name and object path are the same as for @self, but the
- * interface is as given (or %NULL if an @error is raised).
- * The reference is only valid as long as @self is.
- *
- * Since: 0.19.9
- */
-GDBusProxy *
-tp_proxy_get_interface_by_id (TpProxy *self,
-    GQuark iface,
-    GError **error)
-{
-  gpointer iface_proxy;
-
-  g_return_val_if_fail (TP_IS_PROXY (self), NULL);
-
-  if (!_tp_proxy_check_interface_by_id (self, iface, error))
-    return NULL;
-
-  iface_proxy = g_datalist_id_get_data (&self->priv->interfaces, iface);
-
-  if (iface_proxy == self)
-    {
-      /* dummy value - we've never actually needed the interface, so we
-       * didn't create it, to avoid binding to all the signals */
-
-      iface_proxy = g_dbus_proxy_new_sync (self->priv->dbus_connection,
-          G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
-          NULL, /* FIXME: add interface info */
-          self->priv->bus_name,
-          self->priv->object_path,
-          g_quark_to_string (iface),
-          NULL, /* cancellable */
-          error);
-
-      g_datalist_id_set_data_full (&self->priv->interfaces, iface,
-          iface_proxy, g_object_unref);
-    }
-
-  return iface_proxy;
-}
-
-/**
  * tp_proxy_check_interface_by_id:
  * @self: the #TpProxy (or subclass)
  * @iface: quark representing the D-Bus interface required
@@ -684,9 +630,8 @@ tp_proxy_unique_name_vanished_cb (GDBusConnection *conn,
  *
  * Declare that this proxy supports a given interface.
  *
- * To use methods and signals of that interface, either call
- * tp_proxy_get_interface_by_id() to get the #GDBusProxy, or use the
- * tp_cli_* wrapper functions (strongly recommended).
+ * To use methods and signals of that interface, use the
+ * tp_cli_* wrapper functions or GDBus.
  *
  * If the interface is the proxy's "main interface", or has already been
  * added, then do nothing.
@@ -697,21 +642,17 @@ void
 tp_proxy_add_interface_by_id (TpProxy *self,
                               GQuark iface)
 {
-  GDBusProxy *iface_proxy = g_datalist_id_get_data (&self->priv->interfaces,
-      iface);
-
   g_return_if_fail
       (tp_dbus_check_valid_interface_name (g_quark_to_string (iface),
           NULL));
 
   g_return_if_fail (tp_proxy_get_invalidated (self) == NULL);
 
-  if (iface_proxy == NULL)
+  if (g_datalist_id_get_data (&self->priv->interfaces, iface) == NULL)
     {
-      /* we don't want to actually create it just yet - we'll get
-       * woken up on every signal, if we do. So we set a
-       * dummy value (self), and replace it with the real value in
-       * tp_proxy_get_interface_by_id */
+      /* At some point we might store a value - maybe a GDBusProxy -
+       * but for now it's just @self, which is a convenient
+       * non-NULL pointer. */
       g_datalist_id_set_data_full (&self->priv->interfaces, iface,
           self, NULL);
     }
diff --git a/telepathy-glib/versions/main-1.0.abi b/telepathy-glib/versions/main-1.0.abi
index 0921ad5..c335370 100644
--- a/telepathy-glib/versions/main-1.0.abi
+++ b/telepathy-glib/versions/main-1.0.abi
@@ -1121,7 +1121,6 @@ tp_proxy_get_bus_name
 tp_proxy_get_dbus_connection
 tp_proxy_get_dbus_daemon
 tp_proxy_get_factory
-tp_proxy_get_interface_by_id
 tp_proxy_get_invalidated
 tp_proxy_get_object_path
 tp_proxy_get_type
diff --git a/tests/dbus/get-interface-after-invalidate.c b/tests/dbus/get-interface-after-invalidate.c
index 0fb2162..b6a8681 100644
--- a/tests/dbus/get-interface-after-invalidate.c
+++ b/tests/dbus/get-interface-after-invalidate.c
@@ -11,18 +11,18 @@ static void
 test_get_interface_after_invalidate (void)
 {
   TpDBusDaemon *bus_daemon;
-  GDBusProxy *props;
+  gboolean has_props;
   GError invalidation_reason = { TP_ERROR, TP_ERROR_NOT_YOURS, "bees!" };
   GError *error = NULL;
 
   bus_daemon = tp_tests_dbus_daemon_dup_or_die ();
   tp_proxy_invalidate ((TpProxy *) bus_daemon, &invalidation_reason);
 
-  props = tp_proxy_get_interface_by_id ((TpProxy *) bus_daemon,
+  has_props = tp_proxy_check_interface_by_id ((TpProxy *) bus_daemon,
       TP_IFACE_QUARK_DBUS_DAEMON, &error);
 
   /* Borrowing the interface should fail because the proxy is invalidated. */
-  g_assert (props == NULL);
+  g_assert (!has_props);
   g_assert (error != NULL);
   g_assert_cmpuint (error->domain, ==, invalidation_reason.domain);
   g_assert_cmpint (error->code, ==, invalidation_reason.code);



More information about the telepathy-commits mailing list