[Telepathy-commits] [telepathy-salut/master] Use tp-glib's Requests API; delete local copy.

Will Thompson will.thompson at collabora.co.uk
Thu Oct 23 07:30:46 PDT 2008


---
 src/Makefile.am          |    6 -
 src/channel-manager.c    |  446 ---------------
 src/channel-manager.h    |  135 -----
 src/conn-requests.c      | 1358 ----------------------------------------------
 src/conn-requests.h      |   41 --
 src/exportable-channel.c |  150 -----
 src/exportable-channel.h |   61 --
 src/salut-connection.c   |   65 ++--
 src/salut-connection.h   |    6 -
 src/salut-im-channel.c   |    6 +-
 src/salut-im-manager.c   |   39 +-
 11 files changed, 55 insertions(+), 2258 deletions(-)
 delete mode 100644 src/channel-manager.c
 delete mode 100644 src/channel-manager.h
 delete mode 100644 src/conn-requests.c
 delete mode 100644 src/conn-requests.h
 delete mode 100644 src/exportable-channel.c
 delete mode 100644 src/exportable-channel.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 5ae75ee..2eb24b6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,12 +15,6 @@ libexec_PROGRAMS=telepathy-salut
 noinst_PROGRAMS = write-mgr-file
 
 CORE_SOURCES =                                          \
-    channel-manager.c                                   \
-    channel-manager.h                                   \
-    conn-requests.c                                     \
-    conn-requests.h                                     \
-    exportable-channel.c                                \
-    exportable-channel.h                                \
     salut-connection-manager.c                          \
     salut-connection-manager.h                          \
     salut-contact-manager.c                             \
diff --git a/src/channel-manager.c b/src/channel-manager.c
deleted file mode 100644
index 45236c8..0000000
--- a/src/channel-manager.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * channel-manager.c - factory and manager for channels relating to a
- *  particular protocol feature
- *
- * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include "config.h"
-#include "channel-manager.h"
-
-#include <telepathy-glib/dbus.h>
-#include <telepathy-glib/errors.h>
-#include <telepathy-glib/util.h>
-
-#include "exportable-channel.h"
-#include "signals-marshal.h"
-
-enum {
-    S_NEW_CHANNELS,
-    S_REQUEST_ALREADY_SATISFIED,
-    S_REQUEST_FAILED,
-    S_CHANNEL_CLOSED,
-    N_SIGNALS
-};
-
-static guint signals[N_SIGNALS] = {0};
-
-
-static void
-channel_manager_base_init (gpointer klass)
-{
-  static gboolean initialized = FALSE;
-
-  if (!initialized)
-    {
-      initialized = TRUE;
-
-      /* FIXME: should probably have a better GType for @channels */
-      /**
-       * SalutChannelManager::new-channels:
-       * @self: the channel manager
-       * @channels: a #GHashTable where the keys are
-       *  #SalutExportableChannel instances (hashed and compared
-       *  by g_direct_hash() and g_direct_equal()) and the values are
-       *  linked lists (#GSList) of requests (opaque pointers) satisfied by
-       *  these channels
-       *
-       * Emitted when new channels have been created. The Connection should
-       * generally emit NewChannels (and NewChannel) in response to this
-       * signal, and then return from pending CreateChannel, EnsureChannel
-       * and/or RequestChannel calls if appropriate.
-       */
-      signals[S_NEW_CHANNELS] = g_signal_new ("new-channels",
-          G_OBJECT_CLASS_TYPE (klass),
-          G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
-          0,
-          NULL, NULL,
-          g_cclosure_marshal_VOID__POINTER,
-          G_TYPE_NONE, 1, G_TYPE_POINTER);
-
-      /**
-       * SalutChannelManager::request-already-satisfied:
-       * @self: the channel manager
-       * @request_token: opaque pointer supplied by the requester,
-       *  representing a request
-       * @channel: the existing #SalutExportableChannel that satisfies the
-       *  request
-       *
-       * Emitted when a channel request is satisfied by an existing channel.
-       * The Connection should generally respond to this signal by returning
-       * success from EnsureChannel or RequestChannel.
-       */
-      signals[S_REQUEST_ALREADY_SATISFIED] = g_signal_new (
-          "request-already-satisfied",
-          G_OBJECT_CLASS_TYPE (klass),
-          G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
-          0,
-          NULL, NULL,
-          salut_signals_marshal_VOID__POINTER_OBJECT,
-          G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_OBJECT);
-
-      /**
-       * SalutChannelManager::request-failed:
-       * @self: the channel manager
-       * @request_token: opaque pointer supplied by the requester,
-       *  representing a request
-       * @domain: the domain of a #GError indicating why the request
-       *  failed
-       * @code: the error code of a #GError indicating why the request
-       *  failed
-       * @message: the string part of a #GError indicating why the request
-       *  failed
-       *
-       * Emitted when a channel request has failed. The Connection should
-       * generally respond to this signal by returning failure from
-       * CreateChannel, EnsureChannel or RequestChannel.
-       */
-      signals[S_REQUEST_FAILED] = g_signal_new ("request-failed",
-          G_OBJECT_CLASS_TYPE (klass),
-          G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
-          0,
-          NULL, NULL,
-          salut_signals_marshal_VOID__POINTER_UINT_INT_STRING,
-          G_TYPE_NONE, 4, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_INT,
-          G_TYPE_STRING);
-
-      /**
-       * SalutChannelManager::channel-closed:
-       * @self: the channel manager
-       * @path: the channel's object-path
-       *
-       * Emitted when a channel has been closed. The Connection should
-       * generally respond to this signal by emitting ChannelClosed.
-       */
-      signals[S_CHANNEL_CLOSED] = g_signal_new ("channel-closed",
-          G_OBJECT_CLASS_TYPE (klass),
-          G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
-          0,
-          NULL, NULL,
-          g_cclosure_marshal_VOID__STRING,
-          G_TYPE_NONE, 1, G_TYPE_STRING);
-
-    }
-}
-
-GType
-salut_channel_manager_get_type (void)
-{
-  static GType type = 0;
-
-  if (G_UNLIKELY (type == 0))
-    {
-      static const GTypeInfo info = {
-        sizeof (SalutChannelManagerIface),
-        channel_manager_base_init,   /* base_init */
-        NULL,   /* base_finalize */
-        NULL,   /* class_init */
-        NULL,   /* class_finalize */
-        NULL,   /* class_data */
-        0,
-        0,      /* n_preallocs */
-        NULL    /* instance_init */
-      };
-
-      type = g_type_register_static (G_TYPE_INTERFACE,
-          "SalutChannelManager", &info, 0);
-    }
-
-  return type;
-}
-
-
-/* Signal emission wrappers */
-
-
-/**
- * salut_channel_manager_emit_new_channels:
- * @instance: An object implementing #SalutChannelManager
- * @channels: a #GHashTable where the keys are
- *  #SalutExportableChannel instances (hashed and compared
- *  by g_direct_hash() and g_direct_equal()) and the values are
- *  linked lists (#GSList) of requests (opaque pointers) satisfied by
- *  these channels
- *
- * If @channels is non-empty, emit the #SalutChannelManager::new-channels
- * signal indicating that those channels have been created.
- */
-void
-salut_channel_manager_emit_new_channels (gpointer instance,
-                                         GHashTable *channels)
-{
-  g_return_if_fail (SALUT_IS_CHANNEL_MANAGER (instance));
-
-  if (g_hash_table_size (channels) == 0)
-    return;
-
-  g_signal_emit (instance, signals[S_NEW_CHANNELS], 0, channels);
-}
-
-
-/**
- * salut_channel_manager_emit_new_channel:
- * @instance: An object implementing #SalutChannelManager
- * @channel: A #SalutExportableChannel
- *
- * Emit the #SalutChannelManager::new-channels signal indicating that the
- * channel has been created. (This is a convenient shortcut for calling
- * salut_channel_manager_emit_new_channels() with a one-entry hash table.)
- */
-void
-salut_channel_manager_emit_new_channel (gpointer instance,
-                                        SalutExportableChannel *channel,
-                                        GSList *requests)
-{
-  GHashTable *channels;
-
-  g_return_if_fail (SALUT_IS_CHANNEL_MANAGER (instance));
-  g_return_if_fail (SALUT_IS_EXPORTABLE_CHANNEL (channel));
-
-  channels = g_hash_table_new_full (g_direct_hash, g_direct_equal,
-      NULL, NULL);
-  g_hash_table_insert (channels, channel, requests);
-  g_signal_emit (instance, signals[S_NEW_CHANNELS], 0, channels);
-  g_hash_table_destroy (channels);
-}
-
-
-/**
- * salut_channel_manager_emit_channel_closed:
- * @instance: An object implementing #SalutChannelManager
- * @path: A channel's object-path
- *
- * Emit the #SalutChannelManager::channel-closed signal indicating that
- * the channel at the given object path has been closed.
- */
-void
-salut_channel_manager_emit_channel_closed (gpointer instance,
-                                           const gchar *path)
-{
-  g_return_if_fail (SALUT_IS_CHANNEL_MANAGER (instance));
-  g_return_if_fail (tp_dbus_check_valid_object_path (path, NULL));
-
-  g_signal_emit (instance, signals[S_CHANNEL_CLOSED], 0, path);
-}
-
-
-/**
- * salut_channel_manager_emit_channel_closed_for_object:
- * @instance: An object implementing #SalutChannelManager
- * @channel: A #SalutExportableChannel
- *
- * Emit the #SalutChannelManager::channel-closed signal indicating that
- * the given channel has been closed. (This is a convenient shortcut for
- * calling salut_channel_manager_emit_channel_closed() with the
- * #SalutExportableChannel:object-path property of @channel.)
- */
-void
-salut_channel_manager_emit_channel_closed_for_object (gpointer instance,
-    SalutExportableChannel *channel)
-{
-  gchar *path;
-
-  g_return_if_fail (SALUT_IS_EXPORTABLE_CHANNEL (channel));
-  g_object_get (channel,
-      "object-path", &path,
-      NULL);
-  salut_channel_manager_emit_channel_closed (instance, path);
-  g_free (path);
-}
-
-
-/**
- * salut_channel_manager_emit_request_already_satisfied:
- * @instance: An object implementing #SalutChannelManager
- * @request_token: An opaque pointer representing the request that
- *  succeeded
- * @channel: The channel that satisfies the request
- *
- * Emit the #SalutChannelManager::request-already-satisfied signal indicating
- * that the pre-existing channel @channel satisfies @request_token.
- */
-void
-salut_channel_manager_emit_request_already_satisfied (gpointer instance,
-    gpointer request_token,
-    SalutExportableChannel *channel)
-{
-  g_return_if_fail (SALUT_IS_EXPORTABLE_CHANNEL (channel));
-  g_return_if_fail (SALUT_IS_CHANNEL_MANAGER (instance));
-
-  g_signal_emit (instance, signals[S_REQUEST_ALREADY_SATISFIED], 0,
-      request_token, channel);
-}
-
-
-/**
- * salut_channel_manager_emit_request_failed:
- * @instance: An object implementing #SalutChannelManager
- * @request_token: An opaque pointer representing the request that failed
- * @domain: a #GError domain
- * @code: a #GError code appropriate for @domain
- * @message: the error message
- *
- * Emit the #SalutChannelManager::request-failed signal indicating that
- * the request @request_token failed for the given reason.
- */
-void
-salut_channel_manager_emit_request_failed (gpointer instance,
-                                           gpointer request_token,
-                                           GQuark domain,
-                                           gint code,
-                                           const gchar *message)
-{
-  g_return_if_fail (SALUT_IS_CHANNEL_MANAGER (instance));
-
-  g_signal_emit (instance, signals[S_REQUEST_FAILED], 0, request_token,
-      domain, code, message);
-}
-
-
-/**
- * salut_channel_manager_emit_request_failed_printf:
- * @instance: An object implementing #SalutChannelManager
- * @request_token: An opaque pointer representing the request that failed
- * @domain: a #GError domain
- * @code: a #GError code appropriate for @domain
- * @format: a printf-style format string for the error message
- * @...: arguments for the format string
- *
- * Emit the #SalutChannelManager::request-failed signal indicating that
- * the request @request_token failed for the given reason.
- */
-void
-salut_channel_manager_emit_request_failed_printf (gpointer instance,
-                                                  gpointer request_token,
-                                                  GQuark domain,
-                                                  gint code,
-                                                  const gchar *format,
-                                                  ...)
-{
-  va_list ap;
-  gchar *message;
-
-  va_start (ap, format);
-  message = g_strdup_vprintf (format, ap);
-  va_end (ap);
-
-  salut_channel_manager_emit_request_failed (instance, request_token,
-      domain, code, message);
-
-  g_free (message);
-}
-
-
-/* Virtual-method wrappers */
-
-
-void
-salut_channel_manager_foreach_channel (SalutChannelManager *manager,
-                                       SalutExportableChannelFunc func,
-                                       gpointer user_data)
-{
-  SalutChannelManagerIface *iface = SALUT_CHANNEL_MANAGER_GET_INTERFACE (
-      manager);
-  SalutChannelManagerForeachChannelFunc method = iface->foreach_channel;
-
-  if (method != NULL)
-    {
-      method (manager, func, user_data);
-    }
-  /* ... else assume it has no channels, and do nothing */
-}
-
-
-void
-salut_channel_manager_foreach_channel_class (SalutChannelManager *manager,
-    SalutChannelManagerChannelClassFunc func,
-    gpointer user_data)
-{
-  SalutChannelManagerIface *iface = SALUT_CHANNEL_MANAGER_GET_INTERFACE (
-      manager);
-  SalutChannelManagerForeachChannelClassFunc method =
-      iface->foreach_channel_class;
-
-  if (method != NULL)
-    {
-      method (manager, func, user_data);
-    }
-  /* ... else assume it has no classes of requestable channel */
-}
-
-
-gboolean
-salut_channel_manager_create_channel (SalutChannelManager *manager,
-                                      gpointer request_token,
-                                      GHashTable *request_properties)
-{
-  SalutChannelManagerIface *iface = SALUT_CHANNEL_MANAGER_GET_INTERFACE (
-      manager);
-  SalutChannelManagerRequestFunc method = iface->create_channel;
-
-  /* A missing implementation is equivalent to one that always returns FALSE,
-   * meaning "can't do that, ask someone else" */
-  if (method != NULL)
-    return method (manager, request_token, request_properties);
-  else
-    return FALSE;
-}
-
-
-gboolean
-salut_channel_manager_request_channel (SalutChannelManager *manager,
-                                       gpointer request_token,
-                                       GHashTable *request_properties)
-{
-  SalutChannelManagerIface *iface = SALUT_CHANNEL_MANAGER_GET_INTERFACE (
-      manager);
-  SalutChannelManagerRequestFunc method = iface->request_channel;
-
-  /* A missing implementation is equivalent to one that always returns FALSE,
-   * meaning "can't do that, ask someone else" */
-  if (method != NULL)
-    return method (manager, request_token, request_properties);
-  else
-    return FALSE;
-}
-
-
-gboolean
-salut_channel_manager_asv_has_unknown_properties (GHashTable *properties,
-                                                  const gchar * const *fixed,
-                                                  const gchar * const *allowed,
-                                                  GError **error)
-{
-  GHashTableIter iter;
-  gpointer key;
-  const gchar *property_name;
-
-  g_hash_table_iter_init (&iter, properties);
-  while (g_hash_table_iter_next (&iter, &key, NULL))
-    {
-      property_name = key;
-      if (!tp_strv_contains (fixed, property_name) &&
-          !tp_strv_contains (allowed, property_name))
-        {
-          g_set_error (error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
-              "Request contained unknown property '%s'", property_name);
-          return TRUE;
-        }
-    }
-  return FALSE;
-}
diff --git a/src/channel-manager.h b/src/channel-manager.h
deleted file mode 100644
index 771c000..0000000
--- a/src/channel-manager.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * channel-manager.h - factory and manager for channels relating to a
- *  particular protocol feature
- *
- * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef SALUT_CHANNEL_MANAGER_H
-#define SALUT_CHANNEL_MANAGER_H
-
-#include <glib-object.h>
-
-#include "exportable-channel.h"
-
-G_BEGIN_DECLS
-
-#define SALUT_TYPE_CHANNEL_MANAGER (salut_channel_manager_get_type ())
-
-#define SALUT_CHANNEL_MANAGER(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-  SALUT_TYPE_CHANNEL_MANAGER, SalutChannelManager))
-
-#define SALUT_IS_CHANNEL_MANAGER(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-  SALUT_TYPE_CHANNEL_MANAGER))
-
-#define SALUT_CHANNEL_MANAGER_GET_INTERFACE(obj) \
-  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \
-  SALUT_TYPE_CHANNEL_MANAGER, SalutChannelManagerIface))
-
-typedef struct _SalutChannelManager SalutChannelManager;
-typedef struct _SalutChannelManagerIface SalutChannelManagerIface;
-
-
-/* virtual methods */
-
-typedef void (*SalutChannelManagerForeachChannelFunc) (
-    SalutChannelManager *manager, SalutExportableChannelFunc func,
-    gpointer user_data);
-
-void salut_channel_manager_foreach_channel (SalutChannelManager *manager,
-    SalutExportableChannelFunc func, gpointer user_data);
-
-
-typedef void (*SalutChannelManagerChannelClassFunc) (
-    SalutChannelManager *manager,
-    GHashTable *fixed_properties,
-    const gchar * const *allowed_properties,
-    gpointer user_data);
-
-typedef void (*SalutChannelManagerForeachChannelClassFunc) (
-    SalutChannelManager *manager, SalutChannelManagerChannelClassFunc func,
-    gpointer user_data);
-
-void salut_channel_manager_foreach_channel_class (
-    SalutChannelManager *manager,
-    SalutChannelManagerChannelClassFunc func, gpointer user_data);
-
-
-typedef gboolean (*SalutChannelManagerRequestFunc) (
-    SalutChannelManager *manager, gpointer request_token,
-    GHashTable *request_properties);
-
-gboolean salut_channel_manager_create_channel (SalutChannelManager *manager,
-    gpointer request_token, GHashTable *request_properties);
-
-gboolean salut_channel_manager_request_channel (SalutChannelManager *manager,
-    gpointer request_token, GHashTable *request_properties);
-
-
-struct _SalutChannelManagerIface {
-    GTypeInterface parent;
-
-    SalutChannelManagerForeachChannelFunc foreach_channel;
-
-    SalutChannelManagerForeachChannelClassFunc foreach_channel_class;
-
-    SalutChannelManagerRequestFunc create_channel;
-    SalutChannelManagerRequestFunc request_channel;
-    /* in principle we could have EnsureChannel here too */
-
-    GCallback _future[8];
-    gpointer priv;
-};
-
-
-GType salut_channel_manager_get_type (void);
-
-
-/* signal emission */
-
-void salut_channel_manager_emit_new_channel (gpointer instance,
-    SalutExportableChannel *channel, GSList *requests);
-void salut_channel_manager_emit_new_channels (gpointer instance,
-    GHashTable *channels);
-
-void salut_channel_manager_emit_channel_closed (gpointer instance,
-    const gchar *path);
-void salut_channel_manager_emit_channel_closed_for_object (gpointer instance,
-    SalutExportableChannel *channel);
-
-void salut_channel_manager_emit_request_already_satisfied (
-    gpointer instance, gpointer request_token,
-    SalutExportableChannel *channel);
-
-void salut_channel_manager_emit_request_failed (gpointer instance,
-    gpointer request_token, GQuark domain, gint code, const gchar *message);
-void salut_channel_manager_emit_request_failed_printf (gpointer instance,
-    gpointer request_token, GQuark domain, gint code, const gchar *format,
-    ...) G_GNUC_PRINTF (5, 6);
-
-/* helpers */
-
-gboolean salut_channel_manager_asv_has_unknown_properties (
-    GHashTable *properties, const gchar * const *fixed,
-    const gchar * const *allowed, GError **error);
-
-G_END_DECLS
-
-#endif
diff --git a/src/conn-requests.c b/src/conn-requests.c
deleted file mode 100644
index 331ea96..0000000
--- a/src/conn-requests.c
+++ /dev/null
@@ -1,1358 +0,0 @@
-/* SalutConnection's Requests (requestotron) implementation
- *
- * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include "config.h"
-#include "conn-requests.h"
-
-#include <telepathy-glib/channel-factory-iface.h>
-#include <telepathy-glib/dbus.h>
-#include <telepathy-glib/gtypes.h>
-#include <telepathy-glib/interfaces.h>
-#include <telepathy-glib/svc-connection.h>
-#include <telepathy-glib/util.h>
-
-#include "extensions/extensions.h"
-
-#define DEBUG_FLAG DEBUG_CONNECTION
-#include "channel-manager.h"
-#include "exportable-channel.h"
-#include "debug.h"
-
-
-static GValueArray *
-get_channel_details (GObject *obj)
-{
-  GValueArray *structure = g_value_array_new (1);
-  GHashTable *table;
-  GValue *value;
-  gchar *object_path;
-
-  g_object_get (obj,
-      "object-path", &object_path,
-      NULL);
-
-  g_value_array_append (structure, NULL);
-  value = g_value_array_get_nth (structure, 0);
-  g_value_init (value, DBUS_TYPE_G_OBJECT_PATH);
-  g_value_take_boxed (value, object_path);
-  object_path = NULL;
-
-  g_assert (SALUT_IS_EXPORTABLE_CHANNEL (obj) || TP_IS_CHANNEL_IFACE (obj));
-
-  if (SALUT_IS_EXPORTABLE_CHANNEL (obj))
-    {
-      g_object_get (obj,
-          "channel-properties", &table,
-          NULL);
-    }
-  else
-    {
-     table = g_hash_table_new_full (g_str_hash, g_str_equal,
-          NULL, (GDestroyNotify) tp_g_value_slice_free);
-
-      value = tp_g_value_slice_new (G_TYPE_UINT);
-      g_object_get_property (obj, "handle", value);
-      g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandle", value);
-
-      value = tp_g_value_slice_new (G_TYPE_UINT);
-      g_object_get_property (obj, "handle-type", value);
-      g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType", value);
-
-      value = tp_g_value_slice_new (G_TYPE_STRING);
-      g_object_get_property (obj, "channel-type", value);
-      g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType", value);
-    }
-
-  g_value_array_append (structure, NULL);
-  value = g_value_array_get_nth (structure, 1);
-  g_value_init (value, TP_HASH_TYPE_STRING_VARIANT_MAP);
-  g_value_take_boxed (value, table);
-
-  return structure;
-}
-
-
-/* Most of this is cut and pasted from telepathy-glib, and should
- * make its way back there once stable */
-
-typedef struct _ChannelRequest ChannelRequest;
-
-typedef enum {
-    METHOD_REQUEST_CHANNEL,
-    METHOD_CREATE_CHANNEL,
-#if 0
-    METHOD_ENSURE_CHANNEL,
-#endif
-    NUM_METHODS
-} ChannelRequestMethod;
-
-struct _ChannelRequest
-{
-  DBusGMethodInvocation *context;
-  ChannelRequestMethod method;
-
-  /* relevant if the method is METHOD_REQUEST_CHANNEL */
-  gchar *channel_type;
-  guint handle_type;
-  guint handle;
-  /* always TRUE for CREATE */
-  gboolean suppress_handler;
-};
-
-static ChannelRequest *
-channel_request_new (DBusGMethodInvocation *context,
-                     ChannelRequestMethod method,
-                     const char *channel_type,
-                     guint handle_type,
-                     guint handle,
-                     gboolean suppress_handler)
-{
-  ChannelRequest *ret;
-
-  g_assert (NULL != context);
-  g_assert (NULL != channel_type);
-  g_assert (method < NUM_METHODS);
-
-  ret = g_slice_new0 (ChannelRequest);
-  ret->context = context;
-  ret->method = method;
-  ret->channel_type = g_strdup (channel_type);
-  ret->handle_type = handle_type;
-  ret->handle = handle;
-  ret->suppress_handler = suppress_handler;
-
-  DEBUG("New channel request at %p: ctype=%s htype=%d handle=%d suppress=%d",
-        ret, channel_type, handle_type, handle, suppress_handler);
-
-  return ret;
-}
-
-static void
-channel_request_free (ChannelRequest *request)
-{
-  g_assert (NULL == request->context);
-  DEBUG("Freeing channel request at %p: ctype=%s htype=%d handle=%d "
-        "suppress=%d", request, request->channel_type, request->handle_type,
-        request->handle, request->suppress_handler);
-  g_free (request->channel_type);
-  g_slice_free (ChannelRequest, request);
-}
-
-static void
-channel_request_cancel (gpointer data, gpointer user_data)
-{
-  ChannelRequest *request = (ChannelRequest *) data;
-  GError error = { TP_ERRORS, TP_ERROR_DISCONNECTED,
-      "unable to service this channel request, we're disconnecting!" };
-
-  DEBUG ("cancelling request at %p for %s/%u/%u", request,
-      request->channel_type, request->handle_type, request->handle);
-
-  dbus_g_method_return_error (request->context, &error);
-  request->context = NULL;
-
-  channel_request_free (request);
-}
-
-static GPtrArray *
-find_matching_channel_requests (SalutConnection *self,
-                                const gchar *channel_type,
-                                guint handle_type,
-                                guint handle,
-                                ChannelRequest *channel_request,
-                                gboolean *suppress_handler)
-{
-  GPtrArray *requests;
-  guint i;
-
-  requests = g_ptr_array_sized_new (1);
-
-  if (handle_type == 0)
-    {
-      /* It's an anonymous channel, which can only satisfy the request for
-       * which it was created (or if it's returned as EXISTING, it can only
-       * satisfy the request for which it was returned as EXISTING).
-       */
-      g_assert (handle == 0);
-      g_assert (channel_request == NULL ||
-          tp_g_ptr_array_contains (self->channel_requests, channel_request));
-
-      if (channel_request)
-        {
-          g_ptr_array_add (requests, channel_request);
-
-          if (suppress_handler && channel_request->suppress_handler)
-            *suppress_handler = TRUE;
-        }
-
-      /* whether we've put any matches in requests or not */
-      return requests;
-    }
-
-  /* for identifiable channels (those which are to a particular handle),
-   * satisfy any queued requests.
-   */
-  for (i = 0; i < self->channel_requests->len; i++)
-    {
-      ChannelRequest *request = g_ptr_array_index (self->channel_requests, i);
-
-      if (tp_strdiff (request->channel_type, channel_type))
-        continue;
-
-      if (handle_type != request->handle_type)
-        continue;
-
-      if (handle != request->handle)
-        continue;
-
-      if (request->suppress_handler && suppress_handler)
-        *suppress_handler = TRUE;
-
-      g_ptr_array_add (requests, request);
-    }
-
-  /* if this channel was created or returned as a result of a particular
-   * request, that request had better be among the matching ones in the queue
-   */
-  g_assert (channel_request == NULL ||
-      tp_g_ptr_array_contains (requests, channel_request));
-
-  return requests;
-}
-
-
-static void
-satisfy_request (SalutConnection *self,
-                 ChannelRequest *request,
-                 GObject *channel,
-                 const gchar *object_path)
-{
-  DEBUG ("completing queued request %p with success, "
-      "channel_type=%s, handle_type=%u, "
-      "handle=%u, suppress_handler=%u", request, request->channel_type,
-      request->handle_type, request->handle, request->suppress_handler);
-
-  switch (request->method)
-    {
-    case METHOD_REQUEST_CHANNEL:
-      tp_svc_connection_return_from_request_channel (request->context,
-          object_path);
-      break;
-
-    case METHOD_CREATE_CHANNEL:
-        {
-          GHashTable *properties;
-
-          g_assert (SALUT_IS_EXPORTABLE_CHANNEL (channel));
-          g_object_get (channel,
-              "channel-properties", &properties,
-              NULL);
-          salut_svc_connection_interface_requests_return_from_create_channel (
-              request->context, object_path, properties);
-          g_hash_table_destroy (properties);
-        }
-        break;
-
-    default:
-      g_assert_not_reached ();
-    }
-  request->context = NULL;
-
-  g_ptr_array_remove (self->channel_requests, request);
-
-  channel_request_free (request);
-}
-
-
-static void
-satisfy_requests (SalutConnection *self,
-                  TpChannelFactoryIface *factory,
-                  TpChannelIface *chan,
-                  ChannelRequest *channel_request,
-                  gboolean is_new)
-{
-  gchar *object_path = NULL, *channel_type = NULL;
-  guint handle_type = 0, handle = 0;
-  gboolean suppress_handler = FALSE;
-  GPtrArray *tmp;
-  guint i;
-
-  g_object_get (chan,
-      "object-path", &object_path,
-      "channel-type", &channel_type,
-      "handle-type", &handle_type,
-      "handle", &handle,
-      NULL);
-
-  DEBUG ("called for %s", object_path);
-
-  tmp = find_matching_channel_requests (self, channel_type, handle_type,
-                                        handle, channel_request,
-                                        &suppress_handler);
-
-  if (is_new)
-    {
-      GPtrArray *array = g_ptr_array_sized_new (1);
-
-      tp_svc_connection_emit_new_channel (self, object_path, channel_type,
-          handle_type, handle, suppress_handler);
-
-      g_ptr_array_add (array, get_channel_details (G_OBJECT (chan)));
-      salut_svc_connection_interface_requests_emit_new_channels (self,
-          array);
-      g_value_array_free (g_ptr_array_index (array, 0));
-      g_ptr_array_free (array, TRUE);
-    }
-
-  for (i = 0; i < tmp->len; i++)
-    satisfy_request (self, g_ptr_array_index (tmp, i), G_OBJECT (chan),
-        object_path);
-
-  g_ptr_array_free (tmp, TRUE);
-
-  g_free (object_path);
-  g_free (channel_type);
-}
-
-static void
-channel_closed_cb (GObject *channel,
-                   SalutConnection *self)
-{
-  gchar *object_path;
-
-  g_object_get (channel,
-      "object-path", &object_path,
-      NULL);
-
-  salut_svc_connection_interface_requests_emit_channel_closed (self,
-      object_path);
-
-  g_free (object_path);
-}
-
-static void
-connection_new_channel_cb (TpChannelFactoryIface *factory,
-                           GObject *chan,
-                           ChannelRequest *channel_request,
-                           gpointer data)
-{
-  satisfy_requests (SALUT_CONNECTION (data), factory,
-      TP_CHANNEL_IFACE (chan), channel_request, TRUE);
-
-  g_signal_connect (chan, "closed", (GCallback) channel_closed_cb, data);
-}
-
-
-static void
-fail_channel_request (SalutConnection *self,
-                      ChannelRequest *request,
-                      GError *error)
-{
-  DEBUG ("completing queued request %p with error, channel_type=%s, "
-      "handle_type=%u, handle=%u, suppress_handler=%u",
-      request, request->channel_type,
-      request->handle_type, request->handle, request->suppress_handler);
-
-  dbus_g_method_return_error (request->context, error);
-  request->context = NULL;
-
-  g_ptr_array_remove (self->channel_requests, request);
-
-  channel_request_free (request);
-}
-
-
-static void
-connection_channel_error_cb (TpChannelFactoryIface *factory,
-                             GObject *chan,
-                             GError *error,
-                             ChannelRequest *channel_request,
-                             gpointer data)
-{
-  SalutConnection *self = SALUT_CONNECTION (data);
-  gchar *channel_type = NULL;
-  guint handle_type = 0, handle = 0;
-  GPtrArray *tmp;
-  guint i;
-
-  DEBUG ("channel_type=%s, handle_type=%u, handle=%u, error_code=%u, "
-      "error_message=\"%s\"", channel_type, handle_type, handle,
-      error->code, error->message);
-
-  g_object_get (chan,
-      "channel-type", &channel_type,
-      "handle-type", &handle_type,
-      "handle", &handle,
-      NULL);
-
-  tmp = find_matching_channel_requests (self, channel_type, handle_type,
-                                        handle, channel_request, NULL);
-
-  for (i = 0; i < tmp->len; i++)
-    fail_channel_request (self, g_ptr_array_index (tmp, i), error);
-
-  g_ptr_array_free (tmp, TRUE);
-  g_free (channel_type);
-}
-
-
-static void
-conn_requests_request_channel (TpSvcConnection *iface,
-                               const gchar *type,
-                               guint handle_type,
-                               guint handle,
-                               gboolean suppress_handler,
-                               DBusGMethodInvocation *context)
-{
-  SalutConnection *self = SALUT_CONNECTION (iface);
-  TpChannelFactoryRequestStatus status =
-    TP_CHANNEL_FACTORY_REQUEST_STATUS_NOT_IMPLEMENTED;
-  GError *error = NULL;
-  guint i;
-  ChannelRequest *request;
-  GHashTable *request_properties;
-  GValue *v;
-
-  TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED ((TpBaseConnection *) self,
-      context);
-
-  request = channel_request_new (context, METHOD_REQUEST_CHANNEL,
-      type, handle_type, handle, suppress_handler);
-  g_ptr_array_add (self->channel_requests, request);
-
-  /* First try the channel managers */
-
-  request_properties = g_hash_table_new_full (g_str_hash, g_str_equal,
-      NULL, (GDestroyNotify) tp_g_value_slice_free);
-
-  v = tp_g_value_slice_new (G_TYPE_STRING);
-  g_value_set_string (v, type);
-  g_hash_table_insert (request_properties, TP_IFACE_CHANNEL ".ChannelType", v);
-
-  v = tp_g_value_slice_new (G_TYPE_UINT);
-  g_value_set_uint (v, handle_type);
-  g_hash_table_insert (request_properties,
-      TP_IFACE_CHANNEL ".TargetHandleType", v);
-
-  v = tp_g_value_slice_new (G_TYPE_UINT);
-  g_value_set_uint (v, handle);
-  g_hash_table_insert (request_properties,
-      TP_IFACE_CHANNEL ".TargetHandle", v);
-
-  for (i = 0; i < self->channel_managers->len; i++)
-    {
-      SalutChannelManager *manager = SALUT_CHANNEL_MANAGER (
-          g_ptr_array_index (self->channel_managers, i));
-
-      if (salut_channel_manager_request_channel (manager, request,
-            request_properties))
-        return;
-    }
-
-  g_hash_table_destroy (request_properties);
-
-  /* OK, none of them wanted it. Now try the channel factories */
-
-  for (i = 0; i < self->channel_factories->len; i++)
-    {
-      TpChannelFactoryIface *factory = g_ptr_array_index (
-        self->channel_factories, i);
-      TpChannelFactoryRequestStatus cur_status;
-      TpChannelIface *chan = NULL;
-
-      cur_status = tp_channel_factory_iface_request (factory, type,
-          (TpHandleType) handle_type, handle, request, &chan, &error);
-
-      switch (cur_status)
-        {
-        case TP_CHANNEL_FACTORY_REQUEST_STATUS_EXISTING:
-          {
-            g_assert (NULL != chan);
-            satisfy_requests (self, factory, chan, request, FALSE);
-            /* satisfy_requests should remove the request */
-            g_assert (!tp_g_ptr_array_contains (self->channel_requests,
-                  request));
-            return;
-          }
-        case TP_CHANNEL_FACTORY_REQUEST_STATUS_CREATED:
-          g_assert (NULL != chan);
-          /* the signal handler should have completed the queued request
-           * and freed the ChannelRequest already */
-          g_assert (!tp_g_ptr_array_contains (self->channel_requests,
-                request));
-          return;
-        case TP_CHANNEL_FACTORY_REQUEST_STATUS_QUEUED:
-          DEBUG ("queued request, channel_type=%s, handle_type=%u, "
-              "handle=%u, suppress_handler=%u", type, handle_type,
-              handle, suppress_handler);
-          return;
-        case TP_CHANNEL_FACTORY_REQUEST_STATUS_ERROR:
-          /* pass through error */
-          goto ERROR;
-        default:
-          /* always return the most specific error */
-          if (cur_status > status)
-            status = cur_status;
-        }
-    }
-
-  switch (status)
-    {
-      case TP_CHANNEL_FACTORY_REQUEST_STATUS_INVALID_HANDLE:
-        DEBUG ("invalid handle %u", handle);
-
-        error = g_error_new (TP_ERRORS, TP_ERROR_INVALID_HANDLE,
-                             "invalid handle %u", handle);
-
-        break;
-
-      case TP_CHANNEL_FACTORY_REQUEST_STATUS_NOT_AVAILABLE:
-        DEBUG ("requested channel is unavailable with "
-                 "handle type %u", handle_type);
-
-        error = g_error_new (TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
-                             "requested channel is not available with "
-                             "handle type %u", handle_type);
-
-        break;
-
-      case TP_CHANNEL_FACTORY_REQUEST_STATUS_NOT_IMPLEMENTED:
-        DEBUG ("unsupported channel type %s", type);
-
-        error = g_error_new (TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
-                             "unsupported channel type %s", type);
-
-        break;
-
-      default:
-        g_assert_not_reached ();
-    }
-
-ERROR:
-  g_assert (error != NULL);
-  dbus_g_method_return_error (request->context, error);
-  request->context = NULL;
-  g_error_free (error);
-
-  g_ptr_array_remove (self->channel_requests, request);
-  channel_request_free (request);
-}
-
-static void
-connection_status_changed (SalutConnection *self,
-                           guint status,
-                           guint reason,
-                           gpointer unused G_GNUC_UNUSED)
-{
-  /* We deliberately don't iterate over channel managers here -
-   * they don't need this, and are expected to listen to status-changed
-   * for themselves. */
-
-  /* cancel all queued channel requests when disconnected */
-  if (status == TP_CONNECTION_STATUS_DISCONNECTED)
-    {
-      /* trigger close_all on all channel factories */
-      g_ptr_array_foreach (self->channel_factories,
-          (GFunc) tp_channel_factory_iface_close_all, NULL);
-
-      if (self->channel_requests->len > 0)
-        {
-          g_ptr_array_foreach (self->channel_requests, (GFunc)
-            channel_request_cancel, NULL);
-          g_ptr_array_remove_range (self->channel_requests, 0,
-            self->channel_requests->len);
-        }
-    }
-
-  switch (status)
-    {
-    case TP_CONNECTION_STATUS_CONNECTING:
-      self->has_tried_connection = TRUE;
-      g_ptr_array_foreach (self->channel_factories,
-          (GFunc) tp_channel_factory_iface_connecting, NULL);
-      break;
-
-    case TP_CONNECTION_STATUS_CONNECTED:
-      self->has_tried_connection = TRUE;
-      g_ptr_array_foreach (self->channel_factories,
-          (GFunc) tp_channel_factory_iface_connected, NULL);
-      break;
-
-    case TP_CONNECTION_STATUS_DISCONNECTED:
-      if (self->has_tried_connection)
-        g_ptr_array_foreach (self->channel_factories,
-            (GFunc) tp_channel_factory_iface_disconnected, NULL);
-      break;
-
-    default:
-      g_assert_not_reached ();
-    }
-}
-
-
-static void
-list_channel_factory_foreach_one (TpChannelIface *chan,
-                                  gpointer data)
-{
-  GObject *channel = G_OBJECT (chan);
-  GPtrArray *values = (GPtrArray *) data;
-  gchar *path, *type;
-  guint handle_type, handle;
-  GValue *entry = tp_dbus_specialized_value_slice_new
-      (TP_STRUCT_TYPE_CHANNEL_INFO);
-
-  g_assert (TP_IS_CHANNEL_IFACE (channel));
-
-  g_object_get (channel,
-      "object-path", &path,
-      "channel-type", &type,
-      "handle-type", &handle_type,
-      "handle", &handle,
-      NULL);
-
-  dbus_g_type_struct_set (entry,
-      0, path,
-      1, type,
-      2, handle_type,
-      3, handle,
-      G_MAXUINT);
-
-  g_ptr_array_add (values, entry);
-
-  g_free (path);
-  g_free (type);
-}
-
-
-static void
-exportable_channel_get_old_info (SalutExportableChannel *channel,
-                                 gchar **object_path_out,
-                                 gchar **channel_type_out,
-                                 guint *handle_type_out,
-                                 guint *handle_out)
-{
-  gchar *object_path;
-  GHashTable *channel_properties;
-  gboolean valid;
-
-  g_object_get (channel,
-      "object-path", &object_path,
-      "channel-properties", &channel_properties,
-      NULL);
-
-  g_assert (object_path != NULL);
-  g_assert (tp_dbus_check_valid_object_path (object_path, NULL));
-
-  if (object_path_out != NULL)
-    *object_path_out = object_path;
-  else
-    g_free (object_path);
-
-  if (channel_type_out != NULL)
-    {
-      *channel_type_out = g_strdup (tp_asv_get_string (channel_properties,
-          TP_IFACE_CHANNEL ".ChannelType"));
-      g_assert (*channel_type_out != NULL);
-      g_assert (tp_dbus_check_valid_interface_name (*channel_type_out, NULL));
-    }
-
-  if (handle_type_out != NULL)
-    {
-      *handle_type_out = tp_asv_get_uint32 (channel_properties,
-          TP_IFACE_CHANNEL ".TargetHandleType", &valid);
-      g_assert (valid);
-    }
-
-  if (handle_out != NULL)
-    {
-      *handle_out = tp_asv_get_uint32 (channel_properties,
-          TP_IFACE_CHANNEL ".TargetHandle", &valid);
-      g_assert (valid);
-
-      if (handle_type_out != NULL)
-        {
-          if (*handle_type_out == TP_HANDLE_TYPE_NONE)
-            g_assert (*handle_out == 0);
-          else
-            g_assert (*handle_out != 0);
-        }
-    }
-
-  g_hash_table_destroy (channel_properties);
-}
-
-
-static void
-list_channel_manager_foreach_one (SalutExportableChannel *channel,
-                                  gpointer data)
-{
-  GPtrArray *values = (GPtrArray *) data;
-  gchar *path, *type;
-  guint handle_type, handle;
-  GValue *entry = tp_dbus_specialized_value_slice_new
-      (TP_STRUCT_TYPE_CHANNEL_INFO);
-
-  g_assert (SALUT_IS_EXPORTABLE_CHANNEL (channel));
-
-  exportable_channel_get_old_info (channel, &path, &type, &handle_type,
-      &handle);
-
-  dbus_g_type_struct_set (entry,
-      0, path,
-      1, type,
-      2, handle_type,
-      3, handle,
-      G_MAXUINT);
-
-  g_ptr_array_add (values, entry);
-
-  g_free (path);
-  g_free (type);
-}
-
-
-static void
-conn_requests_list_channels (TpSvcConnection *iface,
-                             DBusGMethodInvocation *context)
-{
-  SalutConnection *self = SALUT_CONNECTION (iface);
-  GPtrArray *channels, *values;
-  guint i;
-
-  TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED ((TpBaseConnection *) self,
-      context);
-
-  /* I think on average, each factory will have 2 channels :D */
-  values = g_ptr_array_sized_new (self->channel_factories->len * 2
-      + self->channel_managers->len * 2);
-
-  for (i = 0; i < self->channel_factories->len; i++)
-    {
-      TpChannelFactoryIface *factory = g_ptr_array_index
-        (self->channel_factories, i);
-
-      tp_channel_factory_iface_foreach (factory,
-          list_channel_factory_foreach_one, values);
-    }
-
-  for (i = 0; i < self->channel_managers->len; i++)
-    {
-      SalutChannelManager *manager = g_ptr_array_index
-        (self->channel_managers, i);
-
-      salut_channel_manager_foreach_channel (manager,
-          list_channel_manager_foreach_one, values);
-    }
-
-  channels = g_ptr_array_sized_new (values->len);
-
-  for (i = 0; i < values->len; i++)
-    {
-      g_ptr_array_add (channels, g_value_get_boxed (g_ptr_array_index
-            (values, i)));
-    }
-
-  tp_svc_connection_return_from_list_channels (context, channels);
-
-  g_ptr_array_free (channels, TRUE);
-  for (i = 0; i < values->len; i++)
-    {
-      tp_g_value_slice_free (g_ptr_array_index (values, i));
-    }
-  g_ptr_array_free (values, TRUE);
-}
-
-
-/* The new Requests API */
-
-
-static void
-factory_get_channel_details_foreach (TpChannelIface *chan,
-                                     gpointer data)
-{
-  GPtrArray *details = data;
-
-  g_ptr_array_add (details, get_channel_details (G_OBJECT (chan)));
-}
-
-
-static void
-manager_get_channel_details_foreach (SalutExportableChannel *chan,
-                                     gpointer data)
-{
-  GPtrArray *details = data;
-
-  g_ptr_array_add (details, get_channel_details (G_OBJECT (chan)));
-}
-
-
-static GPtrArray *
-conn_requests_get_channel_details (SalutConnection *self)
-{
-  /* guess that each ChannelManager and each ChannelFactory has two
-   * channels, on average */
-  GPtrArray *details = g_ptr_array_sized_new (self->channel_managers->len * 2
-      + self->channel_factories->len * 2);
-  guint i;
-
-  for (i = 0; i < self->channel_factories->len; i++)
-    {
-      TpChannelFactoryIface *factory = TP_CHANNEL_FACTORY_IFACE (
-          g_ptr_array_index (self->channel_factories, i));
-
-      tp_channel_factory_iface_foreach (factory,
-          factory_get_channel_details_foreach, details);
-    }
-
-  for (i = 0; i < self->channel_managers->len; i++)
-    {
-      SalutChannelManager *manager = SALUT_CHANNEL_MANAGER (
-          g_ptr_array_index (self->channel_managers, i));
-
-      salut_channel_manager_foreach_channel (manager,
-          manager_get_channel_details_foreach, details);
-    }
-
-  return details;
-}
-
-
-static void
-get_requestables_foreach (SalutChannelManager *manager,
-                          GHashTable *fixed_properties,
-                          const gchar * const *allowed_properties,
-                          gpointer user_data)
-{
-  GPtrArray *details = user_data;
-  GValueArray *requestable = g_value_array_new (2);
-  GValue *value;
-
-  g_value_array_append (requestable, NULL);
-  value = g_value_array_get_nth (requestable, 0);
-  g_value_init (value, SALUT_HASH_TYPE_CHANNEL_CLASS);
-  g_value_set_boxed (value, fixed_properties);
-
-  g_value_array_append (requestable, NULL);
-  value = g_value_array_get_nth (requestable, 1);
-  g_value_init (value, G_TYPE_STRV);
-  g_value_set_boxed (value, allowed_properties);
-
-  g_ptr_array_add (details, requestable);
-}
-
-
-static GPtrArray *
-conn_requests_get_requestables (SalutConnection *self)
-{
-  /* generously guess that each ChannelManager has about 2 ChannelClasses */
-  GPtrArray *details = g_ptr_array_sized_new (self->channel_managers->len * 2);
-  guint i;
-
-  for (i = 0; i < self->channel_managers->len; i++)
-    {
-      SalutChannelManager *manager = SALUT_CHANNEL_MANAGER (
-          g_ptr_array_index (self->channel_managers, i));
-
-      salut_channel_manager_foreach_channel_class (manager,
-          get_requestables_foreach, details);
-    }
-
-  return details;
-}
-
-
-void
-salut_conn_requests_get_dbus_property (GObject *object,
-                                        GQuark interface,
-                                        GQuark name,
-                                        GValue *value,
-                                        gpointer unused G_GNUC_UNUSED)
-{
-  SalutConnection *self = SALUT_CONNECTION (object);
-
-  g_return_if_fail (interface ==
-      SALUT_IFACE_QUARK_CONNECTION_INTERFACE_REQUESTS);
-
-  if (name == g_quark_from_static_string ("Channels"))
-    {
-      g_value_take_boxed (value, conn_requests_get_channel_details (self));
-    }
-  else if (name == g_quark_from_static_string ("RequestableChannelClasses"))
-    {
-      g_value_take_boxed (value, conn_requests_get_requestables (self));
-    }
-  else
-    {
-      g_return_if_reached ();
-    }
-}
-
-
-static void
-conn_requests_requestotron (SalutConnection *self,
-                            GHashTable *requested_properties,
-                            ChannelRequestMethod method,
-                            DBusGMethodInvocation *context)
-{
-  TpBaseConnection *base_conn = (TpBaseConnection *) self;
-  TpHandleRepoIface *handles;
-  guint i;
-  ChannelRequest *request = NULL;
-  GHashTable *altered_properties = NULL;
-  const gchar *type;
-  SalutChannelManagerRequestFunc func;
-  gboolean suppress_handler;
-  TpHandleType target_handle_type;
-  TpHandle target_handle;
-  GValue *target_handle_value = NULL;
-  const gchar *target_id;
-  gboolean valid;
-
-  TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base_conn, context);
-
-  type = tp_asv_get_string (requested_properties,
-        TP_IFACE_CHANNEL ".ChannelType");
-
-  if (type == NULL)
-    {
-      GError e = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-          "ChannelType is required" };
-
-      dbus_g_method_return_error (context, &e);
-      goto out;
-    }
-
-  target_handle_type = tp_asv_get_uint32 (requested_properties,
-      TP_IFACE_CHANNEL ".TargetHandleType", &valid);
-
-  /* Allow it to be missing, but not to be otherwise broken */
-  if (!valid && tp_asv_lookup (requested_properties,
-          TP_IFACE_CHANNEL ".TargetHandleType") != NULL)
-    {
-      GError e = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-          "TargetHandleType must be an integer in range 0 to 2**32-1" };
-
-      dbus_g_method_return_error (context, &e);
-      goto out;
-    }
-
-  target_handle = tp_asv_get_uint32 (requested_properties,
-      TP_IFACE_CHANNEL ".TargetHandle", &valid);
-
-  /* Allow it to be missing, but not to be otherwise broken */
-  if (!valid && tp_asv_lookup (requested_properties,
-          TP_IFACE_CHANNEL ".TargetHandle") != NULL)
-    {
-      GError e = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-          "TargetHandle must be an integer in range 0 to 2**32-1" };
-
-      dbus_g_method_return_error (context, &e);
-      goto out;
-    }
-
-  target_id = tp_asv_get_string (requested_properties,
-      TP_IFACE_CHANNEL ".TargetID");
-
-  /* Handle type 0 cannot have a handle */
-  if (target_handle_type == TP_HANDLE_TYPE_NONE && target_handle != 0)
-    {
-      GError e = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-          "When TargetHandleType is NONE, TargetHandle must be omitted or 0" };
-
-      dbus_g_method_return_error (context, &e);
-      goto out;
-    }
-
-  /* Handle type 0 cannot have a target id */
-  if (target_handle_type == TP_HANDLE_TYPE_NONE && target_id != NULL)
-    {
-      GError e = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-          "When TargetHandleType is NONE, TargetID must be omitted" };
-
-      dbus_g_method_return_error (context, &e);
-      goto out;
-    }
-
-  /* FIXME: when InitiatorHandle, InitiatorID and Requested are officially
-   * supported, if the request has any of them, raise an error */
-
-  if (target_handle_type != TP_HANDLE_TYPE_NONE)
-    {
-      GError *error = NULL;
-
-      if ((target_handle == 0 && target_id == NULL) ||
-          (target_handle != 0 && target_id != NULL))
-        {
-          GError e = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-            "Exactly one of TargetHandle and TargetID must be supplied" };
-
-          dbus_g_method_return_error (context, &e);
-          goto out;
-        }
-
-      handles = tp_base_connection_get_handles (base_conn, target_handle_type);
-
-      if (target_handle == 0)
-        {
-          /* Turn TargetID into TargetHandle */
-          GValue *target_handle_value;
-
-          target_handle = tp_handle_ensure (handles, target_id, NULL, &error);
-
-          if (target_handle == 0)
-            {
-              dbus_g_method_return_error (context, error);
-              g_error_free (error);
-              goto out;
-            }
-
-          altered_properties = g_hash_table_new_full (g_str_hash, g_str_equal,
-              NULL, NULL);
-          tp_g_hash_table_update (altered_properties, requested_properties,
-              NULL, NULL);
-
-          target_handle_value = tp_g_value_slice_new (G_TYPE_UINT);
-          g_value_set_uint (target_handle_value, target_handle);
-          g_hash_table_insert (altered_properties,
-              TP_IFACE_CHANNEL ".TargetHandle", target_handle_value);
-
-          g_hash_table_remove (altered_properties,
-              TP_IFACE_CHANNEL ".TargetID");
-
-          requested_properties = altered_properties;
-        }
-      else
-        {
-          /* Check the supplied TargetHandle is valid */
-          if (!tp_handle_is_valid (handles, target_handle, &error))
-            {
-              dbus_g_method_return_error (context, error);
-              g_error_free (error);
-              goto out;
-            }
-
-          tp_handle_ref (handles, target_handle);
-        }
-    }
-
-
-  switch (method)
-    {
-    case METHOD_CREATE_CHANNEL:
-      func = salut_channel_manager_create_channel;
-      suppress_handler = TRUE;
-      break;
-
-#if 0
-    case METHOD_ENSURE_CHANNEL:
-      func = salut_channel_manager_ensure_channel;
-      suppress_handler = FALSE;
-      break;
-#endif
-
-    default:
-      g_assert_not_reached ();
-    }
-
-  request = channel_request_new (context, method,
-      type, target_handle_type, target_handle, suppress_handler);
-  g_ptr_array_add (self->channel_requests, request);
-
-  for (i = 0; i < self->channel_managers->len; i++)
-    {
-      SalutChannelManager *manager = SALUT_CHANNEL_MANAGER (
-          g_ptr_array_index (self->channel_managers, i));
-
-      if (func (manager, request, requested_properties))
-        goto out;
-    }
-
-  /* Nobody accepted the request */
-  tp_dbus_g_method_return_not_implemented (context);
-
-  request->context = NULL;
-  g_ptr_array_remove (self->channel_requests, request);
-  channel_request_free (request);
-
-
-out:
-  if (target_handle != 0)
-    tp_handle_unref (handles, target_handle);
-  if (altered_properties != NULL)
-    g_hash_table_destroy (altered_properties);
-  if (target_handle_value != NULL)
-    tp_g_value_slice_free (target_handle_value);
-
-  return;
-}
-
-
-static void
-conn_requests_create_channel (SalutSvcConnectionInterfaceRequests *svc,
-                              GHashTable *requested_properties,
-                              DBusGMethodInvocation *context)
-{
-  SalutConnection *self = SALUT_CONNECTION (svc);
-
-  return conn_requests_requestotron (self, requested_properties,
-      METHOD_CREATE_CHANNEL, context);
-}
-
-
-#if 0
-static void
-conn_requests_ensure_channel (SalutSvcConnectionInterfaceRequests *svc,
-                              GHashTable *requested_properties,
-                              DBusGMethodInvocation *context)
-{
-  SalutConnection *self = SALUT_CONNECTION (svc);
-
-  return conn_requests_requestotron (self, requested_properties,
-      METHOD_ENSURE_CHANNEL, context);
-}
-#endif
-
-
-/* Initialization and glue */
-
-
-static void
-manager_new_channel (gpointer key,
-                     gpointer value,
-                     gpointer data)
-{
-  SalutExportableChannel *channel = SALUT_EXPORTABLE_CHANNEL (key);
-  GSList *request_tokens = value;
-  SalutConnection *self = SALUT_CONNECTION (data);
-  gchar *object_path, *channel_type;
-  guint handle_type, handle;
-  GSList *iter;
-  gboolean suppress_handler = FALSE;
-
-  exportable_channel_get_old_info (channel, &object_path, &channel_type,
-      &handle_type, &handle);
-
-  for (iter = request_tokens; iter != NULL; iter = iter->next)
-    {
-      ChannelRequest *request = iter->data;
-
-      if (request->suppress_handler)
-        {
-          suppress_handler = TRUE;
-          break;
-        }
-    }
-
-  tp_svc_connection_emit_new_channel (self, object_path, channel_type,
-      handle_type, handle, suppress_handler);
-
-  for (iter = request_tokens; iter != NULL; iter = iter->next)
-    {
-      satisfy_request (self, iter->data, G_OBJECT (channel),
-          object_path);
-    }
-
-  g_free (object_path);
-  g_free (channel_type);
-}
-
-
-static void
-manager_new_channels_foreach (gpointer key,
-                              gpointer value,
-                              gpointer data)
-{
-  GPtrArray *details = data;
-
-  g_ptr_array_add (details, get_channel_details (G_OBJECT (key)));
-}
-
-
-static void
-manager_new_channels_cb (SalutChannelManager *manager,
-                         GHashTable *channels,
-                         SalutConnection *self)
-{
-  GPtrArray *array;
-
-  g_assert (SALUT_IS_CHANNEL_MANAGER (manager));
-  g_assert (SALUT_IS_CONNECTION (self));
-
-  array = g_ptr_array_sized_new (g_hash_table_size (channels));
-  g_hash_table_foreach (channels, manager_new_channels_foreach, array);
-  salut_svc_connection_interface_requests_emit_new_channels (self,
-      array);
-  g_ptr_array_foreach (array, (GFunc) g_value_array_free, NULL);
-  g_ptr_array_free (array, TRUE);
-
-  g_hash_table_foreach (channels, manager_new_channel, self);
-}
-
-
-static void
-manager_request_already_satisfied_cb (SalutChannelManager *manager,
-                                      gpointer request_token,
-                                      SalutExportableChannel *channel,
-                                      SalutConnection *self)
-{
-  gchar *object_path;
-
-  g_assert (SALUT_IS_CHANNEL_MANAGER (manager));
-  g_assert (SALUT_IS_EXPORTABLE_CHANNEL (channel));
-  g_assert (SALUT_IS_CONNECTION (self));
-
-  g_object_get (channel,
-      "object-path", &object_path,
-      NULL);
-
-  satisfy_request (self, request_token, G_OBJECT (channel), object_path);
-  g_free (object_path);
-}
-
-
-static void
-manager_request_failed_cb (SalutChannelManager *manager,
-                           gpointer request_token,
-                           guint domain,
-                           gint code,
-                           gchar *message,
-                           SalutConnection *self)
-{
-  GError error = { domain, code, message };
-
-  g_assert (SALUT_IS_CHANNEL_MANAGER (manager));
-  g_assert (domain > 0);
-  g_assert (message != NULL);
-  g_assert (SALUT_IS_CONNECTION (self));
-
-  fail_channel_request (self, request_token, &error);
-}
-
-
-static void
-manager_channel_closed_cb (SalutChannelManager *manager,
-                           const gchar *path,
-                           SalutConnection *self)
-{
-  g_assert (SALUT_IS_CHANNEL_MANAGER (manager));
-  g_assert (path != NULL);
-  g_assert (SALUT_IS_CONNECTION (self));
-
-  salut_svc_connection_interface_requests_emit_channel_closed (self, path);
-}
-
-
-void
-salut_conn_requests_init (SalutConnection *self)
-{
-  guint i;
-
-  g_signal_connect (self, "status-changed",
-      (GCallback) connection_status_changed, NULL);
-
-  self->channel_requests = g_ptr_array_new ();
-
-  g_assert (self->channel_factories != NULL);
-  g_assert (self->channel_managers != NULL);
-
-  for (i = 0; i < self->channel_factories->len; i++)
-    {
-      GObject *factory = g_ptr_array_index (self->channel_factories, i);
-
-      g_assert (TP_IS_CHANNEL_FACTORY_IFACE (factory));
-
-      g_signal_connect (factory, "new-channel",
-          (GCallback) connection_new_channel_cb, self);
-      g_signal_connect (factory, "channel-error",
-          (GCallback) connection_channel_error_cb, self);
-
-    }
-
-  for (i = 0; i < self->channel_managers->len; i++)
-    {
-      SalutChannelManager *manager = SALUT_CHANNEL_MANAGER (
-          g_ptr_array_index (self->channel_managers, i));
-
-      g_signal_connect (manager, "new-channels",
-          (GCallback) manager_new_channels_cb, self);
-      g_signal_connect (manager, "request-already-satisfied",
-          (GCallback) manager_request_already_satisfied_cb, self);
-      g_signal_connect (manager, "request-failed",
-          (GCallback) manager_request_failed_cb, self);
-      g_signal_connect (manager, "channel-closed",
-          (GCallback) manager_channel_closed_cb, self);
-    }
-}
-
-
-void
-salut_conn_requests_dispose (SalutConnection *self)
-{
-  if (self->channel_factories != NULL)
-    {
-      g_ptr_array_foreach (self->channel_factories, (GFunc) g_object_unref,
-          NULL);
-      g_ptr_array_free (self->channel_factories, TRUE);
-      self->channel_factories = NULL;
-    }
-
-  if (self->channel_managers != NULL)
-    {
-      g_ptr_array_foreach (self->channel_managers, (GFunc) g_object_unref,
-          NULL);
-      g_ptr_array_free (self->channel_managers, TRUE);
-      self->channel_managers = NULL;
-    }
-
-  if (self->channel_requests != NULL)
-    {
-      g_assert (self->channel_requests->len == 0);
-      g_ptr_array_free (self->channel_requests, TRUE);
-      self->channel_requests = NULL;
-    }
-}
-
-
-void
-salut_conn_requests_conn_iface_init (gpointer g_iface,
-                                     gpointer iface_data G_GNUC_UNUSED)
-{
-  TpSvcConnectionClass *klass = g_iface;
-
-#define IMPLEMENT(x) tp_svc_connection_implement_##x (klass, \
-    conn_requests_##x)
-  IMPLEMENT(list_channels);
-  IMPLEMENT(request_channel);
-#undef IMPLEMENT
-}
-
-
-void
-salut_conn_requests_iface_init (gpointer g_iface,
-                                gpointer iface_data G_GNUC_UNUSED)
-{
-  SalutSvcConnectionInterfaceRequestsClass *iface = g_iface;
-
-#define IMPLEMENT(x) \
-    salut_svc_connection_interface_requests_implement_##x (\
-        iface, conn_requests_##x)
-  IMPLEMENT (create_channel);
-#undef IMPLEMENT
-}
diff --git a/src/conn-requests.h b/src/conn-requests.h
deleted file mode 100644
index 096ef56..0000000
--- a/src/conn-requests.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* SalutConnection Requests (requestotron) implementation
- *
- * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef SALUT_CONN_REQUESTS_H
-#define SALUT_CONN_REQUESTS_H
-
-#include <glib.h>
-
-#include "salut-connection.h"
-
-G_BEGIN_DECLS
-
-void salut_conn_requests_get_dbus_property (GObject *object,
-    GQuark interface, GQuark name, GValue *value, gpointer unused);
-
-void salut_conn_requests_init (SalutConnection *self);
-void salut_conn_requests_dispose (SalutConnection *self);
-void salut_conn_requests_iface_init (gpointer, gpointer);
-void salut_conn_requests_conn_iface_init (gpointer, gpointer);
-
-G_END_DECLS
-
-#endif
-
diff --git a/src/exportable-channel.c b/src/exportable-channel.c
deleted file mode 100644
index e4e812c..0000000
--- a/src/exportable-channel.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * exportable-channel.c - A channel usable with the Channel Manager
- *
- * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include "config.h"
-#include "exportable-channel.h"
-
-#include <telepathy-glib/gtypes.h>
-#include <telepathy-glib/svc-channel.h>
-#include <telepathy-glib/util.h>
-
-
-static void
-exportable_channel_base_init (gpointer klass)
-{
-  static gboolean initialized = FALSE;
-
-  if (!initialized)
-    {
-      GParamSpec *param_spec;
-
-      initialized = TRUE;
-
-      /**
-       * SalutExportableChannel:object-path:
-       *
-       * The D-Bus object path used for this object on the bus. Read-only
-       * except during construction.
-       */
-      param_spec = g_param_spec_string ("object-path", "D-Bus object path",
-          "The D-Bus object path used for this object on the bus.", NULL,
-          G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
-          G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK);
-      g_object_interface_install_property (klass, param_spec);
-
-      /**
-       * SalutExportableChannel:channel-properties:
-       *
-       * The D-Bus properties to be announced in the NewChannels signal
-       * and in the Channels property, as a map from
-       * inter.face.name.propertyname to GValue.
-       *
-       * This can only change when the closed signal is emitted.
-       */
-      param_spec = g_param_spec_boxed ("channel-properties",
-          "Channel properties",
-          "The channel properties",
-          TP_HASH_TYPE_QUALIFIED_PROPERTY_VALUE_MAP,
-          G_PARAM_READABLE |
-          G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK);
-      g_object_interface_install_property (klass, param_spec);
-
-      /**
-       * SalutExportableChannel:channel-destroyed:
-       *
-       * If true, the closed signal on the Channel interface indicates that
-       * the channel can go away.
-       *
-       * If false, the closed signal indicates that the channel should
-       * appear to go away and be re-created.
-       */
-      param_spec = g_param_spec_boolean ("channel-destroyed",
-          "Destroyed?",
-          "If true, the channel has *really* closed, rather than just "
-          "appearing to do so",
-          FALSE,
-          G_PARAM_READABLE |
-          G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK);
-      g_object_interface_install_property (klass, param_spec);
-    }
-}
-
-GType
-salut_exportable_channel_get_type (void)
-{
-  static GType type = 0;
-
-  if (G_UNLIKELY (type == 0))
-    {
-      static const GTypeInfo info = {
-        sizeof (SalutExportableChannelIface),
-        exportable_channel_base_init,   /* base_init */
-        NULL,   /* base_finalize */
-        NULL,   /* class_init */
-        NULL,   /* class_finalize */
-        NULL,   /* class_data */
-        0,
-        0,      /* n_preallocs */
-        NULL    /* instance_init */
-      };
-
-      type = g_type_register_static (G_TYPE_INTERFACE,
-          "SalutExportableChannel", &info, 0);
-
-      g_type_interface_add_prerequisite (type, TP_TYPE_SVC_CHANNEL);
-    }
-
-  return type;
-}
-
-GHashTable *
-salut_tp_dbus_properties_mixin_make_properties_hash (
-    GObject *object,
-    const gchar *first_interface,
-    const gchar *first_property,
-    ...)
-{
-  va_list ap;
-  GHashTable *table;
-  const gchar *interface, *property;
-
-  table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
-      (GDestroyNotify) tp_g_value_slice_free);
-
-  va_start (ap, first_property);
-
-  for (interface = first_interface, property = first_property;
-       interface != NULL;
-       interface = va_arg (ap, gchar *), property = va_arg (ap, gchar *))
-    {
-      GValue *value = g_slice_new0 (GValue);
-
-      tp_dbus_properties_mixin_get (object, interface, property,
-            value, NULL);
-      /* Fetching our immutable properties had better not fail... */
-      g_assert (G_IS_VALUE (value));
-
-      g_hash_table_insert (table,
-          g_strdup_printf ("%s.%s", interface, property), value);
-    }
-
-  return table;
-}
diff --git a/src/exportable-channel.h b/src/exportable-channel.h
deleted file mode 100644
index d4f0325..0000000
--- a/src/exportable-channel.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * exportable-channel.h - A channel usable with the Channel Manager
- *
- * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef SALUT_EXPORTABLE_CHANNEL_H
-#define SALUT_EXPORTABLE_CHANNEL_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define SALUT_TYPE_EXPORTABLE_CHANNEL (salut_exportable_channel_get_type ())
-
-#define SALUT_EXPORTABLE_CHANNEL(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-  SALUT_TYPE_EXPORTABLE_CHANNEL, SalutExportableChannel))
-
-#define SALUT_IS_EXPORTABLE_CHANNEL(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-  SALUT_TYPE_EXPORTABLE_CHANNEL))
-
-#define SALUT_EXPORTABLE_CHANNEL_GET_INTERFACE(obj) \
-  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \
-  SALUT_TYPE_EXPORTABLE_CHANNEL, SalutExportableChannelIface))
-
-typedef struct _SalutExportableChannel SalutExportableChannel;
-typedef struct _SalutExportableChannelIface SalutExportableChannelIface;
-
-typedef void (*SalutExportableChannelFunc) (SalutExportableChannel *channel,
-    gpointer user_data);
-
-struct _SalutExportableChannelIface {
-    GTypeInterface parent;
-};
-
-GType salut_exportable_channel_get_type (void);
-
-GHashTable *salut_tp_dbus_properties_mixin_make_properties_hash (
-    GObject *object, const gchar *first_interface,
-    const gchar *first_property, ...) G_GNUC_NULL_TERMINATED;
-
-G_END_DECLS
-
-#endif
diff --git a/src/salut-connection.c b/src/salut-connection.c
index eaeb422..3f3fea1 100644
--- a/src/salut-connection.c
+++ b/src/salut-connection.c
@@ -32,8 +32,6 @@
 
 #include "salut-connection.h"
 
-#include "channel-manager.h"
-#include "conn-requests.h"
 #include "salut-util.h"
 #include "salut-contact-manager.h"
 #include "salut-contact-channel.h"
@@ -58,6 +56,7 @@
 
 #include <extensions/extensions.h>
 
+#include <telepathy-glib/channel-manager.h>
 #include <telepathy-glib/util.h>
 #include <telepathy-glib/dbus.h>
 #include <telepathy-glib/handle-repo-dynamic.h>
@@ -101,8 +100,6 @@ salut_connection_avatar_service_iface_init (gpointer g_iface,
 G_DEFINE_TYPE_WITH_CODE(SalutConnection,
     salut_connection,
     TP_TYPE_BASE_CONNECTION,
-    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION,
-      salut_conn_requests_conn_iface_init);
     G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_ALIASING,
         salut_connection_aliasing_service_iface_init);
     G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_PRESENCE,
@@ -115,8 +112,8 @@ G_DEFINE_TYPE_WITH_CODE(SalutConnection,
        tp_presence_mixin_simple_presence_iface_init);
     G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_AVATARS,
        salut_connection_avatar_service_iface_init);
-    G_IMPLEMENT_INTERFACE (SALUT_TYPE_SVC_CONNECTION_INTERFACE_REQUESTS,
-       salut_conn_requests_iface_init);
+    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_REQUESTS,
+       tp_base_connection_requests_iface_init);
 #ifdef ENABLE_OLPC
     G_IMPLEMENT_INTERFACE (SALUT_TYPE_SVC_OLPC_BUDDY_INFO,
        salut_connection_olpc_buddy_info_iface_init);
@@ -230,6 +227,9 @@ salut_connection_create_handle_repos (TpBaseConnection *self,
 static GPtrArray *
 salut_connection_create_channel_factories (TpBaseConnection *self);
 
+static GPtrArray *
+salut_connection_create_channel_managers (TpBaseConnection *self);
+
 static gchar *
 salut_connection_get_unique_connection_name (TpBaseConnection *self);
 
@@ -301,8 +301,6 @@ salut_connection_constructor (GType type,
       TP_IFACE_CONNECTION_INTERFACE_ALIASING,
       salut_connection_aliasing_fill_contact_attributes);
 
-  salut_conn_requests_init (SALUT_CONNECTION (obj));
-
   return obj;
 }
 
@@ -590,19 +588,6 @@ set_own_status (GObject *obj,
 static void
 salut_connection_class_init (SalutConnectionClass *salut_connection_class)
 {
-  static TpDBusPropertiesMixinPropImpl requests_props[] = {
-        { "Channels", NULL, NULL },
-        { "RequestableChannelClasses", NULL, NULL },
-        { NULL }
-  };
-  static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
-        { SALUT_IFACE_CONNECTION_INTERFACE_REQUESTS,
-          salut_conn_requests_get_dbus_property,
-          NULL,
-          requests_props,
-        },
-        { NULL }
-  };
   GObjectClass *object_class = G_OBJECT_CLASS (salut_connection_class);
   TpBaseConnectionClass *tp_connection_class =
       TP_BASE_CONNECTION_CLASS(salut_connection_class);
@@ -613,6 +598,7 @@ salut_connection_class_init (SalutConnectionClass *salut_connection_class)
     TP_IFACE_CONNECTION_INTERFACE_CONTACTS,
     TP_IFACE_CONNECTION_INTERFACE_PRESENCE,
     TP_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE,
+    TP_IFACE_CONNECTION_INTERFACE_REQUESTS,
 #ifdef ENABLE_OLPC
     SALUT_IFACE_OLPC_BUDDY_INFO,
     SALUT_IFACE_OLPC_ACTIVITY_PROPERTIES,
@@ -634,6 +620,8 @@ salut_connection_class_init (SalutConnectionClass *salut_connection_class)
       salut_connection_create_handle_repos;
   tp_connection_class->create_channel_factories =
       salut_connection_create_channel_factories;
+  tp_connection_class->create_channel_managers =
+      salut_connection_create_channel_managers;
   tp_connection_class->get_unique_connection_name =
       salut_connection_get_unique_connection_name;
   tp_connection_class->shut_down =
@@ -642,10 +630,12 @@ salut_connection_class_init (SalutConnectionClass *salut_connection_class)
       salut_connection_start_connecting;
   tp_connection_class->interfaces_always_present = interfaces;
 
-  salut_connection_class->properties_mixin.interfaces = prop_interfaces;
+  salut_connection_class->properties_mixin.interfaces = NULL;
   tp_dbus_properties_mixin_class_init (object_class,
       G_STRUCT_OFFSET (SalutConnectionClass, properties_mixin));
 
+  tp_base_connection_register_requests_dbus_properties (object_class);
+
   tp_presence_mixin_class_init (object_class,
       G_STRUCT_OFFSET (SalutConnectionClass, presence_mixin),
       is_presence_status_available, get_contact_statuses, set_own_status,
@@ -830,8 +820,6 @@ salut_connection_dispose (GObject *object)
       priv->bytestream_manager = NULL;
     }
 
-  salut_conn_requests_dispose (self);
-
   /* release any references held by the object here */
   if (G_OBJECT_CLASS (salut_connection_parent_class)->dispose)
     G_OBJECT_CLASS (salut_connection_parent_class)->dispose (object);
@@ -2828,9 +2816,6 @@ salut_connection_create_channel_factories (TpBaseConnection *base)
       G_CALLBACK (_olpc_activity_manager_activity_modified_cb), self);
 #endif
 
-  priv->im_manager = salut_im_manager_new (self, priv->contact_manager,
-      priv->xmpp_connection_manager);
-
   priv->muc_manager = salut_discovery_client_create_muc_manager (
       priv->discovery_client, self, priv->xmpp_connection_manager);
 
@@ -2844,14 +2829,30 @@ salut_connection_create_channel_factories (TpBaseConnection *base)
   g_ptr_array_add (factories, priv->tubes_manager);
   */
 
-  self->channel_managers = g_ptr_array_sized_new (1);
-  g_ptr_array_add (self->channel_managers, priv->im_manager);
+  return factories;
+}
+
+
+static GPtrArray *
+salut_connection_create_channel_managers (TpBaseConnection *base)
+{
+  SalutConnection *self = SALUT_CONNECTION (base);
+  SalutConnectionPrivate *priv = SALUT_CONNECTION_GET_PRIVATE (self);
+  GPtrArray *managers = g_ptr_array_sized_new (1);
 
-  /* Temporary hack for requestotron support */
-  self->channel_factories = factories;
-  return g_ptr_array_sized_new (0);
+  /* FIXME: The second and third arguments depend on create_channel_factories
+   *        being called before this; should telepathy-glib guarantee that or
+   *        should we be defensive?
+   */
+  priv->im_manager = salut_im_manager_new (self, priv->contact_manager,
+      priv->xmpp_connection_manager);
+
+  g_ptr_array_add (managers, priv->im_manager);
+
+  return managers;
 }
 
+
 static gchar *
 salut_connection_get_unique_connection_name (TpBaseConnection *base)
 {
diff --git a/src/salut-connection.h b/src/salut-connection.h
index a277f38..f581ea4 100644
--- a/src/salut-connection.h
+++ b/src/salut-connection.h
@@ -55,12 +55,6 @@ struct _SalutConnection {
   /* Our name on the network */
   gchar *name;
 
-  /* temporary, for requestotron support */
-  GPtrArray *channel_factories;
-  GPtrArray *channel_managers;
-  GPtrArray *channel_requests;
-  gboolean has_tried_connection;
-
   gpointer priv;
 };
 
diff --git a/src/salut-im-channel.c b/src/salut-im-channel.c
index 4a58433..ea4cf2b 100644
--- a/src/salut-im-channel.c
+++ b/src/salut-im-channel.c
@@ -30,6 +30,7 @@
 #include <dbus/dbus-glib.h>
 #include <telepathy-glib/channel-iface.h>
 #include <telepathy-glib/dbus.h>
+#include <telepathy-glib/exportable-channel.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/svc-generic.h>
 #include <telepathy-glib/text-mixin.h>
@@ -43,7 +44,6 @@
 
 #define DEBUG_FLAG DEBUG_IM
 #include "debug.h"
-#include "exportable-channel.h"
 #include "salut-connection.h"
 #include "salut-contact.h"
 #include "salut-xmpp-connection-manager.h"
@@ -65,7 +65,7 @@ G_DEFINE_TYPE_WITH_CODE (SalutImChannel, salut_im_channel, G_TYPE_OBJECT,
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL, channel_iface_init);
     G_IMPLEMENT_INTERFACE (SALUT_TYPE_SVC_CHANNEL_FUTURE, NULL);
     G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_IFACE, NULL);
-    G_IMPLEMENT_INTERFACE (SALUT_TYPE_EXPORTABLE_CHANNEL, NULL);
+    G_IMPLEMENT_INTERFACE (TP_TYPE_EXPORTABLE_CHANNEL, NULL);
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_TEXT, text_iface_init);
 );
 
@@ -280,7 +280,7 @@ salut_im_channel_get_property (GObject *object,
         break;
       case PROP_CHANNEL_PROPERTIES:
         g_value_set_boxed (value,
-            salut_tp_dbus_properties_mixin_make_properties_hash (object,
+            tp_dbus_properties_mixin_make_properties_hash (object,
                 TP_IFACE_CHANNEL, "TargetHandle",
                 TP_IFACE_CHANNEL, "TargetHandleType",
                 TP_IFACE_CHANNEL, "ChannelType",
diff --git a/src/salut-im-manager.c b/src/salut-im-manager.c
index a8449be..19f4599 100644
--- a/src/salut-im-manager.c
+++ b/src/salut-im-manager.c
@@ -21,8 +21,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "channel-manager.h"
-#include "exportable-channel.h"
 #include "salut-im-channel.h"
 #include "salut-im-manager.h"
 #include "salut-contact.h"
@@ -33,6 +31,7 @@
 #include <gibber/gibber-xmpp-stanza.h>
 #include <gibber/gibber-namespaces.h>
 
+#include <telepathy-glib/channel-manager.h>
 #include <telepathy-glib/dbus.h>
 #include <telepathy-glib/interfaces.h>
 
@@ -47,7 +46,7 @@ salut_im_manager_new_channel (SalutImManager *mgr, TpHandle handle,
     TpHandle initiator, gpointer request);
 
 G_DEFINE_TYPE_WITH_CODE (SalutImManager, salut_im_manager, G_TYPE_OBJECT,
-    G_IMPLEMENT_INTERFACE (SALUT_TYPE_CHANNEL_MANAGER,
+    G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_MANAGER,
       salut_im_manager_channel_manager_iface_init));
 
 /* private structure */
@@ -215,7 +214,7 @@ salut_im_manager_finalize (GObject *object)
 
 struct foreach_data
 {
-  SalutExportableChannelFunc func;
+  TpExportableChannelFunc func;
   gpointer data;
 };
 
@@ -224,15 +223,15 @@ salut_im_manager_iface_foreach_one (gpointer key,
                                     gpointer value,
                                     gpointer data)
 {
-  SalutExportableChannel *chan = SALUT_EXPORTABLE_CHANNEL (value);
+  TpExportableChannel *chan = TP_EXPORTABLE_CHANNEL (value);
   struct foreach_data *f = (struct foreach_data *) data;
 
   f->func (chan, f->data);
 }
 
 void
-salut_im_manager_foreach_channel (SalutChannelManager *iface,
-                                  SalutExportableChannelFunc func,
+salut_im_manager_foreach_channel (TpChannelManager *iface,
+                                  TpExportableChannelFunc func,
                                   gpointer user_data)
 {
   SalutImManager *mgr = SALUT_IM_MANAGER (iface);
@@ -260,8 +259,8 @@ static const gchar * const im_channel_allowed_properties[] = {
 };
 
 static void
-salut_im_manager_foreach_channel_class (SalutChannelManager *manager,
-    SalutChannelManagerChannelClassFunc func,
+salut_im_manager_foreach_channel_class (TpChannelManager *manager,
+    TpChannelManagerChannelClassFunc func,
     gpointer user_data)
 {
   GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -296,7 +295,7 @@ salut_im_manager_requestotron (SalutImManager *self,
       base_conn, TP_HANDLE_TYPE_CONTACT);
   TpHandle handle;
   GError *error = NULL;
-  SalutExportableChannel *channel;
+  TpExportableChannel *channel;
 
   if (tp_strdiff (tp_asv_get_string (request_properties,
           TP_IFACE_CHANNEL ".ChannelType"), TP_IFACE_CHANNEL_TYPE_TEXT))
@@ -313,7 +312,7 @@ salut_im_manager_requestotron (SalutImManager *self,
     goto error;
 
   /* Check if there are any other properties that we don't understand */
-  if (salut_channel_manager_asv_has_unknown_properties (request_properties,
+  if (tp_channel_manager_asv_has_unknown_properties (request_properties,
           im_channel_fixed_properties, im_channel_allowed_properties,
           &error))
     {
@@ -344,12 +343,12 @@ salut_im_manager_requestotron (SalutImManager *self,
       goto error;
     }
 
-  salut_channel_manager_emit_request_already_satisfied (self, request_token,
+  tp_channel_manager_emit_request_already_satisfied (self, request_token,
       channel);
   return TRUE;
 
 error:
-  salut_channel_manager_emit_request_failed (self, request_token,
+  tp_channel_manager_emit_request_failed (self, request_token,
       error->domain, error->code, error->message);
   g_error_free (error);
   return TRUE;
@@ -357,7 +356,7 @@ error:
 
 
 static gboolean
-salut_im_manager_create_channel (SalutChannelManager *manager,
+salut_im_manager_create_channel (TpChannelManager *manager,
                                  gpointer request_token,
                                  GHashTable *request_properties)
 {
@@ -369,7 +368,7 @@ salut_im_manager_create_channel (SalutChannelManager *manager,
 
 
 static gboolean
-salut_im_manager_request_channel (SalutChannelManager *manager,
+salut_im_manager_request_channel (TpChannelManager *manager,
                                   gpointer request_token,
                                   GHashTable *request_properties)
 {
@@ -384,7 +383,7 @@ static void
 salut_im_manager_channel_manager_iface_init (gpointer g_iface,
                                              gpointer iface_data)
 {
-  SalutChannelManagerIface *iface = g_iface;
+  TpChannelManagerIface *iface = g_iface;
 
   iface->foreach_channel = salut_im_manager_foreach_channel;
   iface->foreach_channel_class = salut_im_manager_foreach_channel_class;
@@ -402,8 +401,8 @@ im_channel_closed_cb (SalutImChannel *chan,
   SalutImManagerPrivate *priv = SALUT_IM_MANAGER_GET_PRIVATE (self);
   TpHandle handle;
 
-  salut_channel_manager_emit_channel_closed_for_object (self,
-    SALUT_EXPORTABLE_CHANNEL (chan));
+  tp_channel_manager_emit_channel_closed_for_object (self,
+    TP_EXPORTABLE_CHANNEL (chan));
 
   if (priv->channels)
     {
@@ -439,7 +438,7 @@ salut_im_manager_new_channel (SalutImManager *mgr,
   if (contact == NULL)
     {
       gchar *message = g_strdup_printf ("%s is not online", name);
-      salut_channel_manager_emit_request_failed (mgr, request, TP_ERRORS,
+      tp_channel_manager_emit_request_failed (mgr, request, TP_ERRORS,
           TP_ERROR_NOT_AVAILABLE, message);
       g_free (message);
       return NULL;
@@ -462,7 +461,7 @@ salut_im_manager_new_channel (SalutImManager *mgr,
   if (request != NULL)
     requests = g_slist_prepend (requests, request);
 
-  salut_channel_manager_emit_new_channel (mgr, SALUT_EXPORTABLE_CHANNEL (chan),
+  tp_channel_manager_emit_new_channel (mgr, TP_EXPORTABLE_CHANNEL (chan),
     requests);
 
   g_signal_connect (chan, "closed", G_CALLBACK (im_channel_closed_cb), mgr);
-- 
1.5.6.5




More information about the Telepathy-commits mailing list