diff options
100 files changed, 480 insertions, 784 deletions
| diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt index 69a37448a..5f278ff7c 100644 --- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt @@ -47,7 +47,7 @@ TpBaseConnectionProc  TpBaseConnectionStartConnectingImpl  tp_base_connection_get_bus_name  tp_base_connection_get_object_path -tp_base_connection_get_dbus_daemon +tp_base_connection_get_dbus_connection  tp_base_connection_register  tp_base_connection_get_handles  tp_base_connection_get_self_handle @@ -98,7 +98,7 @@ TpBaseConnectionManager  TpBaseConnectionManagerClass  TpBaseConnectionManagerNewConnFunc  TpBaseConnectionManagerGetInterfacesFunc -tp_base_connection_manager_get_dbus_daemon +tp_base_connection_manager_get_dbus_connection  tp_base_connection_manager_register  tp_base_connection_manager_add_protocol  <SUBSECTION Standard> @@ -2906,7 +2906,6 @@ tp_proxy_pending_call_cancel  TpProxySignalConnection  tp_proxy_signal_connection_disconnect  tp_proxy_get_factory -tp_proxy_get_dbus_daemon  tp_proxy_get_dbus_connection  tp_proxy_get_bus_name  tp_proxy_get_object_path @@ -4535,7 +4534,7 @@ tp_base_client_register  tp_base_client_unregister  tp_base_client_get_bus_name  tp_base_client_get_object_path -tp_base_client_get_dbus_daemon +tp_base_client_get_dbus_connection  tp_base_client_get_name  tp_base_client_get_uniquify_name  <SUBSECTION Standard> @@ -5725,7 +5724,6 @@ tp_client_factory_new  tp_client_factory_dup  tp_client_factory_set_default  tp_client_factory_can_set_default -tp_client_factory_get_dbus_daemon  tp_client_factory_get_dbus_connection  <SUBSECTION>  tp_client_factory_ensure_account_manager diff --git a/examples/client/list-managers.c b/examples/client/list-managers.c index e0cbc6060..442452a28 100644 --- a/examples/client/list-managers.c +++ b/examples/client/list-managers.c @@ -57,15 +57,15 @@ main (int argc,        char **argv)  {    ExampleData data = { g_main_loop_new (NULL, FALSE), 0 }; -  TpDBusDaemon *bus_daemon; +  GDBusConnection *bus_connection;    TpClientFactory *factory;    GError *error = NULL;    tp_debug_set_flags (g_getenv ("EXAMPLE_DEBUG")); -  bus_daemon = tp_dbus_daemon_dup (&error); +  bus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); -  if (bus_daemon == NULL) +  if (bus_connection == NULL)      {        g_warning ("%s", error->message);        g_error_free (error); @@ -73,7 +73,7 @@ main (int argc,        goto out;      } -  factory = tp_client_factory_new (bus_daemon); +  factory = tp_client_factory_new (bus_connection);    tp_list_connection_managers_async (factory,        got_connection_managers, &data);    g_object_unref (factory); @@ -84,8 +84,8 @@ out:    if (data.mainloop != NULL)      g_main_loop_unref (data.mainloop); -  if (bus_daemon != NULL) -    g_object_unref (bus_daemon); +  if (bus_connection != NULL) +    g_object_unref (bus_connection);    return data.exit_code;  } diff --git a/examples/cm/call/call-stream.c b/examples/cm/call/call-stream.c index cc63d5469..38db52823 100644 --- a/examples/cm/call/call-stream.c +++ b/examples/cm/call/call-stream.c @@ -65,7 +65,7 @@ constructed (GObject *object)        ((GObjectClass *) example_call_stream_parent_class)->constructed;    static guint count = 0;    TpBaseConnection *conn; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    gchar *object_path;    TpCallStreamEndpoint *endpoint; @@ -73,7 +73,7 @@ constructed (GObject *object)      chain_up (object);    conn = tp_base_call_stream_get_connection ((TpBaseCallStream *) self); -  dbus = tp_base_connection_get_dbus_daemon (conn); +  dbus = tp_base_connection_get_dbus_connection (conn);    object_path = g_strdup_printf ("%s/Endpoint%d",        tp_base_call_stream_get_object_path ((TpBaseCallStream *) self),        count++); diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c index 1ec8a508a..a5289a594 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -150,7 +150,6 @@ struct _TpAccountChannelRequestPrivate    gulong cancel_id;    TpChannel *channel;    TpHandleChannelContext *handle_context; -  TpDBusDaemon *dbus;    GVariant *hints;    /* TRUE if the channel has been requested (an _async function has been called @@ -210,7 +209,6 @@ tp_account_channel_request_dispose (GObject *object)    tp_clear_object (&self->priv->chan_request);    tp_clear_object (&self->priv->channel);    tp_clear_object (&self->priv->handle_context); -  tp_clear_object (&self->priv->dbus);    tp_clear_pointer (&self->priv->hints, g_variant_unref);    if (self->priv->delegated_channel_destroy != NULL) @@ -321,9 +319,6 @@ tp_account_channel_request_constructed (GObject *object)    g_assert (self->priv->account != NULL);    g_assert (self->priv->request != NULL); -  self->priv->dbus = g_object_ref (tp_proxy_get_dbus_daemon ( -        self->priv->account)); -    self->priv->hints = g_variant_new ("a{sv}", NULL);  } diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c index b84a42a83..f89690c0d 100644 --- a/telepathy-glib/account-manager.c +++ b/telepathy-glib/account-manager.c @@ -501,8 +501,6 @@ _tp_account_manager_constructed (GObject *object)    if (chain_up != NULL)      chain_up (object); -  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL); -    tp_cli_account_manager_connect_to_account_usability_changed (self,        _tp_account_manager_usability_changed_cb, NULL,        NULL, G_OBJECT (self), NULL); diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c index e2f87a6c0..2d920d50b 100644 --- a/telepathy-glib/account.c +++ b/telepathy-glib/account.c @@ -1106,10 +1106,6 @@ _tp_account_constructed (GObject *object)    if (chain_up != NULL)      chain_up (object); -  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL); - -  g_assert (tp_proxy_get_factory (self) != NULL); -    sc = tp_cli_account_connect_to_removed (self, _tp_account_removed_cb,        NULL, NULL, NULL, &error); diff --git a/telepathy-glib/automatic-client-factory.c b/telepathy-glib/automatic-client-factory.c index ab89726ca..167067c36 100644 --- a/telepathy-glib/automatic-client-factory.c +++ b/telepathy-glib/automatic-client-factory.c @@ -269,21 +269,20 @@ tp_automatic_client_factory_class_init (TpAutomaticClientFactoryClass *klass)  /**   * tp_automatic_client_factory_new: - * @dbus: (allow-none): a #TpDBusDaemon, or %NULL + * @dbus_connection: a #GDBusConnection   * - * Returns a new #TpAutomaticClientFactory instance. If @dbus is %NULL then - * tp_dbus_daemon_dup() will be used. + * <!-- -->   *   * Returns: a new #TpAutomaticClientFactory   *   * Since: 0.99.1   */  TpClientFactory * -tp_automatic_client_factory_new (TpDBusDaemon *dbus) +tp_automatic_client_factory_new (GDBusConnection *dbus_connection)  { -  g_return_val_if_fail (dbus == NULL || TP_IS_DBUS_DAEMON (dbus), NULL); +  g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), NULL);    return g_object_new (TP_TYPE_AUTOMATIC_CLIENT_FACTORY, -      "dbus-daemon", dbus, +      "dbus-connection", dbus_connection,        NULL);  } diff --git a/telepathy-glib/automatic-client-factory.h b/telepathy-glib/automatic-client-factory.h index 7099ee198..e925f8c6f 100644 --- a/telepathy-glib/automatic-client-factory.h +++ b/telepathy-glib/automatic-client-factory.h @@ -67,7 +67,7 @@ GType tp_automatic_client_factory_get_type (void);    (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_AUTOMATIC_CLIENT_FACTORY, \                                TpAutomaticClientFactoryClass)) -TpClientFactory *tp_automatic_client_factory_new (TpDBusDaemon *dbus); +TpClientFactory *tp_automatic_client_factory_new (GDBusConnection *dbus_connection);  G_END_DECLS diff --git a/telepathy-glib/base-call-content.c b/telepathy-glib/base-call-content.c index d4f9d2322..3ac45365a 100644 --- a/telepathy-glib/base-call-content.c +++ b/telepathy-glib/base-call-content.c @@ -206,7 +206,7 @@ static void  tp_base_call_content_constructed (GObject *obj)  {    TpBaseCallContent *self = TP_BASE_CALL_CONTENT (obj); -  TpDBusDaemon *bus = tp_base_connection_get_dbus_daemon ( +  GDBusConnection *bus = tp_base_connection_get_dbus_connection (        (TpBaseConnection *) self->priv->conn);    if (G_OBJECT_CLASS (tp_base_call_content_parent_class)->constructed != NULL) @@ -219,7 +219,7 @@ tp_base_call_content_constructed (GObject *obj)  static void  tp_base_call_content_deinit_real (TpBaseCallContent *self)  { -  TpDBusDaemon *bus = tp_base_connection_get_dbus_daemon ( +  GDBusConnection *bus = tp_base_connection_get_dbus_connection (        (TpBaseConnection *) self->priv->conn);    tp_dbus_daemon_unregister_object (bus, G_OBJECT (self)); diff --git a/telepathy-glib/base-call-stream.c b/telepathy-glib/base-call-stream.c index 7bfbe8039..942bba15b 100644 --- a/telepathy-glib/base-call-stream.c +++ b/telepathy-glib/base-call-stream.c @@ -164,7 +164,7 @@ static void  tp_base_call_stream_constructed (GObject *obj)  {    TpBaseCallStream *self = TP_BASE_CALL_STREAM (obj); -  TpDBusDaemon *bus = tp_base_connection_get_dbus_daemon ( +  GDBusConnection *bus = tp_base_connection_get_dbus_connection (        (TpBaseConnection *) self->priv->conn);    if (G_OBJECT_CLASS (tp_base_call_stream_parent_class)->constructed != NULL) @@ -185,7 +185,7 @@ static void  tp_base_call_stream_dispose (GObject *object)  {    TpBaseCallStream *self = TP_BASE_CALL_STREAM (object); -  TpDBusDaemon *bus = tp_base_connection_get_dbus_daemon ( +  GDBusConnection *bus = tp_base_connection_get_dbus_connection (        (TpBaseConnection *) self->priv->conn);    tp_dbus_daemon_unregister_object (bus, G_OBJECT (self)); diff --git a/telepathy-glib/base-channel.c b/telepathy-glib/base-channel.c index e14545e79..4452df790 100644 --- a/telepathy-glib/base-channel.c +++ b/telepathy-glib/base-channel.c @@ -375,7 +375,8 @@ G_DEFINE_TYPE_WITH_CODE (TpBaseChannel, tp_base_channel,  void  tp_base_channel_register (TpBaseChannel *chan)  { -  TpDBusDaemon *bus = tp_base_connection_get_dbus_daemon (chan->priv->conn); +  GDBusConnection *bus = tp_base_connection_get_dbus_connection ( +      chan->priv->conn);    g_assert (chan->priv->object_path != NULL);    g_return_if_fail (!chan->priv->registered); @@ -397,7 +398,8 @@ tp_base_channel_register (TpBaseChannel *chan)  void  tp_base_channel_destroyed (TpBaseChannel *chan)  { -  TpDBusDaemon *bus = tp_base_connection_get_dbus_daemon (chan->priv->conn); +  GDBusConnection *bus = tp_base_connection_get_dbus_connection ( +      chan->priv->conn);    /* Take a ref to ourself: the 'closed' handler might drop its reference on us.     */ @@ -452,7 +454,7 @@ void  tp_base_channel_disappear (TpBaseChannel *chan)  {    TpBaseChannelPrivate *priv = chan->priv; -  TpDBusDaemon *bus = tp_base_connection_get_dbus_daemon (priv->conn); +  GDBusConnection *bus = tp_base_connection_get_dbus_connection (priv->conn);    /* Take a ref to ourself: the 'closed' handler might drop its reference on us.     */ diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c index 5024cb7fc..661fd8e37 100644 --- a/telepathy-glib/base-client.c +++ b/telepathy-glib/base-client.c @@ -213,7 +213,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TpBaseClient, tp_base_client, G_TYPE_OBJECT,        requests_iface_init))  enum { -    PROP_DBUS_DAEMON = 1, +    PROP_DBUS_CONNECTION = 1,      PROP_FACTORY,      PROP_NAME,      PROP_UNIQUIFY_NAME, @@ -241,11 +241,9 @@ typedef enum {  struct _TpBaseClientPrivate  {    TpClientFactory *factory; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    gchar *name;    gboolean uniquify_name; -  /* reffed */ -  GDBusConnection *gdbus;    gboolean registered;    ClientFlags flags; @@ -957,10 +955,7 @@ tp_base_client_register (TpBaseClient *self,      return TRUE;    /* Client is an handler */ -  self->priv->gdbus = g_object_ref ( -      tp_proxy_get_dbus_connection (self->priv->dbus)); - -  clients = g_object_get_qdata (G_OBJECT (self->priv->gdbus), clients_quark ()); +  clients = g_object_get_qdata (G_OBJECT (self->priv->dbus), clients_quark ());    if (clients == NULL)      { @@ -970,7 +965,7 @@ tp_base_client_register (TpBaseClient *self,         * borrowed client path => borrowed (GHashTable *) */        clients = g_hash_table_new (g_str_hash, g_str_equal); -      g_object_set_qdata_full (G_OBJECT (self->priv->gdbus), +      g_object_set_qdata_full (G_OBJECT (self->priv->dbus),            clients_quark (), clients, (GDestroyNotify) g_hash_table_unref);      } @@ -1026,7 +1021,7 @@ tp_base_client_dup_handled_channels (TpBaseClient *self)    set = g_hash_table_new (g_str_hash, g_str_equal); -  clients = g_object_get_qdata (G_OBJECT (self->priv->gdbus), clients_quark ()); +  clients = g_object_get_qdata (G_OBJECT (self->priv->dbus), clients_quark ());    g_hash_table_iter_init (&iter, clients);    while (g_hash_table_iter_next (&iter, NULL, &value)) @@ -1128,7 +1123,7 @@ tp_base_client_get_property (GObject *object,    switch (property_id)      { -      case PROP_DBUS_DAEMON: +      case PROP_DBUS_CONNECTION:          g_value_set_object (value, self->priv->dbus);          break; @@ -1160,7 +1155,7 @@ tp_base_client_set_property (GObject *object,    switch (property_id)      { -      case PROP_DBUS_DAEMON: +      case PROP_DBUS_CONNECTION:          g_assert (self->priv->dbus == NULL);    /* construct-only */          self->priv->dbus = g_value_dup_object (value);          break; @@ -1197,20 +1192,16 @@ tp_base_client_constructed (GObject *object)    if (chain_up != NULL)      chain_up (object); -  /* Ensure we have a factory */ -  if (self->priv->factory == NULL) -    { -      self->priv->factory = tp_automatic_client_factory_new (self->priv->dbus); -    } +  g_assert (self->priv->factory != NULL); -  /* Ensure we have a TpDBusDaemon */ +  /* Ensure we have a GDBusConnection */    if (self->priv->dbus == NULL)      {        self->priv->dbus = g_object_ref ( -          tp_client_factory_get_dbus_daemon (self->priv->factory)); +          tp_client_factory_get_dbus_connection (self->priv->factory));      } -  g_assert (tp_client_factory_get_dbus_daemon (self->priv->factory) == +  g_assert (tp_client_factory_get_dbus_connection (self->priv->factory) ==        self->priv->dbus);    /* Bus name */ @@ -1389,20 +1380,19 @@ tp_base_client_class_init (TpBaseClientClass *cls)    object_class->finalize = tp_base_client_finalize;    /** -   * TpBaseClient:dbus-daemon: +   * TpBaseClient:dbus-connection:     * -   * #TpDBusDaemon object encapsulating this object's connection to D-Bus. -   * Read-only except during construction. +   * This object's connection to D-Bus. Read-only except during construction.     *     * This property can't be %NULL after construction.     * -   * Since: 0.11.5 +   * Since: 0.UNRELEASED     */ -  param_spec = g_param_spec_object ("dbus-daemon", "TpDBusDaemon object", -      "The dbus daemon associated with this client", -      TP_TYPE_DBUS_DAEMON, +  param_spec = g_param_spec_object ("dbus-connection", "GDBusConnection object", +      "The dbus connection associated with this client", +      G_TYPE_DBUS_CONNECTION,        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); -  g_object_class_install_property (object_class, PROP_DBUS_DAEMON, param_spec); +  g_object_class_install_property (object_class, PROP_DBUS_CONNECTION, param_spec);    /**     * TpBaseClient:factory: @@ -2510,20 +2500,20 @@ tp_base_client_get_uniquify_name (TpBaseClient *self)  }  /** - * tp_base_client_get_dbus_daemon: + * tp_base_client_get_dbus_connection:   * @self: a #TpBaseClient   * - * Return the #TpBaseClient:dbus-daemon construct-only property, which + * Return the #TpBaseClient:dbus-connection construct-only property, which   * represents the D-Bus connection used to export this client object.   *   * The returned object's reference count is not incremented, so it is not   * necessarily valid after @self is destroyed.   * - * Returns: (transfer none): the value of #TpBaseClient:dbus-daemon - * Since: 0.11.11 + * Returns: (transfer none): the value of #TpBaseClient:dbus-connection + * Since: 0.UNRELEASED   */ -TpDBusDaemon * -tp_base_client_get_dbus_daemon (TpBaseClient *self) +GDBusConnection * +tp_base_client_get_dbus_connection (TpBaseClient *self)  {    g_return_val_if_fail (TP_IS_BASE_CLIENT (self), NULL);    return self->priv->dbus; @@ -2614,12 +2604,10 @@ tp_base_client_unregister (TpBaseClient *self)      {        GHashTable *clients; -      clients = g_object_get_qdata (G_OBJECT (self->priv->gdbus), +      clients = g_object_get_qdata (G_OBJECT (self->priv->dbus),            clients_quark ());        if (clients != NULL)          g_hash_table_remove (clients, self->priv->object_path); - -      g_clear_object (&self->priv->gdbus);      }    self->priv->registered = FALSE; diff --git a/telepathy-glib/base-client.h b/telepathy-glib/base-client.h index f131f8db2..a2c03d667 100644 --- a/telepathy-glib/base-client.h +++ b/telepathy-glib/base-client.h @@ -208,7 +208,7 @@ const gchar *tp_base_client_get_name (TpBaseClient *self);  gboolean tp_base_client_get_uniquify_name (TpBaseClient *self);  const gchar *tp_base_client_get_bus_name (TpBaseClient *self);  const gchar *tp_base_client_get_object_path (TpBaseClient *self); -TpDBusDaemon *tp_base_client_get_dbus_daemon (TpBaseClient *self); +GDBusConnection *tp_base_client_get_dbus_connection (TpBaseClient *self);  void tp_base_client_unregister (TpBaseClient *self); diff --git a/telepathy-glib/base-connection-manager.c b/telepathy-glib/base-connection-manager.c index 7856f3dda..d8179e09e 100644 --- a/telepathy-glib/base-connection-manager.c +++ b/telepathy-glib/base-connection-manager.c @@ -180,12 +180,12 @@ struct _TpBaseConnectionManagerPrivate     /* dup'd string => ref to TpBaseProtocol */    GHashTable *protocols; -  TpDBusDaemon *dbus_daemon; +  GDBusConnection *dbus_connection;  };  enum  { -    PROP_DBUS_DAEMON = 1, +    PROP_DBUS_CONNECTION = 1,      PROP_INTERFACES,      PROP_PROTOCOLS,      N_PROPS @@ -212,10 +212,10 @@ tp_base_connection_manager_dispose (GObject *object)    priv->dispose_has_run = TRUE; -  if (priv->dbus_daemon != NULL) +  if (priv->dbus_connection != NULL)      { -      g_object_unref (priv->dbus_daemon); -      priv->dbus_daemon = NULL; +      g_object_unref (priv->dbus_connection); +      priv->dbus_connection = NULL;      }    if (priv->protocols != NULL) @@ -243,11 +243,12 @@ static gboolean  tp_base_connection_manager_ensure_dbus (TpBaseConnectionManager *self,      GError **error)  { -  if (self->priv->dbus_daemon == NULL) +  if (self->priv->dbus_connection == NULL)      { -      self->priv->dbus_daemon = tp_dbus_daemon_dup (error); +      self->priv->dbus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, +          error); -      if (self->priv->dbus_daemon == NULL) +      if (self->priv->dbus_connection == NULL)          return FALSE;      } @@ -291,8 +292,8 @@ tp_base_connection_manager_get_property (GObject *object,    switch (property_id)      { -    case PROP_DBUS_DAEMON: -      g_value_set_object (value, self->priv->dbus_daemon); +    case PROP_DBUS_CONNECTION: +      g_value_set_object (value, self->priv->dbus_connection);        break;      case PROP_INTERFACES: @@ -347,14 +348,10 @@ tp_base_connection_manager_set_property (GObject *object,    switch (property_id)      { -    case PROP_DBUS_DAEMON: +    case PROP_DBUS_CONNECTION:          { -          TpDBusDaemon *dbus_daemon = g_value_get_object (value); - -          g_assert (self->priv->dbus_daemon == NULL);     /* construct-only */ - -          if (dbus_daemon != NULL) -            self->priv->dbus_daemon = g_object_ref (dbus_daemon); +          g_assert (self->priv->dbus_connection == NULL);     /* construct-only */ +          self->priv->dbus_connection = g_value_dup_object (value);          }        break; @@ -401,22 +398,21 @@ tp_base_connection_manager_class_init (TpBaseConnectionManagerClass *klass)    klass->get_interfaces = tp_base_connection_manager_get_interfaces;    /** -   * TpBaseConnectionManager:dbus-daemon: +   * TpBaseConnectionManager:dbus-connection:     * -   * #TpDBusDaemon object encapsulating this object's connection to D-Bus. -   * Read-only except during construction. +   * This object's connection to D-Bus. Read-only except during construction.     *     * If this property is %NULL or omitted during construction, the object will     * automatically attempt to connect to the session bus with -   * tp_dbus_daemon_dup() just after it is constructed; if this fails, a +   * g_bus_get_sync() just after it is constructed; if this fails, a     * warning will be logged with g_warning(), and this property will remain     * %NULL.     *     * Since: 0.11.3     */ -  g_object_class_install_property (object_class, PROP_DBUS_DAEMON, -      g_param_spec_object ("dbus-daemon", "D-Bus daemon", -        "The D-Bus daemon used by this object", TP_TYPE_DBUS_DAEMON, +  g_object_class_install_property (object_class, PROP_DBUS_CONNECTION, +      g_param_spec_object ("dbus-connection", "D-Bus connection", +        "The D-Bus connection used by this object", G_TYPE_DBUS_CONNECTION,          G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));    /** @@ -831,7 +827,7 @@ tp_base_connection_manager_register (TpBaseConnectionManager *self)    if (!tp_base_connection_manager_ensure_dbus (self, &error))      goto except; -  g_assert (self->priv->dbus_daemon != NULL); +  g_assert (self->priv->dbus_connection != NULL);    string = g_string_new (TP_CM_OBJECT_PATH_BASE); @@ -840,7 +836,7 @@ tp_base_connection_manager_register (TpBaseConnectionManager *self)    /* don't bother handling failure gracefully: CMs should know what     * objects they export */ -  tp_dbus_daemon_register_object (self->priv->dbus_daemon, string->str, self); +  tp_dbus_daemon_register_object (self->priv->dbus_connection, string->str, self);    g_hash_table_iter_init (&iter, self->priv->protocols); @@ -866,14 +862,14 @@ tp_base_connection_manager_register (TpBaseConnectionManager *self)        g_strdelimit (string->str, "-", '_'); -      tp_dbus_daemon_register_object (self->priv->dbus_daemon, string->str, +      tp_dbus_daemon_register_object (self->priv->dbus_connection, string->str,            protocol);      }    g_string_assign (string, TP_CM_BUS_NAME_BASE);    g_string_append (string, cls->cm_dbus_name); -  if (!tp_dbus_daemon_request_name (self->priv->dbus_daemon, string->str, +  if (!tp_dbus_daemon_request_name (self->priv->dbus_connection, string->str,          TRUE, &error))      {        WARNING ("Couldn't claim bus name. If you are trying to debug this " @@ -909,23 +905,23 @@ service_iface_init (gpointer g_iface, gpointer iface_data)  }  /** - * tp_base_connection_manager_get_dbus_daemon: + * tp_base_connection_manager_get_dbus_connection:   * @self: the connection manager   *   * <!-- -->   *   * Returns: (transfer none): the value of the - *  #TpBaseConnectionManager:dbus-daemon property. The caller must reference + *  #TpBaseConnectionManager:dbus-connection property. The caller must reference   *  the returned object with g_object_ref() if it will be kept.   *   * Since: 0.11.3   */ -TpDBusDaemon * -tp_base_connection_manager_get_dbus_daemon (TpBaseConnectionManager *self) +GDBusConnection * +tp_base_connection_manager_get_dbus_connection (TpBaseConnectionManager *self)  {    g_return_val_if_fail (TP_IS_BASE_CONNECTION_MANAGER (self), NULL); -  return self->priv->dbus_daemon; +  return self->priv->dbus_connection;  }  /** diff --git a/telepathy-glib/base-connection-manager.h b/telepathy-glib/base-connection-manager.h index 4fce59e69..1c5749485 100644 --- a/telepathy-glib/base-connection-manager.h +++ b/telepathy-glib/base-connection-manager.h @@ -93,7 +93,7 @@ GType tp_base_connection_manager_get_type (void);  gboolean tp_base_connection_manager_register (TpBaseConnectionManager *self); -TpDBusDaemon *tp_base_connection_manager_get_dbus_daemon ( +GDBusConnection *tp_base_connection_manager_get_dbus_connection (      TpBaseConnectionManager *self);  void tp_base_connection_manager_add_protocol (TpBaseConnectionManager *self, diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c index 8bd6f07e2..8119df045 100644 --- a/telepathy-glib/base-connection.c +++ b/telepathy-glib/base-connection.c @@ -276,7 +276,7 @@ enum      PROP_INTERFACES,      PROP_REQUESTABLE_CHANNEL_CLASSES,      PROP_DBUS_STATUS, -    PROP_DBUS_DAEMON, +    PROP_DBUS_CONNECTION,      PROP_ACCOUNT_PATH_SUFFIX,      N_PROPS  }; @@ -340,7 +340,7 @@ struct _TpBaseConnectionPrivate     * DISCONNECTED). */    GPtrArray *disconnect_requests; -  TpDBusDaemon *bus_proxy; +  GDBusConnection *dbus_connection;    /* TRUE after constructor() returns */    gboolean been_constructed;    /* TRUE if on D-Bus */ @@ -369,11 +369,12 @@ static gboolean  tp_base_connection_ensure_dbus (TpBaseConnection *self,      GError **error)  { -  if (self->priv->bus_proxy == NULL) +  if (self->priv->dbus_connection == NULL)      { -      self->priv->bus_proxy = tp_dbus_daemon_dup (error); +      self->priv->dbus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, +          error); -      if (self->priv->bus_proxy == NULL) +      if (self->priv->dbus_connection == NULL)          return FALSE;      } @@ -417,8 +418,8 @@ tp_base_connection_get_property (GObject *object,        g_value_set_uint (value, tp_base_connection_get_status (self));        break; -    case PROP_DBUS_DAEMON: -      g_value_set_object (value, self->priv->bus_proxy); +    case PROP_DBUS_CONNECTION: +      g_value_set_object (value, self->priv->dbus_connection);        break;      case PROP_ACCOUNT_PATH_SUFFIX: @@ -451,15 +452,9 @@ tp_base_connection_set_property (GObject      *object,        tp_base_connection_set_self_handle (self, g_value_get_uint (value));        break; -    case PROP_DBUS_DAEMON: -        { -          TpDBusDaemon *dbus_daemon = g_value_get_object (value); - -          g_assert (self->priv->bus_proxy == NULL);     /* construct-only */ - -          if (dbus_daemon != NULL) -            self->priv->bus_proxy = g_object_ref (dbus_daemon); -        } +    case PROP_DBUS_CONNECTION: +      g_assert (self->priv->dbus_connection == NULL);     /* construct-only */ +      self->priv->dbus_connection = g_value_dup_object (value);        break;      case PROP_ACCOUNT_PATH_SUFFIX: @@ -478,16 +473,17 @@ tp_base_connection_unregister (TpBaseConnection *self)  {    TpBaseConnectionPrivate *priv = self->priv; -  if (priv->bus_proxy != NULL) +  if (priv->dbus_connection != NULL)      {        GHashTableIter iter;        if (priv->been_registered)          { -          tp_dbus_daemon_unregister_object (priv->bus_proxy, self); +          tp_dbus_daemon_unregister_object (priv->dbus_connection, self);            if (priv->bus_name != NULL) -            tp_dbus_daemon_release_name (priv->bus_proxy, priv->bus_name, NULL); +            tp_dbus_daemon_release_name (priv->dbus_connection, priv->bus_name, +                NULL);            else              DEBUG ("not releasing bus name: nothing to release"); @@ -519,7 +515,7 @@ tp_base_connection_dispose (GObject *object)    tp_base_connection_unregister (self); -  tp_clear_object (&priv->bus_proxy); +  tp_clear_object (&priv->dbus_connection);    g_ptr_array_foreach (priv->channel_managers, (GFunc) g_object_unref, NULL);    g_ptr_array_unref (priv->channel_managers); @@ -1145,21 +1141,20 @@ tp_base_connection_class_init (TpBaseConnectionClass *klass)    g_object_class_install_property (object_class, PROP_DBUS_STATUS, param_spec);    /** -   * TpBaseConnection:dbus-daemon: (skip) +   * TpBaseConnection:dbus-connection:     * -   * #TpDBusDaemon object encapsulating this object's connection to D-Bus. -   * Read-only except during construction. +   * This object's connection to D-Bus. Read-only except during construction.     *     * If this property is %NULL or omitted during construction, the object will     * automatically attempt to connect to the session bus with -   * tp_dbus_daemon_dup() just after it is constructed; if this fails, this +   * g_bus_get_sync() just after it is constructed; if this fails, this     * property will remain %NULL, and tp_base_connection_register() will fail.     * -   * Since: 0.11.3 +   * Since: 0.UNRELEASED     */ -  g_object_class_install_property (object_class, PROP_DBUS_DAEMON, -      g_param_spec_object ("dbus-daemon", "D-Bus daemon", -        "The D-Bus daemon used by this object", TP_TYPE_DBUS_DAEMON, +  g_object_class_install_property (object_class, PROP_DBUS_CONNECTION, +      g_param_spec_object ("dbus-connection", "D-Bus connection", +        "The D-Bus connection used by this object", G_TYPE_DBUS_CONNECTION,          G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));    /** @@ -1399,9 +1394,9 @@ tp_base_connection_register (TpBaseConnection *self,    g_free (safe_proto);    g_free (unique_name); -  if (!tp_dbus_daemon_try_register_object (priv->bus_proxy, priv->object_path, +  if (!tp_dbus_daemon_try_register_object (priv->dbus_connection, priv->object_path,          self, error) || -      !tp_dbus_daemon_request_name (priv->bus_proxy, priv->bus_name, FALSE, +      !tp_dbus_daemon_request_name (priv->dbus_connection, priv->bus_name, FALSE,          error))      {        g_free (priv->bus_name); @@ -2090,7 +2085,7 @@ ensure_client_data (TpBaseConnection *self,        client = g_slice_new0 (ClientData);        client->interests = g_hash_table_new (NULL, NULL);        client->watch_id = g_bus_watch_name_on_connection ( -          tp_proxy_get_dbus_connection (self->priv->bus_proxy), +          self->priv->dbus_connection,            unique_name,            G_BUS_NAME_WATCHER_FLAGS_NONE,            NULL, client_vanished_cb, @@ -2200,7 +2195,7 @@ tp_base_connection_dbus_add_client_interest (TpSvcConnection *svc,    const gchar *unique_name = NULL;    g_return_if_fail (TP_IS_BASE_CONNECTION (self)); -  g_return_if_fail (self->priv->bus_proxy != NULL); +  g_return_if_fail (self->priv->dbus_connection != NULL);    if (interests == NULL || interests[0] == NULL)      goto finally; @@ -2225,7 +2220,7 @@ tp_base_connection_dbus_remove_client_interest (TpSvcConnection *svc,    ClientData *client;    g_return_if_fail (TP_IS_BASE_CONNECTION (self)); -  g_return_if_fail (self->priv->bus_proxy != NULL); +  g_return_if_fail (self->priv->dbus_connection != NULL);    if (interests == NULL || interests[0] == NULL)      goto finally; @@ -2694,23 +2689,23 @@ tp_base_connection_channel_manager_iter_next (TpChannelManagerIter *iter,  }  /** - * tp_base_connection_get_dbus_daemon: (skip) + * tp_base_connection_get_dbus_connection:   * @self: the connection manager   *   * <!-- -->   *   * Returns: (transfer none): the value of the - *  #TpBaseConnectionManager:dbus-daemon property. The caller must reference + *  #TpBaseConnectionManager:dbus-connection property. The caller must reference   *  the returned object with g_object_ref() if it will be kept.   *   * Since: 0.11.3   */ -TpDBusDaemon * -tp_base_connection_get_dbus_daemon (TpBaseConnection *self) +GDBusConnection * +tp_base_connection_get_dbus_connection (TpBaseConnection *self)  {    g_return_val_if_fail (TP_IS_BASE_CONNECTION (self), NULL); -  return self->priv->bus_proxy; +  return self->priv->dbus_connection;  }  gpointer diff --git a/telepathy-glib/base-connection.h b/telepathy-glib/base-connection.h index 9f73002c7..076b7a172 100644 --- a/telepathy-glib/base-connection.h +++ b/telepathy-glib/base-connection.h @@ -203,7 +203,8 @@ gboolean tp_base_connection_channel_manager_iter_next (        } \    } G_STMT_END -TpDBusDaemon *tp_base_connection_get_dbus_daemon (TpBaseConnection *self); +GDBusConnection *tp_base_connection_get_dbus_connection ( +    TpBaseConnection *self);  void tp_base_connection_add_client_interest (TpBaseConnection *self,      const gchar *unique_name, const gchar *token, diff --git a/telepathy-glib/call-content-media-description.c b/telepathy-glib/call-content-media-description.c index f024c597a..654130a10 100644 --- a/telepathy-glib/call-content-media-description.c +++ b/telepathy-glib/call-content-media-description.c @@ -88,7 +88,7 @@ G_DEFINE_TYPE_WITH_CODE(TpCallContentMediaDescription,  enum  {    PROP_OBJECT_PATH = 1, -  PROP_DBUS_DAEMON, +  PROP_DBUS_CONNECTION,    PROP_INTERFACES,    PROP_FURTHER_NEGOTIATION_REQUIRED, @@ -114,7 +114,7 @@ enum  /* private structure */  struct _TpCallContentMediaDescriptionPrivate  { -  TpDBusDaemon *dbus_daemon; +  GDBusConnection *dbus_connection;    gchar *object_path;    /* GPtrArray of static strings, NULL-terminated */ @@ -174,7 +174,7 @@ tp_call_content_media_description_dispose (GObject *object)    tp_clear_pointer (&self->priv->codecs, g_ptr_array_unref);    tp_clear_pointer (&self->priv->ssrcs, g_hash_table_unref); -  g_clear_object (&self->priv->dbus_daemon); +  g_clear_object (&self->priv->dbus_connection);    tp_clear_pointer (&self->priv->header_extensions, g_ptr_array_unref);    tp_clear_pointer (&self->priv->feedback_messages, g_hash_table_unref); @@ -210,8 +210,8 @@ tp_call_content_media_description_get_property (GObject *object,        case PROP_OBJECT_PATH:          g_value_set_string (value, self->priv->object_path);          break; -      case PROP_DBUS_DAEMON: -        g_value_set_object (value, self->priv->dbus_daemon); +      case PROP_DBUS_CONNECTION: +        g_value_set_object (value, self->priv->dbus_connection);          break;        case PROP_INTERFACES:          g_value_set_boxed (value, self->priv->interfaces->pdata); @@ -281,9 +281,9 @@ tp_call_content_media_description_set_property (GObject *object,          g_assert (self->priv->object_path == NULL); /* construct-only */          self->priv->object_path = g_value_dup_string (value);          break; -      case PROP_DBUS_DAEMON: -        g_assert (self->priv->dbus_daemon == NULL); /* construct-only */ -        self->priv->dbus_daemon = g_value_dup_object (value); +      case PROP_DBUS_CONNECTION: +        g_assert (self->priv->dbus_connection == NULL); /* construct-only */ +        self->priv->dbus_connection = g_value_dup_object (value);          break;        case PROP_FURTHER_NEGOTIATION_REQUIRED:          self->priv->further_negotiation_required = g_value_get_boolean (value); @@ -380,18 +380,18 @@ tp_call_content_media_description_class_init (    g_object_class_install_property (object_class, PROP_OBJECT_PATH, spec);    /** -   * TpCallContentMediaDescription:dbus-daemon: +   * TpCallContentMediaDescription:dbus-connection:     * -   * The connection to the DBus daemon owning the CM. +   * The connection to the DBus owning the CM.     *     * Since: 0.17.5     */ -  spec = g_param_spec_object ("dbus-daemon", -      "The DBus daemon connection", -      "The connection to the DBus daemon owning the CM", -      TP_TYPE_DBUS_DAEMON, +  spec = g_param_spec_object ("dbus-connection", +      "The DBus connection", +      "The connection to the DBus owning the CM", +      G_TYPE_DBUS_CONNECTION,        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); -  g_object_class_install_property (object_class, PROP_DBUS_DAEMON, spec); +  g_object_class_install_property (object_class, PROP_DBUS_CONNECTION, spec);    /**     * TpCallContentMediaDescription:interfaces: @@ -647,7 +647,8 @@ tp_call_content_media_description_class_init (  /**   * tp_call_content_media_description_new: - * @dbus_daemon: value of #TpCallContentMediaDescription:dbus-daemon property + * @dbus_connection: value of #TpCallContentMediaDescription:dbus-connection + *  property   * @object_path: value of #TpCallContentMediaDescription:object-path property   * @remote_contact: value of   *  #TpCallContentMediaDescription:remote-contact property @@ -668,7 +669,7 @@ tp_call_content_media_description_class_init (   * Since: 0.17.5   */  TpCallContentMediaDescription * -tp_call_content_media_description_new (TpDBusDaemon *dbus_daemon, +tp_call_content_media_description_new (GDBusConnection *dbus_connection,      const gchar *object_path,      TpHandle remote_contact,      gboolean has_remote_information, @@ -677,6 +678,7 @@ tp_call_content_media_description_new (TpDBusDaemon *dbus_daemon,    g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);    return g_object_new (TP_TYPE_CALL_CONTENT_MEDIA_DESCRIPTION, +      "dbus-connection", dbus_connection,        "object-path", object_path,        "further-negotiation-required", further_negotiation_required,        "has-remote-information", has_remote_information, @@ -1109,7 +1111,8 @@ cancelled_cb (GCancellable *cancellable,  {    TpCallContentMediaDescription *self = user_data; -  tp_dbus_daemon_unregister_object (self->priv->dbus_daemon, G_OBJECT (self)); +  tp_dbus_daemon_unregister_object (self->priv->dbus_connection, +      G_OBJECT (self));    g_simple_async_result_set_error (self->priv->result,        G_IO_ERROR, G_IO_ERROR_CANCELLED, @@ -1143,7 +1146,7 @@ _tp_call_content_media_description_offer_async (    /* register object on the bus */    DEBUG ("Registering %s", self->priv->object_path); -  tp_dbus_daemon_register_object (self->priv->dbus_daemon, +  tp_dbus_daemon_register_object (self->priv->dbus_connection,        self->priv->object_path, G_OBJECT (self));  } @@ -1229,7 +1232,8 @@ tp_call_content_media_description_accept (TpSvcCall1ContentMediaDescription *ifa    tp_svc_call1_content_media_description_return_from_accept (context); -  tp_dbus_daemon_unregister_object (self->priv->dbus_daemon, G_OBJECT (self)); +  tp_dbus_daemon_unregister_object (self->priv->dbus_connection, +      G_OBJECT (self));  }  static void @@ -1265,7 +1269,8 @@ tp_call_content_media_description_reject (TpSvcCall1ContentMediaDescription *ifa    tp_svc_call1_content_media_description_return_from_reject (context); -  tp_dbus_daemon_unregister_object (self->priv->dbus_daemon, G_OBJECT (self)); +  tp_dbus_daemon_unregister_object (self->priv->dbus_connection, +      G_OBJECT (self));  }  static void diff --git a/telepathy-glib/call-content-media-description.h b/telepathy-glib/call-content-media-description.h index 1a7d18033..276b3c465 100644 --- a/telepathy-glib/call-content-media-description.h +++ b/telepathy-glib/call-content-media-description.h @@ -79,7 +79,7 @@ GType tp_call_content_media_description_get_type (void);  _TP_AVAILABLE_IN_0_18  TpCallContentMediaDescription *tp_call_content_media_description_new ( -    TpDBusDaemon *dbus_daemon, +    GDBusConnection *dbus_connection,      const gchar *object_path,      TpHandle remote_contact,      gboolean has_remote_information, diff --git a/telepathy-glib/call-stream-endpoint.c b/telepathy-glib/call-stream-endpoint.c index 929e9113e..fe4e1a8aa 100644 --- a/telepathy-glib/call-stream-endpoint.c +++ b/telepathy-glib/call-stream-endpoint.c @@ -83,7 +83,7 @@ G_DEFINE_TYPE_WITH_CODE(TpCallStreamEndpoint,  enum  {    PROP_OBJECT_PATH = 1, -  PROP_DBUS_DAEMON, +  PROP_DBUS_CONNECTION,    PROP_REMOTE_CREDENTIALS,    PROP_REMOTE_CANDIDATES, @@ -106,7 +106,7 @@ static guint _signals[LAST_SIGNAL] = { 0, };  struct _TpCallStreamEndpointPrivate  { -  TpDBusDaemon *dbus_daemon; +  GDBusConnection *dbus_connection;    gchar *object_path;    gchar *username; @@ -147,7 +147,7 @@ tp_call_stream_endpoint_constructed (GObject *obj)    /* register object on the bus */    DEBUG ("Registering %s", self->priv->object_path); -  tp_dbus_daemon_register_object (self->priv->dbus_daemon, +  tp_dbus_daemon_register_object (self->priv->dbus_connection,        self->priv->object_path, obj);    if (G_OBJECT_CLASS (tp_call_stream_endpoint_parent_class)->constructed != NULL) @@ -159,9 +159,9 @@ tp_call_stream_endpoint_dispose (GObject *object)  {    TpCallStreamEndpoint *self = TP_CALL_STREAM_ENDPOINT (object); -  tp_dbus_daemon_unregister_object (self->priv->dbus_daemon, G_OBJECT (self)); +  tp_dbus_daemon_unregister_object (self->priv->dbus_connection, G_OBJECT (self)); -  g_clear_object (&self->priv->dbus_daemon); +  g_clear_object (&self->priv->dbus_connection);    if (G_OBJECT_CLASS (tp_call_stream_endpoint_parent_class)->dispose)      G_OBJECT_CLASS (tp_call_stream_endpoint_parent_class)->dispose (object); @@ -195,8 +195,8 @@ tp_call_stream_endpoint_get_property (GObject *object,        case PROP_OBJECT_PATH:          g_value_set_string (value, self->priv->object_path);          break; -      case PROP_DBUS_DAEMON: -        g_value_set_object (value, self->priv->dbus_daemon); +      case PROP_DBUS_CONNECTION: +        g_value_set_object (value, self->priv->dbus_connection);          break;        case PROP_REMOTE_CREDENTIALS:          { @@ -247,9 +247,9 @@ tp_call_stream_endpoint_set_property (GObject *object,          g_assert (self->priv->object_path == NULL);   /* construct-only */          self->priv->object_path = g_value_dup_string (value);          break; -      case PROP_DBUS_DAEMON: -        g_assert (self->priv->dbus_daemon == NULL);   /* construct-only */ -        self->priv->dbus_daemon = g_value_dup_object (value); +      case PROP_DBUS_CONNECTION: +        g_assert (self->priv->dbus_connection == NULL);   /* construct-only */ +        self->priv->dbus_connection = g_value_dup_object (value);          break;        case PROP_TRANSPORT:          self->priv->transport = g_value_get_uint (value); @@ -310,18 +310,18 @@ tp_call_stream_endpoint_class_init (TpCallStreamEndpointClass *klass)    g_object_class_install_property (object_class, PROP_OBJECT_PATH, param_spec);    /** -   * TpCallStreamEndpoint:dbus-daemon: +   * TpCallStreamEndpoint:dbus-connection:     * -   * The connection to the DBus daemon owning the CM. +   * The connection to the DBus owning the CM.     * -   * Since: 0.17.5 +   * Since: 0.UNRELEASED     */ -  param_spec = g_param_spec_object ("dbus-daemon", -      "The DBus daemon connection", -      "The connection to the DBus daemon owning the CM", -      TP_TYPE_DBUS_DAEMON, +  param_spec = g_param_spec_object ("dbus-connection", +      "The DBus connection", +      "The connection to the DBus owning the CM", +      G_TYPE_DBUS_CONNECTION,        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); -  g_object_class_install_property (object_class, PROP_DBUS_DAEMON, param_spec); +  g_object_class_install_property (object_class, PROP_DBUS_CONNECTION, param_spec);    /**     * TpCallStreamEndpoint:remote-credentials: @@ -489,7 +489,7 @@ tp_call_stream_endpoint_class_init (TpCallStreamEndpointClass *klass)  /**   * tp_call_stream_endpoint_new: - * @dbus_daemon: value of #TpCallStreamEndpoint:dbus-daemon property + * @dbus_connection: value of #TpCallStreamEndpoint:dbus-connection property   * @object_path: value of #TpCallStreamEndpoint:object-path property   * @transport: value of #TpCallStreamEndpoint:transport property   * @is_ice_lite: value of #TpCallStreamEndpoint:is_ice_lite property @@ -501,16 +501,16 @@ tp_call_stream_endpoint_class_init (TpCallStreamEndpointClass *klass)   * Since: 0.17.5   */  TpCallStreamEndpoint * -tp_call_stream_endpoint_new (TpDBusDaemon *dbus_daemon, +tp_call_stream_endpoint_new (GDBusConnection *dbus_connection,      const gchar *object_path,      TpStreamTransportType transport,      gboolean is_ice_lite)  { -  g_return_val_if_fail (TP_IS_DBUS_DAEMON (dbus_daemon), NULL); +  g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), NULL);    g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);    return g_object_new (TP_TYPE_CALL_STREAM_ENDPOINT, -      "dbus-daemon", dbus_daemon, +      "dbus-connection", dbus_connection,        "object-path", object_path,        "transport", transport,        "is-ice-lite", is_ice_lite, diff --git a/telepathy-glib/call-stream-endpoint.h b/telepathy-glib/call-stream-endpoint.h index bbbec8348..2741e27c3 100644 --- a/telepathy-glib/call-stream-endpoint.h +++ b/telepathy-glib/call-stream-endpoint.h @@ -74,7 +74,8 @@ GType tp_call_stream_endpoint_get_type (void);      TP_TYPE_CALL_STREAM_ENDPOINT, TpCallStreamEndpointClass))  _TP_AVAILABLE_IN_0_18 -TpCallStreamEndpoint *tp_call_stream_endpoint_new (TpDBusDaemon *dbus_daemon, +TpCallStreamEndpoint *tp_call_stream_endpoint_new ( +    GDBusConnection *dbus_connection,      const gchar *object_path,      TpStreamTransportType transport,      gboolean is_ice_lite); diff --git a/telepathy-glib/channel-dispatch-operation.c b/telepathy-glib/channel-dispatch-operation.c index 8a7f6f3dc..fd8a09b2f 100644 --- a/telepathy-glib/channel-dispatch-operation.c +++ b/telepathy-glib/channel-dispatch-operation.c @@ -401,10 +401,6 @@ tp_channel_dispatch_operation_constructed (GObject *object)    if (chain_up != NULL)      chain_up (object); -  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL); - -  g_assert (tp_proxy_get_factory (self) != NULL); -    maybe_set_connection (self,        tp_asv_get_boxed (self->priv->immutable_properties,          TP_PROP_CHANNEL_DISPATCH_OPERATION_CONNECTION, @@ -753,7 +749,7 @@ _tp_channel_dispatch_operation_new (TpClientFactory *factory,      return NULL;    if (!_tp_dbus_daemon_get_name_owner ( -      tp_client_factory_get_dbus_daemon (factory), -1, +      tp_client_factory_get_dbus_connection (factory), -1,        TP_CHANNEL_DISPATCHER_BUS_NAME, &unique_name, error))      return NULL; diff --git a/telepathy-glib/channel-dispatcher.c b/telepathy-glib/channel-dispatcher.c index 843651a9f..01675d362 100644 --- a/telepathy-glib/channel-dispatcher.c +++ b/telepathy-glib/channel-dispatcher.c @@ -87,28 +87,12 @@ tp_channel_dispatcher_init (TpChannelDispatcher *self)  }  static void -tp_channel_dispatcher_constructed (GObject *object) -{ -  TpChannelDispatcher *self = TP_CHANNEL_DISPATCHER (object); -  void (*chain_up) (GObject *) = -    ((GObjectClass *) tp_channel_dispatcher_parent_class)->constructed; - -  if (chain_up != NULL) -    chain_up (object); - -  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL); -} - -static void  tp_channel_dispatcher_class_init (TpChannelDispatcherClass *klass)  {    TpProxyClass *proxy_class = (TpProxyClass *) klass; -  GObjectClass *object_class = (GObjectClass *) klass;    g_type_class_add_private (klass, sizeof (TpChannelDispatcherPrivate)); -  object_class->constructed = tp_channel_dispatcher_constructed; -    proxy_class->interface = TP_IFACE_QUARK_CHANNEL_DISPATCHER;  } diff --git a/telepathy-glib/channel-request.c b/telepathy-glib/channel-request.c index 2f5026f20..7a8b6e940 100644 --- a/telepathy-glib/channel-request.c +++ b/telepathy-glib/channel-request.c @@ -252,10 +252,6 @@ tp_channel_request_constructed (GObject *object)    if (chain_up != NULL)      chain_up (object); -  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL); - -  g_assert (tp_proxy_get_factory (self) != NULL); -    sc = tp_cli_channel_request_connect_to_failed (self,        tp_channel_request_failed_cb, NULL, NULL, NULL, &error); @@ -444,7 +440,7 @@ _tp_channel_request_new (TpClientFactory *factory,      return NULL;    if (!_tp_dbus_daemon_get_name_owner ( -      tp_client_factory_get_dbus_daemon (factory), -1, +      tp_client_factory_get_dbus_connection (factory), -1,        TP_CHANNEL_DISPATCHER_BUS_NAME, &unique_name, error))      return NULL; diff --git a/telepathy-glib/client-factory.c b/telepathy-glib/client-factory.c index 7b4375b27..617f40ec3 100644 --- a/telepathy-glib/client-factory.c +++ b/telepathy-glib/client-factory.c @@ -140,7 +140,7 @@  struct _TpClientFactoryPrivate  { -  TpDBusDaemon *dbus; +  GDBusConnection *dbus_connection;    /* Owned object-path -> weakref to TpProxy */    GHashTable *proxy_cache;    GArray *desired_account_features; @@ -153,7 +153,7 @@ struct _TpClientFactoryPrivate  enum  { -  PROP_DBUS_DAEMON = 1, +  PROP_DBUS_CONNECTION = 1,    N_PROPS  }; @@ -290,8 +290,8 @@ tp_client_factory_get_property (GObject *object,    switch (property_id)      { -    case PROP_DBUS_DAEMON: -      g_value_set_object (value, self->priv->dbus); +    case PROP_DBUS_CONNECTION: +      g_value_set_object (value, self->priv->dbus_connection);        break;      default:        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -309,9 +309,9 @@ tp_client_factory_set_property (GObject *object,    switch (property_id)      { -    case PROP_DBUS_DAEMON: -      g_assert (self->priv->dbus == NULL); /* construct only */ -      self->priv->dbus = g_value_dup_object (value); +    case PROP_DBUS_CONNECTION: +      g_assert (self->priv->dbus_connection == NULL); /* construct only */ +      self->priv->dbus_connection = g_value_dup_object (value);        break;      default:        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -324,8 +324,7 @@ tp_client_factory_constructed (GObject *object)  {    TpClientFactory *self = (TpClientFactory *) object; -  if (self->priv->dbus == NULL) -    self->priv->dbus = tp_dbus_daemon_dup (NULL); +  g_assert (self->priv->dbus_connection != NULL);    G_OBJECT_CLASS (tp_client_factory_parent_class)->constructed (object);  } @@ -335,7 +334,7 @@ tp_client_factory_finalize (GObject *object)  {    TpClientFactory *self = (TpClientFactory *) object; -  g_clear_object (&self->priv->dbus); +  g_clear_object (&self->priv->dbus_connection);    tp_clear_pointer (&self->priv->proxy_cache, g_hash_table_unref);    tp_clear_pointer (&self->priv->desired_account_features, g_array_unref);    tp_clear_pointer (&self->priv->desired_connection_features, g_array_unref); @@ -450,36 +449,35 @@ tp_client_factory_class_init (TpClientFactoryClass *klass)    klass->dup_tls_certificate_features = dup_tls_certificate_features_impl;    /** -   * TpClientFactory:dbus-daemon: +   * TpClientFactory:dbus-connection:     * -   * The D-Bus daemon for this object. +   * The D-Bus connection for this object.     */ -  param_spec = g_param_spec_object ("dbus-daemon", "D-Bus daemon", -      "The D-Bus daemon used by this object", -      TP_TYPE_DBUS_DAEMON, +  param_spec = g_param_spec_object ("dbus-connection", "D-Bus connection", +      "The D-Bus connection used by this object", +      G_TYPE_DBUS_CONNECTION,        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); -  g_object_class_install_property (object_class, PROP_DBUS_DAEMON, +  g_object_class_install_property (object_class, PROP_DBUS_CONNECTION,        param_spec);  }  /**   * tp_client_factory_new: - * @dbus: (allow-none): a #TpDBusDaemon, or %NULL + * @dbus_connection: a #GDBusConnection   * - * Creates a new #TpClientFactory instance. If @dbus is %NULL then - * tp_dbus_daemon_dup() will be used. + * Creates a new #TpClientFactory instance.   *   * Returns: a new #TpClientFactory   *   * Since: 0.99.1   */  TpClientFactory * -tp_client_factory_new (TpDBusDaemon *dbus) +tp_client_factory_new (GDBusConnection *dbus_connection)  { -  g_return_val_if_fail (dbus == NULL || TP_IS_DBUS_DAEMON (dbus), NULL); +  g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), NULL);    return g_object_new (TP_TYPE_CLIENT_FACTORY, -      "dbus-daemon", dbus, +      "dbus-connection", dbus_connection,        NULL);  } @@ -507,15 +505,15 @@ tp_client_factory_dup (GError **error)    self = g_weak_ref_get (&singleton);    if (self == NULL)      { -      TpDBusDaemon *dbus; +      GDBusConnection *dbus_connection; -      dbus = tp_dbus_daemon_dup (error); -      if (dbus == NULL) +      dbus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error); +      if (dbus_connection == NULL)          return NULL; -      self = tp_automatic_client_factory_new (dbus); +      self = tp_automatic_client_factory_new (dbus_connection);        g_weak_ref_set (&singleton, self); -      g_object_unref (dbus); +      g_object_unref (dbus_connection);      }    return self; @@ -584,32 +582,12 @@ tp_client_factory_can_set_default (void)  }  /** - * tp_client_factory_get_dbus_daemon: - * @self: a #TpClientFactory object - * - * <!-- --> - * - * Returns: (transfer none): the value of the #TpClientFactory:dbus-daemon - *  property - * - * Since: 0.99.1 - */ -TpDBusDaemon * -tp_client_factory_get_dbus_daemon (TpClientFactory *self) -{ -  g_return_val_if_fail (TP_IS_CLIENT_FACTORY (self), NULL); - -  return self->priv->dbus; -} - -/**   * tp_client_factory_get_dbus_connection:   * @self: a #TpClientFactory object   *   * <!-- -->   * - * Returns: (transfer none): the #TpClientFactory:dbus-daemon's - *  #GDBusConnection. + * Returns: (transfer none): the #TpClientFactory:dbus-connection property.   *   * Since: 0.UNRELEASED   */ @@ -618,7 +596,7 @@ tp_client_factory_get_dbus_connection (TpClientFactory *self)  {    g_return_val_if_fail (TP_IS_CLIENT_FACTORY (self), NULL); -  return tp_proxy_get_dbus_connection (self->priv->dbus); +  return self->priv->dbus_connection;  }  /** diff --git a/telepathy-glib/client-factory.h b/telepathy-glib/client-factory.h index 81722a75e..2cf33f2df 100644 --- a/telepathy-glib/client-factory.h +++ b/telepathy-glib/client-factory.h @@ -34,7 +34,6 @@  #include <telepathy-glib/connection.h>  #include <telepathy-glib/connection-manager.h>  #include <telepathy-glib/contact.h> -#include <telepathy-glib/dbus-daemon.h>  #include <telepathy-glib/debug-client.h>  #include <telepathy-glib/logger.h>  #include <telepathy-glib/protocol.h> @@ -128,12 +127,11 @@ GType tp_client_factory_get_type (void);    (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_CLIENT_FACTORY, \                                TpClientFactoryClass)) -TpClientFactory * tp_client_factory_new (TpDBusDaemon *dbus); +TpClientFactory * tp_client_factory_new (GDBusConnection *dbus_connection);  TpClientFactory * tp_client_factory_dup (GError **error);  void tp_client_factory_set_default (TpClientFactory *self);  gboolean tp_client_factory_can_set_default (void); -TpDBusDaemon *tp_client_factory_get_dbus_daemon (TpClientFactory *self);  GDBusConnection *tp_client_factory_get_dbus_connection (TpClientFactory *self);  TpAccountManager *tp_client_factory_ensure_account_manager ( diff --git a/telepathy-glib/client.c b/telepathy-glib/client.c index 483aeb775..8816c352a 100644 --- a/telepathy-glib/client.c +++ b/telepathy-glib/client.c @@ -83,27 +83,11 @@ tp_client_init (TpClient *self)  }  static void -tp_client_constructed (GObject *object) -{ -  TpClient *self = TP_CLIENT (object); -  void (*chain_up) (GObject *) = -    ((GObjectClass *) tp_client_parent_class)->constructed; - -  if (chain_up != NULL) -    chain_up (object); - -  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL); -} - -static void  tp_client_class_init (TpClientClass *klass)  {    TpProxyClass *proxy_class = (TpProxyClass *) klass; -  GObjectClass *object_class = (GObjectClass *) klass;    g_type_class_add_private (klass, sizeof (TpClientPrivate)); -  object_class->constructed = tp_client_constructed; -    proxy_class->interface = TP_IFACE_QUARK_CLIENT;  } diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c index 9e9383728..5a757a65c 100644 --- a/telepathy-glib/connection.c +++ b/telepathy-glib/connection.c @@ -2010,7 +2010,7 @@ _tp_connection_new (TpClientFactory *factory,    if (bus_name[0] != ':')      {        if (!_tp_dbus_daemon_get_name_owner ( -          tp_client_factory_get_dbus_daemon (factory), 2000, bus_name, +          tp_client_factory_get_dbus_connection (factory), 2000, bus_name,            &dup_unique_name, error))          goto finally; diff --git a/telepathy-glib/dbus-daemon.c b/telepathy-glib/dbus-daemon.c index 936260394..ffcd57685 100644 --- a/telepathy-glib/dbus-daemon.c +++ b/telepathy-glib/dbus-daemon.c @@ -146,29 +146,18 @@ tp_dbus_daemon_new (GDBusConnection *connection)  /* for internal use (TpChannel, TpConnection _new convenience functions) */  gboolean -_tp_dbus_daemon_get_name_owner (TpDBusDaemon *self, +_tp_dbus_daemon_get_name_owner (GDBusConnection *dbus_connection,                                  gint timeout_ms,                                  const gchar *well_known_name,                                  gchar **unique_name,                                  GError **error)  { -  const GError *invalidated;    GVariant *tuple; -  g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), FALSE); +  g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE);    g_return_val_if_fail (error == NULL || *error == NULL, FALSE); -  invalidated = tp_proxy_get_invalidated (self); - -  if (invalidated != NULL) -    { -      if (error != NULL) -        *error = g_error_copy (invalidated); - -      return FALSE; -    } - -  tuple = g_dbus_connection_call_sync (tp_proxy_get_dbus_connection (self), +  tuple = g_dbus_connection_call_sync (dbus_connection,        "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",        "GetNameOwner", g_variant_new ("(s)", well_known_name),        G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); @@ -185,7 +174,7 @@ _tp_dbus_daemon_get_name_owner (TpDBusDaemon *self,  /**   * tp_dbus_daemon_request_name: - * @self: a TpDBusDaemon + * @dbus_connection: a #GDBusConnection   * @well_known_name: a well-known name to acquire   * @idempotent: whether to consider it to be a success if this process   *              already owns the name @@ -201,34 +190,22 @@ _tp_dbus_daemon_get_name_owner (TpDBusDaemon *self,   * Since: 0.7.30   */  gboolean -tp_dbus_daemon_request_name (TpDBusDaemon *self, +tp_dbus_daemon_request_name (GDBusConnection *dbus_connection,                               const gchar *well_known_name,                               gboolean idempotent,                               GError **error)  {    GVariant *tuple;    guint32 result; -  const GError *invalidated; -  g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), FALSE); +  g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE);    g_return_val_if_fail (tp_dbus_check_valid_bus_name (well_known_name,          TP_DBUS_NAME_TYPE_WELL_KNOWN, error), FALSE);    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);    DEBUG ("%s", well_known_name); -  invalidated = tp_proxy_get_invalidated (self); - -  if (invalidated != NULL) -    { -      if (error != NULL) -        *error = g_error_copy (invalidated); - -      DEBUG ("- not requesting, we have fallen off D-Bus"); -      return FALSE; -    } - -  tuple = g_dbus_connection_call_sync (tp_proxy_get_dbus_connection (self), +  tuple = g_dbus_connection_call_sync (dbus_connection,        "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",        "RequestName",        g_variant_new ("(su)", well_known_name, @@ -283,7 +260,7 @@ tp_dbus_daemon_request_name (TpDBusDaemon *self,  /**   * tp_dbus_daemon_release_name: - * @self: a TpDBusDaemon + * @dbus_connection: a #GDBusConnection   * @well_known_name: a well-known name owned by this process to release   * @error: used to raise an error if %FALSE is returned   * @@ -296,33 +273,21 @@ tp_dbus_daemon_request_name (TpDBusDaemon *self,   * Since: 0.7.30   */  gboolean -tp_dbus_daemon_release_name (TpDBusDaemon *self, +tp_dbus_daemon_release_name (GDBusConnection *dbus_connection,                               const gchar *well_known_name,                               GError **error)  {    guint32 result; -  const GError *invalidated;    GVariant *tuple; -  g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), FALSE); +  g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE);    g_return_val_if_fail (tp_dbus_check_valid_bus_name (well_known_name,          TP_DBUS_NAME_TYPE_WELL_KNOWN, error), FALSE);    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);    DEBUG ("%s", well_known_name); -  invalidated = tp_proxy_get_invalidated (self); - -  if (invalidated != NULL) -    { -      if (error != NULL) -        *error = g_error_copy (invalidated); - -      DEBUG ("- not releasing, we have fallen off D-Bus"); -      return FALSE; -    } - -  tuple = g_dbus_connection_call_sync (tp_proxy_get_dbus_connection (self), +  tuple = g_dbus_connection_call_sync (dbus_connection,        "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",        "ReleaseName", g_variant_new ("(s)", well_known_name),        G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); @@ -411,7 +376,7 @@ tp_dbus_daemon_registration_free (gpointer p)  /**   * tp_dbus_daemon_register_object: - * @self: object representing a connection to a bus + * @dbus_connection: a #GDBusConnection   * @object_path: an object path   * @object: (type GObject.Object) (transfer none): an object to export   * @@ -435,18 +400,18 @@ tp_dbus_daemon_registration_free (gpointer p)   * method calls in a separate thread.   */  void -tp_dbus_daemon_register_object (TpDBusDaemon *self, +tp_dbus_daemon_register_object (GDBusConnection *dbus_connection,      const gchar *object_path,      gpointer object)  {    GError *error = NULL; -  if (!tp_dbus_daemon_try_register_object (self, object_path, object, &error)) +  if (!tp_dbus_daemon_try_register_object (dbus_connection, object_path, object, +          &error))      {        CRITICAL ("Unable to register %s %p at %s:%s: %s #%d: %s",            G_OBJECT_TYPE_NAME (object), object, -          g_dbus_connection_get_unique_name ( -            tp_proxy_get_dbus_connection (self)), +          g_dbus_connection_get_unique_name (dbus_connection),            object_path,            g_quark_to_string (error->domain), error->code,            error->message); @@ -455,7 +420,7 @@ tp_dbus_daemon_register_object (TpDBusDaemon *self,  /**   * tp_dbus_daemon_try_register_object: - * @self: object representing a connection to a bus + * @dbus_connection: a #GDBusConnection   * @object_path: an object path   * @object: (type GObject.Object) (transfer none): an object to export   * @error: used to raise %G_IO_ERROR_EXISTS if an object exists at that path @@ -467,7 +432,7 @@ tp_dbus_daemon_register_object (TpDBusDaemon *self,   * Returns: %TRUE if the object is successfully registered   */  gboolean -tp_dbus_daemon_try_register_object (TpDBusDaemon *self, +tp_dbus_daemon_try_register_object (GDBusConnection *dbus_connection,      const gchar *object_path,      gpointer object,      GError **error) @@ -479,12 +444,12 @@ tp_dbus_daemon_try_register_object (TpDBusDaemon *self,    Registration *r;    gboolean ret = FALSE; -  g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), FALSE); +  g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE);    g_return_val_if_fail (tp_dbus_check_valid_object_path (object_path, error),        FALSE);    g_return_val_if_fail (G_IS_OBJECT (object), FALSE); -  conn = tp_proxy_get_dbus_connection (self); +  conn = dbus_connection;    r = g_slice_new0 (Registration);    r->conn = g_object_ref (conn);    r->object_path = g_strdup (object_path); @@ -561,7 +526,7 @@ tp_dbus_daemon_try_register_object (TpDBusDaemon *self,            g_propagate_error (error, inner_error);            /* roll back */ -          tp_dbus_daemon_unregister_object (self, object); +          tp_dbus_daemon_unregister_object (dbus_connection, object);            goto finally;          } @@ -579,7 +544,7 @@ finally:  /**   * tp_dbus_daemon_unregister_object: - * @self: object representing a connection to a bus + * @dbus_connection: a #GDBusConnection   * @object: (type GObject.Object) (transfer none): an object previously exported   * with tp_dbus_daemon_register_object()   * @@ -589,10 +554,10 @@ finally:   * Since: 0.11.3   */  void -tp_dbus_daemon_unregister_object (TpDBusDaemon *self, +tp_dbus_daemon_unregister_object (GDBusConnection *dbus_connection,      gpointer object)  { -  g_return_if_fail (TP_IS_DBUS_DAEMON (self)); +  g_return_if_fail (G_IS_DBUS_CONNECTION (dbus_connection));    g_return_if_fail (G_IS_OBJECT (object));    DEBUG ("%p", object); @@ -604,7 +569,7 @@ tp_dbus_daemon_unregister_object (TpDBusDaemon *self,  /**   * tp_dbus_daemon_get_unique_name: - * @self: object representing a connection to a bus + * @dbus_connection: a #GDBusConnection   *   * <!-- Returns: is enough -->   * @@ -613,12 +578,11 @@ tp_dbus_daemon_unregister_object (TpDBusDaemon *self,   * Since: 0.7.35   */  const gchar * -tp_dbus_daemon_get_unique_name (TpDBusDaemon *self) +tp_dbus_daemon_get_unique_name (GDBusConnection *dbus_connection)  { -  g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), NULL); +  g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), NULL); -  return g_dbus_connection_get_unique_name ( -      tp_proxy_get_dbus_connection (self)); +  return g_dbus_connection_get_unique_name (dbus_connection);  }  static void diff --git a/telepathy-glib/dbus-daemon.h b/telepathy-glib/dbus-daemon.h index 45fa49d41..6acc8f88f 100644 --- a/telepathy-glib/dbus-daemon.h +++ b/telepathy-glib/dbus-daemon.h @@ -57,20 +57,21 @@ TpDBusDaemon *tp_dbus_daemon_dup (GError **error) G_GNUC_WARN_UNUSED_RESULT;  TpDBusDaemon *tp_dbus_daemon_new (GDBusConnection *connection)    G_GNUC_WARN_UNUSED_RESULT; -gboolean tp_dbus_daemon_request_name (TpDBusDaemon *self, +gboolean tp_dbus_daemon_request_name (GDBusConnection *dbus_connection,      const gchar *well_known_name, gboolean idempotent, GError **error); -gboolean tp_dbus_daemon_release_name (TpDBusDaemon *self, +gboolean tp_dbus_daemon_release_name (GDBusConnection *dbus_connection,      const gchar *well_known_name, GError **error); -const gchar *tp_dbus_daemon_get_unique_name (TpDBusDaemon *self); +const gchar *tp_dbus_daemon_get_unique_name (GDBusConnection *dbus_connection); -void tp_dbus_daemon_register_object (TpDBusDaemon *self, +void tp_dbus_daemon_register_object (GDBusConnection *dbus_connection,      const gchar *object_path, gpointer object); -gboolean tp_dbus_daemon_try_register_object (TpDBusDaemon *self, +gboolean tp_dbus_daemon_try_register_object (GDBusConnection *dbus_connection,      const gchar *object_path,      gpointer object,      GError **error); -void tp_dbus_daemon_unregister_object (TpDBusDaemon *self, gpointer object); +void tp_dbus_daemon_unregister_object (GDBusConnection *dbus_connection, +    gpointer object);  G_END_DECLS diff --git a/telepathy-glib/dbus-internal.h b/telepathy-glib/dbus-internal.h index 977ea6ad5..992abf368 100644 --- a/telepathy-glib/dbus-internal.h +++ b/telepathy-glib/dbus-internal.h @@ -27,8 +27,9 @@  G_BEGIN_DECLS -gboolean _tp_dbus_daemon_get_name_owner (TpDBusDaemon *self, gint timeout_ms, -    const gchar *well_known_name, gchar **unique_name, GError **error); +gboolean _tp_dbus_daemon_get_name_owner (GDBusConnection *dbus_connection, +    gint timeout_ms, const gchar *well_known_name, gchar **unique_name, +    GError **error);  gboolean _tp_dbus_daemon_is_the_shared_one (TpDBusDaemon *self); diff --git a/telepathy-glib/debug-sender.c b/telepathy-glib/debug-sender.c index 1df70baf1..ba266323e 100644 --- a/telepathy-glib/debug-sender.c +++ b/telepathy-glib/debug-sender.c @@ -237,19 +237,13 @@ static void  tp_debug_sender_constructed (GObject *object)  {    TpDebugSender *self = TP_DEBUG_SENDER (object); -  TpDBusDaemon *dbus_daemon; -  dbus_daemon = tp_dbus_daemon_dup (NULL); +  self->priv->conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); -  if (dbus_daemon != NULL) +  if (self->priv->conn != NULL)      { -      tp_dbus_daemon_register_object (dbus_daemon, +      tp_dbus_daemon_register_object (self->priv->conn,            TP_DEBUG_OBJECT_PATH, debug_sender); - -      self->priv->conn = g_object_ref (tp_proxy_get_dbus_connection ( -            dbus_daemon)); - -      g_object_unref (dbus_daemon);      }  } @@ -360,7 +354,7 @@ tp_debug_sender_init (TpDebugSender *self)   * exists.   *   * Returns: a reference to the #TpDebugSender instance for the current session - *          bus daemon + *          bus connection   *   * Since: 0.7.36   */ diff --git a/telepathy-glib/proxy.c b/telepathy-glib/proxy.c index 47242989b..af35ab919 100644 --- a/telepathy-glib/proxy.c +++ b/telepathy-glib/proxy.c @@ -327,7 +327,6 @@ tp_proxy_prepare_request_finish (TpProxyPrepareRequest *req,  }  struct _TpProxyPrivate { -    TpDBusDaemon *dbus_daemon;      GDBusConnection *dbus_connection;      gchar *bus_name;      gchar *object_path; @@ -364,7 +363,7 @@ G_DEFINE_TYPE (TpProxy, tp_proxy, G_TYPE_OBJECT)  enum  { -  PROP_DBUS_DAEMON = 1, +  PROP_0,    PROP_DBUS_CONNECTION,    PROP_BUS_NAME,    PROP_OBJECT_PATH, @@ -759,16 +758,6 @@ tp_proxy_get_property (GObject *object,    switch (property_id)      { -    case PROP_DBUS_DAEMON: -      if (TP_IS_DBUS_DAEMON (self)) -        { -          g_value_set_object (value, self); -        } -      else -        { -          g_value_set_object (value, self->priv->dbus_daemon); -        } -      break;      case PROP_DBUS_CONNECTION:        g_value_set_object (value, self->priv->dbus_connection);        break; @@ -807,17 +796,6 @@ tp_proxy_set_property (GObject *object,    switch (property_id)      { -    case PROP_DBUS_DAEMON: -      if (TP_IS_DBUS_DAEMON (self)) -        { -          g_assert (g_value_get_object (value) == NULL); -        } -      else -        { -          g_assert (self->priv->dbus_daemon == NULL); -          self->priv->dbus_daemon = g_value_dup_object (value); -        } -      break;      case PROP_DBUS_CONNECTION:        g_assert (self->priv->dbus_connection == NULL);        self->priv->dbus_connection = g_value_dup_object (value); @@ -906,19 +884,12 @@ tp_proxy_constructed (GObject *object)    if (!TP_IS_DBUS_DAEMON (self))      { -      TpDBusDaemon *dbus_daemon;        GDBusConnection *dbus_connection;        g_assert (self->priv->factory != NULL); -      dbus_daemon = tp_client_factory_get_dbus_daemon (self->priv->factory);        dbus_connection = tp_client_factory_get_dbus_connection (            self->priv->factory); -      if (self->priv->dbus_daemon == NULL) -        self->priv->dbus_daemon = g_object_ref (dbus_daemon); -      else -        g_assert (self->priv->dbus_daemon == dbus_daemon); -        if (self->priv->dbus_connection == NULL)          self->priv->dbus_connection = g_object_ref (dbus_connection);        else @@ -1032,7 +1003,6 @@ tp_proxy_dispose (GObject *object)     * here, and is idempotent. */    tp_proxy_invalidate (self, &e); -  tp_clear_object (&self->priv->dbus_daemon);    tp_clear_object (&self->priv->factory);    G_OBJECT_CLASS (tp_proxy_parent_class)->dispose (object); @@ -1090,19 +1060,6 @@ tp_proxy_class_init (TpProxyClass *klass)    object_class->finalize = tp_proxy_finalize;    /** -   * TpProxy:dbus-daemon: -   * -   * The D-Bus daemon for this object (this object itself, if it is a -   * TpDBusDaemon). Read-only except during construction. -   */ -  param_spec = g_param_spec_object ("dbus-daemon", "D-Bus daemon", -      "The D-Bus daemon used by this object, or this object itself if it's " -      "a TpDBusDaemon", TP_TYPE_DBUS_DAEMON, -      G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); -  g_object_class_install_property (object_class, PROP_DBUS_DAEMON, -      param_spec); - -  /**     * TpProxy:dbus-connection: (skip)     *     * The D-Bus connection for this object. Read-only except during @@ -1208,27 +1165,6 @@ tp_proxy_get_factory (gpointer self)  }  /** - * tp_proxy_get_dbus_daemon: - * @self: a #TpProxy or subclass - * - * <!-- --> - * - * Returns: (transfer none): a borrowed reference to the #TpDBusDaemon for - *  this object, if any; always %NULL if this object is itself a - *  #TpDBusDaemon. The caller must reference the returned object with - *  g_object_ref() if it will be kept. - * - * Since: 0.7.17 - */ -TpDBusDaemon * -tp_proxy_get_dbus_daemon (gpointer self) -{ -  TpProxy *proxy = TP_PROXY (self); - -  return proxy->priv->dbus_daemon; -} - -/**   * tp_proxy_get_dbus_connection: (skip)   * @self: a #TpProxy or subclass   * diff --git a/telepathy-glib/proxy.h b/telepathy-glib/proxy.h index 18f003fc3..b363aa498 100644 --- a/telepathy-glib/proxy.h +++ b/telepathy-glib/proxy.h @@ -156,8 +156,6 @@ gboolean tp_proxy_has_interface (gpointer self, const gchar *iface);  _TP_AVAILABLE_IN_0_16  TpClientFactory *tp_proxy_get_factory (gpointer self); -TpDBusDaemon *tp_proxy_get_dbus_daemon (gpointer self); -  GDBusConnection *tp_proxy_get_dbus_connection (gpointer self);  const gchar *tp_proxy_get_bus_name (gpointer self); diff --git a/telepathy-glib/run.c b/telepathy-glib/run.c index 43e5299a0..6ce4b3d4e 100644 --- a/telepathy-glib/run.c +++ b/telepathy-glib/run.c @@ -212,7 +212,6 @@ tp_run_connection_manager (const char *prog_name,                             char **argv)  {    GDBusConnection *connection = NULL; -  TpDBusDaemon *bus_daemon = NULL;    GError *error = NULL;    int ret = 1; @@ -241,9 +240,9 @@ tp_run_connection_manager (const char *prog_name,    mainloop = g_main_loop_new (NULL, FALSE); -  bus_daemon = tp_dbus_daemon_dup (&error); +  connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); -  if (bus_daemon == NULL) +  if (connection == NULL)      {        WARNING ("%s", error->message);        g_error_free (error); @@ -259,7 +258,6 @@ tp_run_connection_manager (const char *prog_name,    g_signal_connect (manager, "no-more-connections",        (GCallback) no_more_connections, NULL); -  connection = tp_proxy_get_dbus_connection (bus_daemon);    /* Exit gracefully (terminate the main loop) on close, rather     * than raising SIGTERM, so that valgrind can see our memory leaks */    g_dbus_connection_set_exit_on_close (connection, FALSE); @@ -290,8 +288,8 @@ out:      g_signal_handlers_disconnect_by_func (connection, gdbus_closed_cb,          mainloop); -  if (bus_daemon != NULL) -    g_object_unref (bus_daemon); +  if (connection != NULL) +    g_object_unref (connection);    /* globals */    if (timeout_id != 0) diff --git a/telepathy-glib/versions/main-1.0.abi b/telepathy-glib/versions/main-1.0.abi index 706ace977..f11699aa3 100644 --- a/telepathy-glib/versions/main-1.0.abi +++ b/telepathy-glib/versions/main-1.0.abi @@ -236,7 +236,6 @@ tp_base_client_delegate_channels_finish  tp_base_client_dup_handled_channels  tp_base_client_dup_pending_requests  tp_base_client_get_bus_name -tp_base_client_get_dbus_daemon  tp_base_client_get_name  tp_base_client_get_object_path  tp_base_client_get_type @@ -267,7 +266,6 @@ tp_base_connection_dup_contact_attributes_hash  tp_base_connection_finish_shutdown  tp_base_connection_get_account_path_suffix  tp_base_connection_get_bus_name -tp_base_connection_get_dbus_daemon  tp_base_connection_get_handles  tp_base_connection_get_object_path  tp_base_connection_get_self_handle @@ -275,7 +273,6 @@ tp_base_connection_get_status  tp_base_connection_get_type  tp_base_connection_is_destroyed  tp_base_connection_manager_add_protocol -tp_base_connection_manager_get_dbus_daemon  tp_base_connection_manager_get_type  tp_base_connection_manager_register  tp_base_connection_register @@ -585,7 +582,6 @@ tp_client_factory_ensure_contact_by_id_async  tp_client_factory_ensure_contact_by_id_finish  tp_client_factory_ensure_protocol  tp_client_factory_ensure_tls_certificate -tp_client_factory_get_dbus_daemon  tp_client_factory_get_type  tp_client_factory_new  tp_client_factory_upgrade_contacts_async @@ -1112,7 +1108,6 @@ tp_proxy_add_interfaces  tp_proxy_dbus_error_to_gerror  tp_proxy_get_bus_name  tp_proxy_get_dbus_connection -tp_proxy_get_dbus_daemon  tp_proxy_get_factory  tp_proxy_get_invalidated  tp_proxy_get_object_path diff --git a/telepathy-logger/client-factory-internal.h b/telepathy-logger/client-factory-internal.h index f678d64da..927e82a01 100644 --- a/telepathy-logger/client-factory-internal.h +++ b/telepathy-logger/client-factory-internal.h @@ -55,6 +55,6 @@ GType _tpl_client_factory_get_type (void);    (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_CLIENT_FACTORY, \                                TplClientFactoryClass)) -TpClientFactory *_tpl_client_factory_dup (TpDBusDaemon *dbus); +TpClientFactory *_tpl_client_factory_dup (GDBusConnection *dbus);  #endif /* __TPL_CLIENT_FACTORY_H__ */ diff --git a/telepathy-logger/client-factory.c b/telepathy-logger/client-factory.c index 91d5f2d71..948d6bd7e 100644 --- a/telepathy-logger/client-factory.c +++ b/telepathy-logger/client-factory.c @@ -105,15 +105,15 @@ _tpl_client_factory_class_init (TplClientFactoryClass *cls)  static TpClientFactory * -_tpl_client_factory_new (TpDBusDaemon *dbus) +_tpl_client_factory_new (GDBusConnection *dbus)  {    return g_object_new (TPL_TYPE_CLIENT_FACTORY, -      "dbus-daemon", dbus, +      "dbus-connection", dbus,        NULL);  }  TpClientFactory * -_tpl_client_factory_dup (TpDBusDaemon *dbus) +_tpl_client_factory_dup (GDBusConnection *dbus)  {    static TpClientFactory *singleton = NULL; diff --git a/telepathy-logger/dbus-service.c b/telepathy-logger/dbus-service.c index 3f1d7c8b7..4495e4a02 100644 --- a/telepathy-logger/dbus-service.c +++ b/telepathy-logger/dbus-service.c @@ -753,7 +753,7 @@ tpl_dbus_service_clear_account (TpSvcLogger *logger,      GDBusMethodInvocation *context)  {    TplDBusService *self = TPL_DBUS_SERVICE (logger); -  TpDBusDaemon *bus; +  GDBusConnection *bus;    TpAccount *account;    GError *error = NULL;    TpClientFactory *factory = NULL; @@ -761,10 +761,10 @@ tpl_dbus_service_clear_account (TpSvcLogger *logger,    g_return_if_fail (TPL_IS_DBUS_SERVICE (self));    g_return_if_fail (context != NULL); -  bus = tp_dbus_daemon_dup (&error); +  bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);    if (bus == NULL)      { -      DEBUG ("Unable to acquire the bus daemon: %s", error->message); +      DEBUG ("Unable to acquire the bus connection: %s", error->message);        g_dbus_method_invocation_return_gerror (context, error);        goto out;      } @@ -804,7 +804,7 @@ tpl_dbus_service_clear_entity (TpSvcLogger *logger,      GDBusMethodInvocation *context)  {    TplDBusService *self = TPL_DBUS_SERVICE (logger); -  TpDBusDaemon *bus; +  GDBusConnection *bus;    TpAccount *account;    TplEntity *entity;    GError *error = NULL; @@ -814,10 +814,10 @@ tpl_dbus_service_clear_entity (TpSvcLogger *logger,    g_return_if_fail (context != NULL);    g_return_if_fail (!TPL_STR_EMPTY (identifier)); -  bus = tp_dbus_daemon_dup (&error); +  bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);    if (bus == NULL)      { -      DEBUG ("Unable to acquire the bus daemon: %s", error->message); +      DEBUG ("Unable to acquire the bus connection: %s", error->message);        g_dbus_method_invocation_return_gerror (context, error);        goto out;      } diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c index 828e0d592..22acfe808 100644 --- a/telepathy-logger/log-store-xml.c +++ b/telepathy-logger/log-store-xml.c @@ -431,7 +431,7 @@ add_text_event (TplLogStoreXml *self,  {    gboolean ret = FALSE;    gint64 timestamp; -  TpDBusDaemon *bus_daemon; +  GDBusConnection *bus_connection;    TpAccount *account;    TplEntity *sender;    const gchar *body_str; @@ -448,10 +448,10 @@ add_text_event (TplLogStoreXml *self,    g_return_val_if_fail (TPL_IS_LOG_STORE_XML (self), FALSE);    g_return_val_if_fail (TPL_IS_TEXT_EVENT (message), FALSE); -  bus_daemon = tp_dbus_daemon_dup (error); -  if (bus_daemon == NULL) +  bus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error); +  if (bus_connection == NULL)      { -      DEBUG ("Error acquiring bus daemon: %s", (*error)->message); +      DEBUG ("Error acquiring bus connection: %s", (*error)->message);        goto out;      } @@ -540,8 +540,8 @@ out:    g_string_free (event, TRUE);    g_free (avatar_token); -  if (bus_daemon != NULL) -    g_object_unref (bus_daemon); +  if (bus_connection != NULL) +    g_object_unref (bus_connection);    return ret;  } @@ -553,7 +553,7 @@ add_call_event (TplLogStoreXml *self,      GError **error)  {    gboolean ret = FALSE; -  TpDBusDaemon *bus_daemon; +  GDBusConnection *bus_connection;    TpAccount *account;    TplEntity *sender;    TplEntity *actor; @@ -572,10 +572,10 @@ add_call_event (TplLogStoreXml *self,    g_return_val_if_fail (TPL_IS_LOG_STORE_XML (self), FALSE);    g_return_val_if_fail (TPL_IS_CALL_EVENT (event), FALSE); -  bus_daemon = tp_dbus_daemon_dup (error); -  if (bus_daemon == NULL) +  bus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error); +  if (bus_connection == NULL)      { -      DEBUG ("Error acquiring bus daemon: %s", (*error)->message); +      DEBUG ("Error acquiring bus connection: %s", (*error)->message);        goto out;      } @@ -645,8 +645,8 @@ out:    g_free (time_str);    g_free (log_str); -  if (bus_daemon != NULL) -    g_object_unref (bus_daemon); +  if (bus_connection != NULL) +    g_object_unref (bus_connection);    return ret;  } diff --git a/telepathy-logger/observer.c b/telepathy-logger/observer.c index a083ea742..59aa3fcfb 100644 --- a/telepathy-logger/observer.c +++ b/telepathy-logger/observer.c @@ -265,7 +265,8 @@ _tpl_observer_dup (GError **error)    if (G_UNLIKELY (observer_singleton == NULL))      {        GError *dbus_error = NULL; -      TpDBusDaemon *dbus = tp_dbus_daemon_dup (&dbus_error); +      GDBusConnection *dbus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, +          &dbus_error);        TpClientFactory *factory;        if (dbus == NULL) diff --git a/telepathy-logger/telepathy-logger.c b/telepathy-logger/telepathy-logger.c index d84c48ad3..627db98d1 100644 --- a/telepathy-logger/telepathy-logger.c +++ b/telepathy-logger/telepathy-logger.c @@ -87,20 +87,20 @@ static TplDBusService *  telepathy_logger_dbus_init (void)  {    TplDBusService *dbus_srv = NULL; -  TpDBusDaemon *tp_bus = NULL; +  GDBusConnection *dbus_connection = NULL;    GError *error = NULL;    DEBUG ("Initializing TPL DBus service"); -  tp_bus = tp_dbus_daemon_dup (&error); -  if (tp_bus == NULL) +  dbus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); +  if (dbus_connection == NULL)      { -      g_critical ("Failed to acquire bus daemon: %s", error->message); +      g_critical ("Failed to acquire bus connection: %s", error->message);        goto out;      } -  if (!tp_dbus_daemon_request_name (tp_bus, TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME, -        FALSE, &error)) +  if (!tp_dbus_daemon_request_name (dbus_connection, +        TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME, FALSE, &error))      {        g_critical ("Failed to acquire bus name %s: %s",            TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME, error->message); @@ -108,7 +108,7 @@ telepathy_logger_dbus_init (void)      }    dbus_srv = _tpl_dbus_service_new (); -  tp_dbus_daemon_register_object (tp_bus, TPL_DBUS_SRV_OBJECT_PATH, +  tp_dbus_daemon_register_object (dbus_connection, TPL_DBUS_SRV_OBJECT_PATH,        G_OBJECT (dbus_srv));    DEBUG ("TPL DBus service registered to: %s", @@ -117,8 +117,8 @@ telepathy_logger_dbus_init (void)  out:    if (error != NULL)        g_clear_error (&error); -  if (tp_bus != NULL) -    g_object_unref (tp_bus); +  if (dbus_connection != NULL) +    g_object_unref (dbus_connection);    return dbus_srv;  } diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am index 027defa81..d34f14e81 100644 --- a/tests/dbus/Makefile.am +++ b/tests/dbus/Makefile.am @@ -34,7 +34,6 @@ tests_list = \      test-example-no-protocols \      test-file-transfer-channel \      test-finalized-in-invalidated-handler \ -    test-get-interface-after-invalidate \      test-group-mixin \      test-handle-repo \      test-handle-set \ @@ -208,9 +207,6 @@ test_file_transfer_channel_SOURCES = file-transfer-channel.c  test_finalized_in_invalidated_handler_SOURCES = \      finalized-in-invalidated-handler.c -test_get_interface_after_invalidate_SOURCES = \ -    get-interface-after-invalidate.c -  test_group_mixin_SOURCES = group-mixin.c  test_handle_repo_SOURCES = handle-repo.c diff --git a/tests/dbus/account-channel-request.c b/tests/dbus/account-channel-request.c index a6bd45cc3..bac8f7f39 100644 --- a/tests/dbus/account-channel-request.c +++ b/tests/dbus/account-channel-request.c @@ -28,7 +28,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseConnection *base_connection; @@ -54,7 +54,7 @@ setup (Test *test,         gconstpointer data)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->cancellable = g_cancellable_new (); diff --git a/tests/dbus/account-manager.c b/tests/dbus/account-manager.c index 8e89827ab..2b563f368 100644 --- a/tests/dbus/account-manager.c +++ b/tests/dbus/account-manager.c @@ -29,7 +29,7 @@ typedef struct {  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      TpTestsSimpleAccountManager *service /* initialized in prepare_service */;      TpAccountManager *am; @@ -48,7 +48,7 @@ typedef struct {  } Test;  static TpAccountManager * -account_manager_new (TpDBusDaemon *dbus) +account_manager_new (GDBusConnection *dbus)  {    TpClientFactory *factory;    TpAccountManager *am; @@ -152,7 +152,7 @@ setup (Test *test,    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->am = NULL;    test->timeout_id = 0; @@ -250,15 +250,15 @@ test_dup (Test *test,      gconstpointer data G_GNUC_UNUSED)  {    TpAccountManager *one, *two; -  TpDBusDaemon *dbus_one, *dbus_two; +  GDBusConnection *dbus_one, *dbus_two;    one = tp_account_manager_dup ();    two = tp_account_manager_dup ();    g_assert (one == two); -  dbus_one = tp_dbus_daemon_dup (NULL); -  dbus_two = tp_proxy_get_dbus_daemon (one); +  dbus_one = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); +  dbus_two = tp_proxy_get_dbus_connection (one);    g_assert (dbus_one == dbus_two); @@ -348,7 +348,7 @@ assert_am_not_activatable_action (gpointer script_data,  {    Test *test = (Test *) script_data; -  g_dbus_connection_call (tp_proxy_get_dbus_connection (test->dbus), +  g_dbus_connection_call (test->dbus,        "org.freedesktop.DBus", "/", "org.freedesktop.DBus",        "ListActivatableNames",        g_variant_new ("()"), diff --git a/tests/dbus/account-request.c b/tests/dbus/account-request.c index ca5705c3a..807745f30 100644 --- a/tests/dbus/account-request.c +++ b/tests/dbus/account-request.c @@ -21,7 +21,7 @@  typedef struct {    GMainLoop *mainloop; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpTestsSimpleAccountManager *am;    TpTestsSimpleAccount *account_service; @@ -38,7 +38,7 @@ setup (Test *test,      gconstpointer data G_GNUC_UNUSED)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    g_assert (test->dbus != NULL);    /* create the account manager service */ @@ -86,7 +86,7 @@ teardown (Test *test,    tp_dbus_daemon_unregister_object (test->dbus, test->account_service);    tp_tests_assert_last_unref (&test->account_service); -  tp_tests_assert_last_unref (&test->dbus); +  g_clear_object (&test->dbus);    tp_clear_pointer (&test->mainloop, g_main_loop_unref);    g_clear_error (&test->error); diff --git a/tests/dbus/account.c b/tests/dbus/account.c index dde9ceb13..2ce1de21c 100644 --- a/tests/dbus/account.c +++ b/tests/dbus/account.c @@ -36,7 +36,7 @@ test_parse_failure (gconstpointer test_data)    if (!g_variant_is_object_path (object_path))      return; -  factory = tp_client_factory_new (NULL); +  factory = tp_client_factory_dup (NULL);    account = tp_client_factory_ensure_account (factory, object_path, NULL,        &error); @@ -78,7 +78,7 @@ test_parse_success (gconstpointer test_data)    TpAccount *account;    GError *error = NULL; -  factory = tp_client_factory_new (NULL); +  factory = tp_client_factory_dup (NULL);    account = tp_client_factory_ensure_account (factory, t->path, NULL, &error);    g_assert (account != NULL); @@ -93,7 +93,7 @@ test_parse_success (gconstpointer test_data)  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      TpAccount *account;      gulong notify_id; @@ -115,7 +115,7 @@ setup (Test *test,         gconstpointer data)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    g_assert (test->dbus != NULL);    test->account = NULL; diff --git a/tests/dbus/base-client.c b/tests/dbus/base-client.c index 915657b0e..4ceb24c14 100644 --- a/tests/dbus/base-client.c +++ b/tests/dbus/base-client.c @@ -37,7 +37,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseClient *base_client; @@ -79,7 +79,7 @@ setup (Test *test,    GError *error = NULL;    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL;    test->interfaces = NULL; @@ -108,7 +108,6 @@ setup (Test *test,    /* Create client-side Client object */    test->client = tp_tests_object_new_static_class (TP_TYPE_CLIENT, -          "dbus-daemon", test->dbus,            "bus-name", tp_base_client_get_bus_name (test->base_client),            "object-path", tp_base_client_get_object_path (test->base_client),            "factory", test->factory, @@ -284,13 +283,13 @@ test_basics (Test *test,      gconstpointer data G_GNUC_UNUSED)  {    TpClientFactory *factory; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    gchar *name;    gboolean unique;    g_object_get (test->base_client,        "factory", &factory, -      "dbus-daemon", &dbus, +      "dbus-connection", &dbus,        "name", &name,        "uniquify-name", &unique,        NULL); @@ -300,7 +299,7 @@ test_basics (Test *test,    g_assert_cmpstr ("Test", ==, name);    g_assert (!unique); -  g_assert (test->dbus == tp_base_client_get_dbus_daemon (test->base_client)); +  g_assert (test->dbus == tp_base_client_get_dbus_connection (test->base_client));    g_assert_cmpstr ("Test", ==, tp_base_client_get_name (test->base_client));    g_assert (!tp_base_client_get_uniquify_name (test->base_client)); @@ -798,6 +797,7 @@ test_handler (Test *test,    const gchar *caps[] = { "mushroom", "snake", NULL };    GList *chans;    TpTestsSimpleClient *client_2; +  TpClientFactory *factory_2;    filter = tp_channel_filter_new_for_text_chats ();    tp_base_client_add_handler_filter (test->base_client, filter); @@ -870,7 +870,8 @@ test_handler (Test *test,          test->text_chan_2));    /* Create another client sharing the same unique name */ -  client_2 = tp_tests_simple_client_new (NULL, "Test", TRUE); +  factory_2 = tp_automatic_client_factory_new (test->dbus); +  client_2 = tp_tests_simple_client_new (factory_2, "Test", TRUE);    tp_base_client_be_a_handler (TP_BASE_CLIENT (client_2));    tp_base_client_register (TP_BASE_CLIENT (client_2), &test->error);    g_assert_no_error (test->error); @@ -885,6 +886,7 @@ test_handler (Test *test,          test->text_chan_2));    g_object_unref (client_2); +  g_object_unref (factory_2);  }  /* Test Requests interface on Handler */ diff --git a/tests/dbus/call-cancellation.c b/tests/dbus/call-cancellation.c index 55a529fa1..c2f47de5a 100644 --- a/tests/dbus/call-cancellation.c +++ b/tests/dbus/call-cancellation.c @@ -173,7 +173,7 @@ static void  setup (Fixture *f,      gconstpointer data)  { -  TpDBusDaemon *dbus_daemon; +  GDBusConnection *dbus_connection;    GError *error = NULL;    global_fixture = f; @@ -191,7 +191,7 @@ setup (Fixture *f,    f->factory = tp_client_factory_dup (&error);    g_assert_no_error (error); -  dbus_daemon = tp_client_factory_get_dbus_daemon (f->factory); +  dbus_connection = tp_client_factory_get_dbus_connection (f->factory);    /* Any random object with an interface: what matters is that it can     * accept a method call and emit a signal. We use the Properties @@ -199,14 +199,11 @@ setup (Fixture *f,    f->cd_service = tp_tests_object_new_static_class (        TP_TESTS_TYPE_SIMPLE_CHANNEL_DISPATCHER,        NULL); -  tp_dbus_daemon_register_object (dbus_daemon, "/", f->cd_service); +  tp_dbus_daemon_register_object (dbus_connection, "/", f->cd_service);    f->private_gdbus = tp_tests_get_private_bus ();    g_assert (f->private_gdbus != NULL); -  dbus_daemon = tp_dbus_daemon_new (f->private_gdbus); -  g_assert (dbus_daemon != NULL); -  f->private_factory = tp_client_factory_new (dbus_daemon); -  g_object_unref (dbus_daemon); +  f->private_factory = tp_client_factory_new (f->private_gdbus);  }  static void @@ -249,7 +246,7 @@ new_proxy (Fixture *f,    return tp_tests_object_new_static_class (TP_TYPE_PROXY,        "bus-name", tp_dbus_daemon_get_unique_name ( -          tp_client_factory_get_dbus_daemon (f->factory)), +          tp_client_factory_get_dbus_connection (f->factory)),        "object-path", "/",        "factory", local_factory,        NULL); diff --git a/tests/dbus/call-channel.c b/tests/dbus/call-channel.c index 114f30646..b06b6e2d5 100644 --- a/tests/dbus/call-channel.c +++ b/tests/dbus/call-channel.c @@ -41,7 +41,7 @@  typedef struct  {    GMainLoop *mainloop; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    GError *error /* statically initialized to NULL */ ;    guint wait_count; @@ -83,7 +83,7 @@ setup (Test *test,    tp_debug_set_flags ("all");    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->factory = tp_client_factory_dup (&error);    g_assert_no_error (error); diff --git a/tests/dbus/channel-dispatch-operation.c b/tests/dbus/channel-dispatch-operation.c index e32c3c128..98c910880 100644 --- a/tests/dbus/channel-dispatch-operation.c +++ b/tests/dbus/channel-dispatch-operation.c @@ -33,10 +33,9 @@ static const gchar *POSSIBLE_HANDLERS[] = {  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus; -    GDBusConnection *private_conn; -    TpDBusDaemon *private_dbus; +    GDBusConnection *private_dbus;      TpTestsSimpleChannelDispatchOperation *cdo_service;      TpTestsEchoChannel *text_chan_service; @@ -57,10 +56,9 @@ setup (Test *test,    tp_debug_set_flags ("all");    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die (); -  test->private_conn = tp_tests_get_private_bus (); -  test->private_dbus = tp_dbus_daemon_new (test->private_conn); +  test->private_dbus = tp_tests_get_private_bus ();    g_assert (test->private_dbus != NULL);    test->cdo = NULL; @@ -144,6 +142,8 @@ teardown (Test *test,        tp_dbus_daemon_release_name (test->private_dbus,            TP_CHANNEL_DISPATCHER_BUS_NAME, NULL); +      g_dbus_connection_close_sync (test->private_dbus, NULL, NULL); +        g_object_unref (test->private_dbus);        test->private_dbus = NULL;      } @@ -151,11 +151,6 @@ teardown (Test *test,    g_object_unref (test->cdo_service);    test->cdo_service = NULL; -  if (test->private_conn != NULL) -    g_dbus_connection_close_sync (test->private_conn, NULL, NULL); - -  g_clear_object (&test->private_conn); -    /* make sure any pending things have happened */    tp_tests_proxy_run_until_dbus_queue_processed (test->dbus); @@ -182,7 +177,7 @@ teardown_services (Test *test,  }  static TpChannelDispatchOperation * -dispatch_operation_new (TpDBusDaemon *bus_daemon, +dispatch_operation_new (GDBusConnection *bus_connection,      const gchar *object_path,      GHashTable *immutable_properties,      GError **error) @@ -198,7 +193,7 @@ dispatch_operation_new (TpDBusDaemon *bus_daemon,    else      g_hash_table_ref (immutable_properties); -  factory = tp_client_factory_new (bus_daemon); +  factory = tp_client_factory_new (bus_connection);    self = _tp_client_factory_ensure_channel_dispatch_operation (factory,        object_path, immutable_properties, error); @@ -254,8 +249,8 @@ test_crash (Test *test,    g_assert (tp_proxy_get_invalidated (test->cdo) == NULL); -  g_dbus_connection_close_sync (test->private_conn, NULL, NULL); -  g_clear_object (&test->private_conn); +  g_dbus_connection_close_sync (test->private_dbus, NULL, NULL); +  g_clear_object (&test->private_dbus);    while (tp_proxy_get_invalidated (test->cdo) == NULL)      g_main_context_iteration (NULL, TRUE); diff --git a/tests/dbus/channel-dispatcher.c b/tests/dbus/channel-dispatcher.c index ba8f0f72f..b3f75dbb4 100644 --- a/tests/dbus/channel-dispatcher.c +++ b/tests/dbus/channel-dispatcher.c @@ -17,7 +17,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      TpChannelDispatcher *cd;      GError *error /* initialized where needed */; @@ -30,7 +30,7 @@ setup (Test *test,    tp_debug_set_flags ("all");    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->cd = NULL;  } diff --git a/tests/dbus/channel-introspect.c b/tests/dbus/channel-introspect.c index c3af63ce0..0dc5457ed 100644 --- a/tests/dbus/channel-introspect.c +++ b/tests/dbus/channel-introspect.c @@ -107,7 +107,7 @@ main (int argc,    TpHandleRepoIface *contact_repo;    TpTestsEchoChannel *service_props_chan;    TpTestsTextChannelGroup *service_props_group_chan; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpConnection *conn, *conn2;    TpChannel *chan, *chan2;    GError *error = NULL; @@ -128,7 +128,7 @@ main (int argc,    test_dbus = g_test_dbus_new (G_TEST_DBUS_NONE);    g_test_dbus_up (test_dbus); -  dbus = tp_tests_dbus_daemon_dup_or_die (); +  dbus = tp_tests_dbus_dup_or_die ();    tp_tests_create_conn (TP_TESTS_TYPE_CONTACTS_CONNECTION, "me@example.com",        TRUE, &service_conn_as_base, &conn); diff --git a/tests/dbus/channel-manager-request-properties.c b/tests/dbus/channel-manager-request-properties.c index 077d8931f..1daa2b4e0 100644 --- a/tests/dbus/channel-manager-request-properties.c +++ b/tests/dbus/channel-manager-request-properties.c @@ -25,7 +25,7 @@  typedef struct  {    GMainLoop *mainloop; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpTestsEchoConnection *service_conn;    TpTestsSimpleChannelManager *channel_manager; @@ -47,7 +47,7 @@ setup (Test *test,    tp_debug_set_flags ("all");    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->channel_manager = tp_tests_object_new_static_class (        TP_TESTS_TYPE_SIMPLE_CHANNEL_MANAGER, NULL); diff --git a/tests/dbus/channel-request.c b/tests/dbus/channel-request.c index 95f127293..a16e0cde7 100644 --- a/tests/dbus/channel-request.c +++ b/tests/dbus/channel-request.c @@ -53,10 +53,9 @@ test_simple_cr_class_init (TestSimpleCRClass *klass)  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus; -    GDBusConnection *private_conn; -    TpDBusDaemon *private_dbus; +    GDBusConnection *private_dbus;      GObject *cr_service;      /* Service side objects */ @@ -79,11 +78,10 @@ setup (Test *test,    tp_debug_set_flags ("all");    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    g_assert (test->dbus != NULL); -  test->private_conn = tp_tests_get_private_bus (); -  test->private_dbus = tp_dbus_daemon_new (test->private_conn); +  test->private_dbus = tp_tests_get_private_bus ();    g_assert (test->private_dbus != NULL);    /* Create (service and client sides) connection objects */ @@ -116,6 +114,8 @@ teardown (Test *test,        tp_dbus_daemon_release_name (test->private_dbus,            TP_CHANNEL_DISPATCHER_BUS_NAME, NULL); +      g_dbus_connection_close_sync (test->private_dbus, NULL, NULL); +        g_object_unref (test->private_dbus);        test->private_dbus = NULL;      } @@ -123,11 +123,6 @@ teardown (Test *test,    g_object_unref (test->cr_service);    test->cr_service = NULL; -  if (test->private_conn != NULL) -    g_dbus_connection_close_sync (test->private_conn, NULL, NULL); - -  g_clear_object (&test->private_conn); -    /* make sure any pending things have happened */    tp_tests_proxy_run_until_dbus_queue_processed (test->dbus); @@ -139,7 +134,7 @@ teardown (Test *test,  }  static TpChannelRequest * -channel_request_new (TpDBusDaemon *bus_daemon, +channel_request_new (GDBusConnection *bus_connection,      const gchar *object_path,      GHashTable *immutable_properties,      GError **error) @@ -155,7 +150,7 @@ channel_request_new (TpDBusDaemon *bus_daemon,    else      g_hash_table_ref (immutable_properties); -  factory = tp_client_factory_new (bus_daemon); +  factory = tp_client_factory_new (bus_connection);    self = _tp_client_factory_ensure_channel_request (factory, object_path,        immutable_properties, error); @@ -209,8 +204,8 @@ test_crash (Test *test,    g_assert (tp_proxy_get_invalidated (test->cr) == NULL); -  g_dbus_connection_close_sync (test->private_conn, NULL, NULL); -  g_clear_object (&test->private_conn); +  g_dbus_connection_close_sync (test->private_dbus, NULL, NULL); +  g_clear_object (&test->private_dbus);    while (tp_proxy_get_invalidated (test->cr) == NULL)      g_main_context_iteration (NULL, TRUE); diff --git a/tests/dbus/channel.c b/tests/dbus/channel.c index 3cf7dffa8..e226bf1ad 100644 --- a/tests/dbus/channel.c +++ b/tests/dbus/channel.c @@ -23,7 +23,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseConnection *base_connection; @@ -128,7 +128,7 @@ setup (Test *test,         gconstpointer data)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; diff --git a/tests/dbus/cm.c b/tests/dbus/cm.c index 778bb45f3..988da5a97 100644 --- a/tests/dbus/cm.c +++ b/tests/dbus/cm.c @@ -30,7 +30,7 @@ typedef ExampleEcho2ConnectionManagerClass MyConnectionManagerClass;  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      TpClientFactory *factory;      MyConnectionManager *service_cm; @@ -81,7 +81,7 @@ my_get_all (TpSvcDBusProperties *iface,    /* If necessary, emulate the CM exiting and coming back. */    if (cm->drop_name_on_get)      { -      TpDBusDaemon *dbus = tp_base_connection_manager_get_dbus_daemon ( +      GDBusConnection *dbus = tp_base_connection_manager_get_dbus_connection (            TP_BASE_CONNECTION_MANAGER (cm));        GString *string = g_string_new (TP_CM_BUS_NAME_BASE);        GError *error = NULL; @@ -123,7 +123,7 @@ setup (Test *test,    tp_debug_set_flags ("all");    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->factory = tp_client_factory_new (test->dbus);    test->service_cm = tp_tests_object_new_static_class ( diff --git a/tests/dbus/connection-aliasing.c b/tests/dbus/connection-aliasing.c index 6b51ea6ba..bc6e0cdbf 100644 --- a/tests/dbus/connection-aliasing.c +++ b/tests/dbus/connection-aliasing.c @@ -25,9 +25,8 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      GDBusConnection *client_gdbus; -    TpDBusDaemon *client_bus;      ExampleContactListConnection *service_conn;      TpBaseConnection *service_conn_as_base;      gchar *conn_name; @@ -49,14 +48,13 @@ setup (Test *test,    GQuark features[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 };    tp_debug_set_flags ("all"); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->mainloop = g_main_loop_new (NULL, FALSE);    test->error = NULL;    test->client_gdbus = tp_tests_get_private_bus (); -  test->client_bus = tp_dbus_daemon_new (test->client_gdbus); -  g_assert (test->client_bus != NULL); +  g_assert (test->client_gdbus != NULL);    test->service_conn = tp_tests_object_new_static_class (          EXAMPLE_TYPE_CONTACT_LIST_CONNECTION, @@ -74,7 +72,7 @@ setup (Test *test,    test->cwr_ready = FALSE;    test->cwr_error = NULL; -  test->conn = tp_tests_connection_new (test->client_bus, test->conn_name, +  test->conn = tp_tests_connection_new (test->client_gdbus, test->conn_name,        test->conn_path, &error);    g_assert (test->conn != NULL);    g_assert_no_error (error); @@ -118,8 +116,6 @@ teardown (Test *test,    g_object_unref (test->dbus);    test->dbus = NULL; -  g_object_unref (test->client_bus); -  test->client_bus = NULL;    g_dbus_connection_close_sync (test->client_gdbus, NULL, NULL);    g_object_unref (test->client_gdbus); diff --git a/tests/dbus/connection-balance.c b/tests/dbus/connection-balance.c index 2104af56e..5f8188f1a 100644 --- a/tests/dbus/connection-balance.c +++ b/tests/dbus/connection-balance.c @@ -180,9 +180,8 @@ unbalanced_connection_class_init (UnbalancedConnectionClass *cls)  /* -- Tests -- */  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      GDBusConnection *client_gdbus; -    TpDBusDaemon *client_bus;      TpTestsSimpleConnection *service_conn;      TpBaseConnection *service_conn_as_base;      gchar *conn_name; @@ -205,14 +204,13 @@ setup (Test *test,    GType conn_type = GPOINTER_TO_SIZE (data);    tp_debug_set_flags ("all"); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->mainloop = g_main_loop_new (NULL, FALSE);    test->error = NULL;    test->client_gdbus = tp_tests_get_private_bus (); -  test->client_bus = tp_dbus_daemon_new (test->client_gdbus); -  g_assert (test->client_bus != NULL); +  g_assert (test->client_gdbus != NULL);    test->service_conn = tp_tests_object_new_static_class (          conn_type, @@ -230,7 +228,7 @@ setup (Test *test,    test->cwr_ready = FALSE;    test->cwr_error = NULL; -  test->conn = tp_tests_connection_new (test->client_bus, test->conn_name, +  test->conn = tp_tests_connection_new (test->client_gdbus, test->conn_name,        test->conn_path, &error);    g_assert (test->conn != NULL);    g_assert_no_error (error); @@ -274,8 +272,6 @@ teardown (Test *test,    g_object_unref (test->dbus);    test->dbus = NULL; -  g_object_unref (test->client_bus); -  test->client_bus = NULL;    g_dbus_connection_close_sync (test->client_gdbus, NULL, NULL);    g_object_unref (test->client_gdbus); diff --git a/tests/dbus/connection-interests.c b/tests/dbus/connection-interests.c index 3b96674e1..0a9077134 100644 --- a/tests/dbus/connection-interests.c +++ b/tests/dbus/connection-interests.c @@ -78,9 +78,8 @@ interested_connection_class_init (InterestedConnectionClass *cls)  }  typedef struct { -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      GDBusConnection *client_gdbus; -    TpDBusDaemon *client_bus;      TpTestsSimpleConnection *service_conn;      TpBaseConnection *service_conn_as_base;      gchar *conn_name; @@ -151,11 +150,10 @@ setup (Test *test,    GQuark features[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 };    tp_debug_set_flags ("all"); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->client_gdbus = tp_tests_get_private_bus (); -  test->client_bus = tp_dbus_daemon_new (test->client_gdbus); -  g_assert (test->client_bus != NULL); +  g_assert (test->client_gdbus != NULL);    test->service_conn = tp_tests_object_new_static_class (          interested_connection_get_type (), @@ -173,7 +171,7 @@ setup (Test *test,    test->cwr_ready = FALSE;    test->cwr_error = NULL; -  test->conn = tp_tests_connection_new (test->client_bus, test->conn_name, +  test->conn = tp_tests_connection_new (test->client_gdbus, test->conn_name,        test->conn_path, &error);    g_assert_no_error (error);    g_assert (test->conn != NULL); @@ -242,8 +240,6 @@ teardown (Test *test,    g_object_unref (test->dbus);    test->dbus = NULL; -  g_object_unref (test->client_bus); -  test->client_bus = NULL;    if (test->client_gdbus != NULL)      { @@ -266,7 +262,7 @@ test_interested_client (Test *test,        TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS1);    /* run until (after) the AddClientInterest calls have gone out */ -  tp_tests_proxy_run_until_dbus_queue_processed (test->client_bus); +  tp_tests_proxy_run_until_dbus_queue_processed (test->client_gdbus);    /* we auto-release the Location client interest by disposing the client     * connection */ @@ -275,7 +271,7 @@ test_interested_client (Test *test,    test->conn = NULL;    /* run until (after) the RemoveClientInterest call has gone out */ -  tp_tests_proxy_run_until_dbus_queue_processed (test->client_bus); +  tp_tests_proxy_run_until_dbus_queue_processed (test->client_gdbus);    /* then, run until (after) the CM should have processed both ACI and RCI */    tp_tests_proxy_run_until_dbus_queue_processed (test->dbus); diff --git a/tests/dbus/connection.c b/tests/dbus/connection.c index 1441c48ca..c896fe644 100644 --- a/tests/dbus/connection.c +++ b/tests/dbus/connection.c @@ -22,7 +22,7 @@  #include "tests/lib/util.h"  typedef struct { -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      TpTestsSimpleConnection *service_conn;      TpBaseConnection *service_conn_as_base;      gchar *conn_name; @@ -56,7 +56,7 @@ setup (Test *test,    invalidated_for_test.domain = TP_ERROR;    tp_debug_set_flags ("all"); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->service_conn = TP_TESTS_SIMPLE_CONNECTION (      tp_tests_object_new_static_class ( diff --git a/tests/dbus/contact-list-client.c b/tests/dbus/contact-list-client.c index 4416e54fb..686fb9aa2 100644 --- a/tests/dbus/contact-list-client.c +++ b/tests/dbus/contact-list-client.c @@ -21,7 +21,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseConnection *base_connection; @@ -48,7 +48,7 @@ setup (Test *test,    GQuark conn_features[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 };    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; diff --git a/tests/dbus/contact-lists.c b/tests/dbus/contact-lists.c index e32d0283d..7031170bf 100644 --- a/tests/dbus/contact-lists.c +++ b/tests/dbus/contact-lists.c @@ -71,7 +71,7 @@ log_entry_free (LogEntry *le)  }  typedef struct { -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      ExampleContactListConnection *service_conn;      TpBaseConnection *service_conn_as_base;      gchar *conn_name; @@ -282,7 +282,7 @@ setup_pre_connect (    const gchar *account;    tp_debug_set_flags ("all"); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->main_loop = g_main_loop_new (NULL, FALSE);    /* Some tests want 'account' to be an invalid identifier, so that Connect() diff --git a/tests/dbus/contacts.c b/tests/dbus/contacts.c index 6d1189708..35e36555a 100644 --- a/tests/dbus/contacts.c +++ b/tests/dbus/contacts.c @@ -658,7 +658,7 @@ make_the_connection_disappear (Fixture *f)    gboolean ok;    tp_dbus_daemon_unregister_object ( -      tp_base_connection_get_dbus_daemon (f->base_connection), +      tp_base_connection_get_dbus_connection (f->base_connection),        f->base_connection);    /* check that that worked */    ok = tp_cli_connection_run_connect (f->client_conn, -1, @@ -678,7 +678,7 @@ put_the_connection_back (Fixture *f)    gboolean ok;    tp_dbus_daemon_register_object ( -      tp_base_connection_get_dbus_daemon (f->base_connection), +      tp_base_connection_get_dbus_connection (f->base_connection),        tp_base_connection_get_object_path (f->base_connection),        f->base_connection);    /* check that *that* worked */ diff --git a/tests/dbus/dbus-tube.c b/tests/dbus/dbus-tube.c index 3fc693dae..169a29f9b 100644 --- a/tests/dbus/dbus-tube.c +++ b/tests/dbus/dbus-tube.c @@ -22,7 +22,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseConnection *base_connection; @@ -47,7 +47,7 @@ setup (Test *test,         gconstpointer data)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; diff --git a/tests/dbus/dbus.c b/tests/dbus/dbus.c index 15a632214..d7f509223 100644 --- a/tests/dbus/dbus.c +++ b/tests/dbus/dbus.c @@ -105,33 +105,6 @@ test_validation (void)          TP_DBUS_NAME_TYPE_ANY, NULL));  } -static void -test_properties (void) -{ -  TpDBusDaemon *bus = tp_dbus_daemon_dup (NULL); -  gchar *bus_name; -  gchar *object_path; -  GDBusConnection *dbus_conn; - -  g_object_get (bus, -      "dbus-connection", &dbus_conn, -      "bus-name", &bus_name, -      "object-path", &object_path, -      NULL); - -  if (object_path[0] != '/') -    g_error ("supposed object-path \"%s\" doesn't start with a /", -        object_path); - -  g_assert_cmpstr (bus_name, ==, "org.freedesktop.DBus"); -  g_assert (G_IS_DBUS_CONNECTION (dbus_conn)); - -  g_free (bus_name); -  g_free (object_path); -  g_object_unref (dbus_conn); -  g_object_unref (bus); -} -  int  main (int argc,        char **argv) @@ -139,7 +112,6 @@ main (int argc,    tp_tests_init (&argc, &argv);    g_test_add_func ("/dbus/validation", test_validation); -  g_test_add_func ("/dbus-daemon/properties", test_properties);    return tp_tests_run_with_bus ();  } diff --git a/tests/dbus/debug-client.c b/tests/dbus/debug-client.c index 6a36c7552..c9096f6c2 100644 --- a/tests/dbus/debug-client.c +++ b/tests/dbus/debug-client.c @@ -18,7 +18,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side object */      TpDebugSender *sender; @@ -39,7 +39,7 @@ setup (Test *test,    TpClientFactory *factory;    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; diff --git a/tests/dbus/disconnection.c b/tests/dbus/disconnection.c index 4e3c2dfaf..d8ecdf99c 100644 --- a/tests/dbus/disconnection.c +++ b/tests/dbus/disconnection.c @@ -132,7 +132,7 @@ static void  setup (Fixture *f,      gconstpointer user_data)  { -  TpDBusDaemon *dbus_daemon; +  GDBusConnection *dbus_connection;    GError *error = NULL;    global_fixture = f; @@ -149,7 +149,7 @@ setup (Fixture *f,    f->factory = tp_client_factory_dup (&error);    g_assert_no_error (error); -  dbus_daemon = tp_client_factory_get_dbus_daemon (f->factory); +  dbus_connection = tp_client_factory_get_dbus_connection (f->factory);    /* Any random object with an interface: what matters is that it can     * accept a method call and emit a signal. We use the Properties @@ -157,14 +157,11 @@ setup (Fixture *f,    f->cd_service = tp_tests_object_new_static_class (        TP_TESTS_TYPE_SIMPLE_CHANNEL_DISPATCHER,        NULL); -  tp_dbus_daemon_register_object (dbus_daemon, "/", f->cd_service); +  tp_dbus_daemon_register_object (dbus_connection, "/", f->cd_service);    f->private_gdbus = tp_tests_get_private_bus ();    g_assert (f->private_gdbus != NULL); -  dbus_daemon = tp_dbus_daemon_new (f->private_gdbus); -  g_assert (dbus_daemon != NULL); -  f->private_factory = tp_client_factory_new (dbus_daemon); -  g_object_unref (dbus_daemon); +  f->private_factory = tp_client_factory_new (f->private_gdbus);  }  static void @@ -206,7 +203,7 @@ new_proxy (Fixture *f,    return tp_tests_object_new_static_class (TP_TYPE_PROXY,        "bus-name", tp_dbus_daemon_get_unique_name ( -          tp_client_factory_get_dbus_daemon (f->factory)), +          tp_client_factory_get_dbus_connection (f->factory)),        "object-path", "/",        "factory", local_factory,        NULL); diff --git a/tests/dbus/file-transfer-channel.c b/tests/dbus/file-transfer-channel.c index 9daa525f5..9b473397a 100644 --- a/tests/dbus/file-transfer-channel.c +++ b/tests/dbus/file-transfer-channel.c @@ -42,7 +42,7 @@ TestContext contexts[] = {  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseConnection *base_connection; @@ -239,7 +239,7 @@ setup (Test *test,         gconstpointer data)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; diff --git a/tests/dbus/get-interface-after-invalidate.c b/tests/dbus/get-interface-after-invalidate.c deleted file mode 100644 index b6a868166..000000000 --- a/tests/dbus/get-interface-after-invalidate.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "config.h" - -#include <telepathy-glib/dbus.h> -#include <telepathy-glib/errors.h> -#include <telepathy-glib/interfaces.h> -#include <telepathy-glib/proxy-subclass.h> - -#include "tests/lib/util.h" - -static void -test_get_interface_after_invalidate (void) -{ -  TpDBusDaemon *bus_daemon; -  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); - -  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 (!has_props); -  g_assert (error != NULL); -  g_assert_cmpuint (error->domain, ==, invalidation_reason.domain); -  g_assert_cmpint (error->code, ==, invalidation_reason.code); -  g_assert_cmpstr (error->message, ==, invalidation_reason.message); - -  g_error_free (error); -  g_object_unref (bus_daemon); -} - -int -main (int argc, -    char **argv) -{ -  tp_tests_init (&argc, &argv); - -  g_test_add_func ("/test-get-interface-after-invalidate", -      test_get_interface_after_invalidate); - -  return tp_tests_run_with_bus (); -} diff --git a/tests/dbus/handle-repo.c b/tests/dbus/handle-repo.c index cda9940a8..19e38715c 100644 --- a/tests/dbus/handle-repo.c +++ b/tests/dbus/handle-repo.c @@ -20,7 +20,7 @@ static void  test_handles (Fixture *f,      gconstpointer data)  { -  TpDBusDaemon *bus_daemon = tp_tests_dbus_daemon_dup_or_die (); +  GDBusConnection *bus_connection = tp_tests_dbus_dup_or_die ();    TpHandleRepoIface *tp_repo = NULL;    GError *error = NULL;    TpHandle handle = 0; @@ -72,10 +72,10 @@ test_handles (Fixture *f,    /* wait for D-Bus to catch up (just to detect any crashes) but don't assert     * that the handle doesn't remain valid - unref is a no-op since     * 0.13.8 */ -  tp_tests_proxy_run_until_dbus_queue_processed (bus_daemon); +  tp_tests_proxy_run_until_dbus_queue_processed (bus_connection);    g_object_unref (tp_repo); -  g_object_unref (bus_daemon); +  g_object_unref (bus_connection);  }  static void diff --git a/tests/dbus/list-cm-no-cm.c b/tests/dbus/list-cm-no-cm.c index a8731a39b..99570f22f 100644 --- a/tests/dbus/list-cm-no-cm.c +++ b/tests/dbus/list-cm-no-cm.c @@ -16,7 +16,7 @@  typedef struct {    GMainLoop *mainloop; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpClientFactory *factory;    GError *error;  } Test; @@ -28,7 +28,7 @@ setup (Test *test,    tp_debug_set_flags ("all");    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->factory = tp_client_factory_new (test->dbus);    test->error = NULL; diff --git a/tests/dbus/long-connection-name.c b/tests/dbus/long-connection-name.c index 9c7dc38ba..d9552868e 100644 --- a/tests/dbus/long-connection-name.c +++ b/tests/dbus/long-connection-name.c @@ -35,7 +35,7 @@ int  main (int argc,        char **argv)  { -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpTestsEchoConnection *service_conn;    TpBaseConnection *service_conn_as_base;    GError *error = NULL; @@ -49,7 +49,7 @@ main (int argc,    test_dbus = g_test_dbus_new (G_TEST_DBUS_NONE);    g_test_dbus_up (test_dbus); -  dbus = tp_tests_dbus_daemon_dup_or_die (); +  dbus = tp_tests_dbus_dup_or_die ();    MYASSERT (strlen (LONG_ACCOUNT_IS_LONG) == 256, "");    service_conn = TP_TESTS_ECHO_CONNECTION (tp_tests_object_new_static_class ( diff --git a/tests/dbus/message-mixin.c b/tests/dbus/message-mixin.c index 6a651be42..c7e04d87b 100644 --- a/tests/dbus/message-mixin.c +++ b/tests/dbus/message-mixin.c @@ -212,8 +212,8 @@ test (Fixture *f,    g_hash_table_unref (parameters); -  conn = tp_tests_connection_new (tp_client_factory_get_dbus_daemon (factory), -      name, conn_path, &error); +  conn = tp_tests_connection_new ( +      tp_client_factory_get_dbus_connection (factory), name, conn_path, &error);    MYASSERT (conn != NULL, "");    g_assert_no_error (error); diff --git a/tests/dbus/properties.c b/tests/dbus/properties.c index d8bb1ac5c..649f7b000 100644 --- a/tests/dbus/properties.c +++ b/tests/dbus/properties.c @@ -223,7 +223,7 @@ int  main (int argc, char **argv)  {    Context ctx; -  TpDBusDaemon *dbus_daemon; +  GDBusConnection *dbus_connection;    TpClientFactory *factory;    GTestDBus *test_dbus;    int ret; @@ -234,14 +234,14 @@ main (int argc, char **argv)    test_dbus = g_test_dbus_new (G_TEST_DBUS_NONE);    g_test_dbus_up (test_dbus); -  dbus_daemon = tp_tests_dbus_daemon_dup_or_die (); +  dbus_connection = tp_tests_dbus_dup_or_die ();    factory = tp_client_factory_dup (NULL);    ctx.obj = tp_tests_object_new_static_class (TEST_TYPE_PROPERTIES, NULL); -  tp_dbus_daemon_register_object (dbus_daemon, "/", ctx.obj); +  tp_dbus_daemon_register_object (dbus_connection, "/", ctx.obj);    /* Open a D-Bus connection to myself */    ctx.proxy = TP_PROXY (tp_tests_object_new_static_class (TP_TYPE_PROXY, -      "bus-name", tp_dbus_daemon_get_unique_name (dbus_daemon), +      "bus-name", tp_dbus_daemon_get_unique_name (dbus_connection),        "object-path", "/",        "factory", factory,        NULL)); @@ -258,7 +258,7 @@ main (int argc, char **argv)    g_object_unref (ctx.obj);    g_object_unref (ctx.proxy); -  g_object_unref (dbus_daemon); +  g_object_unref (dbus_connection);    g_object_unref (factory);    g_test_dbus_down (test_dbus); diff --git a/tests/dbus/protocol-objects.c b/tests/dbus/protocol-objects.c index 4e7f6a9b2..c9acc66b6 100644 --- a/tests/dbus/protocol-objects.c +++ b/tests/dbus/protocol-objects.c @@ -24,7 +24,7 @@  typedef struct  {    GMainLoop *mainloop; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpClientFactory *factory;    GError *error /* statically initialized to NULL */ ; @@ -47,7 +47,7 @@ setup (Test *test,    tp_debug_set_flags ("all");    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_dbus_daemon_dup (NULL); +  test->dbus = tp_tests_dbus_dup_or_die ();    g_assert (test->dbus != NULL);    test->factory = tp_automatic_client_factory_new (test->dbus); diff --git a/tests/dbus/proxy-preparation.c b/tests/dbus/proxy-preparation.c index 0ede94f96..db969ba4f 100644 --- a/tests/dbus/proxy-preparation.c +++ b/tests/dbus/proxy-preparation.c @@ -19,7 +19,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseConnection *base_connection; @@ -56,7 +56,7 @@ setup (Test *test,         gconstpointer data)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; diff --git a/tests/dbus/room-list.c b/tests/dbus/room-list.c index 0b3dfac35..da9b30c01 100644 --- a/tests/dbus/room-list.c +++ b/tests/dbus/room-list.c @@ -22,7 +22,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseConnection *base_connection; @@ -72,7 +72,7 @@ setup (Test *test,         gconstpointer data)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; diff --git a/tests/dbus/self-handle.c b/tests/dbus/self-handle.c index 9dce5ee43..44d81c6fe 100644 --- a/tests/dbus/self-handle.c +++ b/tests/dbus/self-handle.c @@ -23,7 +23,7 @@  #include "tests/lib/util.h"  typedef struct { -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpTestsSimpleConnection *service_conn;    TpBaseConnection *service_conn_as_base;    gchar *name; @@ -40,7 +40,7 @@ setup (Fixture *f,  {    gboolean ok; -  f->dbus = tp_tests_dbus_daemon_dup_or_die (); +  f->dbus = tp_tests_dbus_dup_or_die ();    f->service_conn = TP_TESTS_SIMPLE_CONNECTION (        tp_tests_object_new_static_class (TP_TESTS_TYPE_CONTACTS_CONNECTION, diff --git a/tests/dbus/self-presence.c b/tests/dbus/self-presence.c index 971006a8d..df24f67da 100644 --- a/tests/dbus/self-presence.c +++ b/tests/dbus/self-presence.c @@ -129,7 +129,7 @@ static void  test (Fixture *f,      gconstpointer data)  { -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpTestsContactsConnection *service_conn;    TpBaseConnection *service_conn_as_base;    gchar *name; @@ -151,7 +151,7 @@ test (Fixture *f,    test_dbus = g_test_dbus_new (G_TEST_DBUS_NONE);    g_test_dbus_up (test_dbus); -  dbus = tp_tests_dbus_daemon_dup_or_die (); +  dbus = tp_tests_dbus_dup_or_die ();    service_conn = TP_TESTS_CONTACTS_CONNECTION (        tp_tests_object_new_static_class ( diff --git a/tests/dbus/simple-approver.c b/tests/dbus/simple-approver.c index 7a3fcc732..409a4226a 100644 --- a/tests/dbus/simple-approver.c +++ b/tests/dbus/simple-approver.c @@ -28,7 +28,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      TpClientFactory *factory;      /* Service side objects */ @@ -60,7 +60,7 @@ setup (Test *test,    TpHandleRepoIface *contact_repo;    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->factory = tp_client_factory_dup (NULL);    test->error = NULL; diff --git a/tests/dbus/simple-handler.c b/tests/dbus/simple-handler.c index 5d435737a..0d3ede09b 100644 --- a/tests/dbus/simple-handler.c +++ b/tests/dbus/simple-handler.c @@ -26,7 +26,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      TpClientFactory *factory;      /* Service side objects */ @@ -55,7 +55,7 @@ setup (Test *test,    TpHandleRepoIface *contact_repo;    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->factory = tp_client_factory_dup (NULL);    test->error = NULL; @@ -172,7 +172,7 @@ create_simple_handler (Test *test,    /* Create service-side Client object */    test->simple_handler = tp_tests_object_new_static_class (        TP_TYPE_SIMPLE_HANDLER, -      "dbus-daemon", test->dbus, +      "factory", test->factory,        "bypass-approval", bypass_approval,        "requests", requests,        "name", "MySimpleHandler", diff --git a/tests/dbus/simple-observer.c b/tests/dbus/simple-observer.c index 1b9a31d86..467eb1e10 100644 --- a/tests/dbus/simple-observer.c +++ b/tests/dbus/simple-observer.c @@ -25,7 +25,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      TpClientFactory *factory;      /* Service side objects */ @@ -54,7 +54,7 @@ setup (Test *test,    TpHandleRepoIface *contact_repo;    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->factory = tp_client_factory_dup (NULL);    test->error = NULL; @@ -146,7 +146,7 @@ create_simple_observer (Test *test,    /* Create service-side Client object */    test->simple_observer = tp_tests_object_new_static_class (        TP_TYPE_SIMPLE_OBSERVER, -      "dbus-daemon", test->dbus, +      "factory", test->factory,        "recover", recover,        "name", "MySimpleObserver",        "uniquify-name", FALSE, diff --git a/tests/dbus/stream-tube.c b/tests/dbus/stream-tube.c index 53dc93b7d..4669051fd 100644 --- a/tests/dbus/stream-tube.c +++ b/tests/dbus/stream-tube.c @@ -59,7 +59,7 @@ static gboolean have_creds = FALSE;  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseConnection *base_connection; @@ -86,7 +86,7 @@ setup (Test *test,         gconstpointer data)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; diff --git a/tests/dbus/text-channel.c b/tests/dbus/text-channel.c index 876e344a4..a8df1d94f 100644 --- a/tests/dbus/text-channel.c +++ b/tests/dbus/text-channel.c @@ -23,7 +23,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      /* Service side objects */      TpBaseConnection *base_connection; @@ -121,7 +121,7 @@ setup (Test *test,         gconstpointer data)  {    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; diff --git a/tests/dbus/tls-certificate.c b/tests/dbus/tls-certificate.c index e1c1bfae4..09925a5c5 100644 --- a/tests/dbus/tls-certificate.c +++ b/tests/dbus/tls-certificate.c @@ -19,7 +19,7 @@  typedef struct {      GMainLoop *mainloop; -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      gchar *cert_path;      /* Service side objects */ @@ -44,7 +44,7 @@ setup (Test *test,    GArray *cert;    test->mainloop = g_main_loop_new (NULL, FALSE); -  test->dbus = tp_tests_dbus_daemon_dup_or_die (); +  test->dbus = tp_tests_dbus_dup_or_die ();    test->error = NULL; @@ -67,7 +67,7 @@ setup (Test *test,        "object-path", test->cert_path,        "certificate-type", "x509",        "certificate-chain-data", chain_data, -      "dbus-daemon", test->dbus, +      "dbus-connection", test->dbus,        NULL);    g_ptr_array_unref (chain_data); diff --git a/tests/dbus/unsupported-interface.c b/tests/dbus/unsupported-interface.c index 7ff94d777..9c2978e7a 100644 --- a/tests/dbus/unsupported-interface.c +++ b/tests/dbus/unsupported-interface.c @@ -23,7 +23,7 @@  #include "tests/lib/util.h"  typedef struct { -    TpDBusDaemon *dbus; +    GDBusConnection *dbus;      TpTestsSimpleConnection *service_conn;      TpBaseConnection *service_conn_as_base;      gchar *conn_name; @@ -41,7 +41,7 @@ setup (Fixture *f,      gconstpointer data)  {    tp_debug_set_flags ("all"); -  f->dbus = tp_tests_dbus_daemon_dup_or_die (); +  f->dbus = tp_tests_dbus_dup_or_die ();    f->service_conn = TP_TESTS_SIMPLE_CONNECTION (      tp_tests_object_new_static_class ( diff --git a/tests/lib/logger-test-helper.c b/tests/lib/logger-test-helper.c index 64c72a29a..928e28345 100644 --- a/tests/lib/logger-test-helper.c +++ b/tests/lib/logger-test-helper.c @@ -27,7 +27,7 @@  #include "util.h"  void -tpl_test_create_and_prepare_account (TpDBusDaemon *dbus, +tpl_test_create_and_prepare_account (GDBusConnection *dbus,      TpClientFactory *factory,      const gchar *path,      TpAccount **account, @@ -56,7 +56,7 @@ tpl_test_create_and_prepare_account (TpDBusDaemon *dbus,  }  void -tpl_test_release_account (TpDBusDaemon *dbus, +tpl_test_release_account (GDBusConnection *dbus,      TpAccount *account,      TpTestsSimpleAccount *account_service)  { diff --git a/tests/lib/logger-test-helper.h b/tests/lib/logger-test-helper.h index cb836f257..d8425294e 100644 --- a/tests/lib/logger-test-helper.h +++ b/tests/lib/logger-test-helper.h @@ -25,13 +25,13 @@  #include "simple-account.h" -void tpl_test_create_and_prepare_account (TpDBusDaemon *dbus, +void tpl_test_create_and_prepare_account (GDBusConnection *dbus,      TpClientFactory *factory,      const gchar *path,      TpAccount **account,      TpTestsSimpleAccount **account_service); -void tpl_test_release_account (TpDBusDaemon *dbus, +void tpl_test_release_account (GDBusConnection *dbus,      TpAccount *account,      TpTestsSimpleAccount *account_service); diff --git a/tests/lib/simple-channel-dispatcher.c b/tests/lib/simple-channel-dispatcher.c index 450df5654..da159bf8e 100644 --- a/tests/lib/simple-channel-dispatcher.c +++ b/tests/lib/simple-channel-dispatcher.c @@ -76,7 +76,7 @@ create_channel_request (TpTestsSimpleChannelDispatcher *self,    GPtrArray *requests;    static guint count = 0;    gchar *path; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    GHashTable *hints;    requests = g_ptr_array_sized_new (1); @@ -99,7 +99,7 @@ create_channel_request (TpTestsSimpleChannelDispatcher *self,    g_ptr_array_unref (requests); -  dbus = tp_dbus_daemon_dup (NULL); +  dbus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);    g_assert (dbus != NULL);    tp_dbus_daemon_register_object (dbus, path, chan_request); diff --git a/tests/lib/tls-certificate.c b/tests/lib/tls-certificate.c index 9a1d441c5..0ebea7d3e 100644 --- a/tests/lib/tls-certificate.c +++ b/tests/lib/tls-certificate.c @@ -47,7 +47,7 @@ struct _TpTestsTLSCertificatePrivate {    GPtrArray *rejections;    GPtrArray *cert_data; -  TpDBusDaemon *daemon; +  GDBusConnection *dbus_connection;    gboolean dispose_has_run;  }; @@ -60,7 +60,7 @@ enum {    PROP_CERTIFICATE_CHAIN_DATA,    /* not exported */ -  PROP_DBUS_DAEMON, +  PROP_DBUS_CONNECTION,    NUM_PROPERTIES  }; @@ -115,8 +115,8 @@ tp_tests_tls_certificate_set_property (GObject *object,      case PROP_CERTIFICATE_CHAIN_DATA:        self->priv->cert_data = g_value_dup_boxed (value);        break; -    case PROP_DBUS_DAEMON: -      self->priv->daemon = g_value_dup_object (value); +    case PROP_DBUS_CONNECTION: +      self->priv->dbus_connection = g_value_dup_object (value);        break;      default:        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, value); @@ -149,7 +149,7 @@ tp_tests_tls_certificate_dispose (GObject *object)    self->priv->dispose_has_run = TRUE; -  tp_clear_object (&self->priv->daemon); +  tp_clear_object (&self->priv->dbus_connection);    G_OBJECT_CLASS (tp_tests_tls_certificate_parent_class)->dispose (object);  } @@ -165,7 +165,7 @@ tp_tests_tls_certificate_constructed (GObject *object)      chain_up (object);    /* register the certificate on the bus */ -  tp_dbus_daemon_register_object (self->priv->daemon, +  tp_dbus_daemon_register_object (self->priv->dbus_connection,        self->priv->object_path, self);  } @@ -242,12 +242,12 @@ tp_tests_tls_certificate_class_init (TpTestsTLSCertificateClass *klass)        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);    g_object_class_install_property (oclass, PROP_CERTIFICATE_CHAIN_DATA, pspec); -  pspec = g_param_spec_object ("dbus-daemon", -      "The DBus daemon connection", -      "The connection to the DBus daemon owning the CM", -      TP_TYPE_DBUS_DAEMON, +  pspec = g_param_spec_object ("dbus-connection", +      "The DBus connection", +      "The connection to the DBus owning the CM", +      G_TYPE_DBUS_CONNECTION,        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); -  g_object_class_install_property (oclass, PROP_DBUS_DAEMON, pspec); +  g_object_class_install_property (oclass, PROP_DBUS_CONNECTION, pspec);    klass->dbus_props_class.interfaces = prop_interfaces;    tp_dbus_properties_mixin_class_init (oclass, diff --git a/tests/lib/util.c b/tests/lib/util.c index b8fd1dc0c..a0d2ee4cc 100644 --- a/tests/lib/util.c +++ b/tests/lib/util.c @@ -99,27 +99,21 @@ tp_tests_run_with_bus (void)    return ret;  } -TpDBusDaemon * -tp_tests_dbus_daemon_dup_or_die (void) +GDBusConnection * +tp_tests_dbus_dup_or_die (void)  { -  TpDBusDaemon *d; - -  d = tp_dbus_daemon_dup (NULL); +  GDBusConnection *d; +  GError *error = NULL; -  /* In a shared library, this would be very bad (see fd.o #18832), but in a -   * regression test that's going to be run under a temporary session bus, -   * it's just what we want. */ -  if (d == NULL) -    { -      g_error ("Unable to connect to session bus"); -    } +  d = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); +  g_assert_no_error (error);    return d;  }  static void -queue_get_id_cb (TpDBusDaemon *proxy G_GNUC_UNUSED, -    const gchar *out G_GNUC_UNUSED, +queue_get_all_cb (TpProxy *proxy G_GNUC_UNUSED, +    GHashTable *out G_GNUC_UNUSED,      const GError *error G_GNUC_UNUSED,      gpointer user_data,      GObject *weak_object G_GNUC_UNUSED) @@ -128,11 +122,9 @@ queue_get_id_cb (TpDBusDaemon *proxy G_GNUC_UNUSED,  }  static void -queue_get_all_cb (TpProxy *proxy G_GNUC_UNUSED, -    GHashTable *out G_GNUC_UNUSED, -    const GError *error G_GNUC_UNUSED, -    gpointer user_data, -    GObject *weak_object G_GNUC_UNUSED) +queue_gdbus_call_cb (GObject *object, +    GAsyncResult *result, +    gpointer user_data)  {    g_main_loop_quit (user_data);  } @@ -142,8 +134,11 @@ tp_tests_proxy_run_until_dbus_queue_processed (gpointer proxy)  {    GMainLoop *loop = g_main_loop_new (NULL, FALSE); -  g_assert (TP_IS_PROXY (proxy)); -  g_assert (tp_proxy_get_invalidated (proxy) == NULL); +  if (!G_IS_DBUS_CONNECTION (proxy)) +    { +      g_assert (TP_IS_PROXY (proxy)); +      g_assert (tp_proxy_get_invalidated (proxy) == NULL); +    }    /* We used to use Introspect() on @proxy here, but because GDBus implements     * them internally without using a GDBusMethodInvocation, the replies to @@ -156,9 +151,15 @@ tp_tests_proxy_run_until_dbus_queue_processed (gpointer proxy)     * that the object *does* implement don't jump the queue.     *     * https://bugzilla.gnome.org/show_bug.cgi?id=726259 */ -  if (TP_IS_DBUS_DAEMON (proxy)) -    tp_cli_dbus_daemon_call_get_id (proxy, -1, -        queue_get_id_cb, loop, NULL, NULL); +  if (G_IS_DBUS_CONNECTION (proxy)) +    { +      g_dbus_connection_call (proxy, +          "org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetId", +          g_variant_new ("()"), +          G_VARIANT_TYPE ("(s)"), +          G_DBUS_CALL_FLAGS_NONE, +          -1, NULL, queue_gdbus_call_cb, loop); +    }    else if (TP_IS_ACCOUNT (proxy))      tp_cli_dbus_properties_call_get_all (proxy, -1, TP_IFACE_ACCOUNT,          queue_get_all_cb, loop, NULL, NULL); @@ -288,7 +289,7 @@ tp_tests_create_conn (GType conn_type,      TpBaseConnection **service_conn,      TpConnection **client_conn)  { -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    gchar *name;    gchar *conn_path;    GError *error = NULL; @@ -297,7 +298,7 @@ tp_tests_create_conn (GType conn_type,    g_assert (service_conn != NULL);    g_assert (client_conn != NULL); -  dbus = tp_tests_dbus_daemon_dup_or_die (); +  dbus = tp_tests_dbus_dup_or_die ();    *service_conn = tp_tests_object_new_static_class (          conn_type, @@ -606,7 +607,7 @@ tp_tests_channel_assert_expect_members (TpChannel *channel,  }  TpConnection * -tp_tests_connection_new (TpDBusDaemon *dbus, +tp_tests_connection_new (GDBusConnection *dbus,      const gchar *bus_name,      const gchar *object_path,      GError **error) @@ -615,7 +616,7 @@ tp_tests_connection_new (TpDBusDaemon *dbus,    gchar *dup_path = NULL;    TpConnection *ret = NULL; -  g_return_val_if_fail (TP_IS_DBUS_DAEMON (dbus), NULL); +  g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus), NULL);    g_return_val_if_fail (object_path != NULL ||                          (bus_name != NULL && bus_name[0] != ':'), NULL); @@ -640,7 +641,7 @@ finally:  }  TpAccount * -tp_tests_account_new (TpDBusDaemon *dbus, +tp_tests_account_new (GDBusConnection *dbus,      const gchar *object_path,      GError **error)  { diff --git a/tests/lib/util.h b/tests/lib/util.h index 304c3a572..d523e703b 100644 --- a/tests/lib/util.h +++ b/tests/lib/util.h @@ -15,7 +15,7 @@  gint tp_tests_run_with_bus (void); -TpDBusDaemon *tp_tests_dbus_daemon_dup_or_die (void); +GDBusConnection *tp_tests_dbus_dup_or_die (void);  void tp_tests_proxy_run_until_dbus_queue_processed (gpointer proxy); @@ -85,12 +85,12 @@ TpContact *tp_tests_connection_run_until_contact_by_id (  void tp_tests_channel_assert_expect_members (TpChannel *channel,      TpIntset *expected_members); -TpConnection *tp_tests_connection_new (TpDBusDaemon *dbus, +TpConnection *tp_tests_connection_new (GDBusConnection *dbus,      const gchar *bus_name,      const gchar *object_path,      GError **error); -TpAccount *tp_tests_account_new (TpDBusDaemon *dbus, +TpAccount *tp_tests_account_new (GDBusConnection *dbus,      const gchar *object_path,      GError **error); diff --git a/tests/logger/dbus/test-log-manager.c b/tests/logger/dbus/test-log-manager.c index 3a14706ad..45434b393 100644 --- a/tests/logger/dbus/test-log-manager.c +++ b/tests/logger/dbus/test-log-manager.c @@ -28,7 +28,7 @@ typedef struct  {    GMainLoop *main_loop; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpAccount *account;    TpTestsSimpleAccount *account_service;    TpClientFactory *factory; @@ -125,7 +125,7 @@ setup_service (TestCaseFixture* fixture,    g_assert (params != NULL); -  fixture->dbus = tp_tests_dbus_daemon_dup_or_die (); +  fixture->dbus = tp_tests_dbus_dup_or_die ();    g_assert (fixture->dbus != NULL);    tp_dbus_daemon_request_name (fixture->dbus, diff --git a/tests/logger/dbus/test-tpl-log-iter-pidgin.c b/tests/logger/dbus/test-tpl-log-iter-pidgin.c index ef68c11d5..373685b99 100644 --- a/tests/logger/dbus/test-tpl-log-iter-pidgin.c +++ b/tests/logger/dbus/test-tpl-log-iter-pidgin.c @@ -22,7 +22,7 @@ typedef struct    GMainLoop *main_loop;    TplLogStore *store;    TpAccount *account; -  TpDBusDaemon *bus; +  GDBusConnection *bus;    TpClientFactory *factory;    TpTestsSimpleAccount *account_service;  } PidginTestCaseFixture; @@ -61,7 +61,7 @@ setup (PidginTestCaseFixture* fixture,    fixture->store = _tpl_log_store_pidgin_new (); -  fixture->bus = tp_tests_dbus_daemon_dup_or_die (); +  fixture->bus = tp_tests_dbus_dup_or_die ();    g_assert (fixture->bus != NULL);    tp_dbus_daemon_request_name (fixture->bus, diff --git a/tests/logger/dbus/test-tpl-log-iter-xml.c b/tests/logger/dbus/test-tpl-log-iter-xml.c index 8f7d58d89..58ccb4c02 100644 --- a/tests/logger/dbus/test-tpl-log-iter-xml.c +++ b/tests/logger/dbus/test-tpl-log-iter-xml.c @@ -23,7 +23,7 @@ typedef struct    GMainLoop *main_loop;    TplLogStore *store;    TpAccount *account; -  TpDBusDaemon *bus; +  GDBusConnection *bus;    TpClientFactory *factory;    TpTestsSimpleAccount *account_service;  } XmlTestCaseFixture; @@ -41,7 +41,7 @@ setup (XmlTestCaseFixture* fixture,    fixture->main_loop = g_main_loop_new (NULL, FALSE);    fixture->store = _tpl_log_store_xml_new (); -  fixture->bus = tp_tests_dbus_daemon_dup_or_die (); +  fixture->bus = tp_tests_dbus_dup_or_die ();    g_assert (fixture->bus != NULL);    tp_dbus_daemon_request_name (fixture->bus, diff --git a/tests/logger/dbus/test-tpl-log-store-pidgin.c b/tests/logger/dbus/test-tpl-log-store-pidgin.c index c39cecc9a..857017529 100644 --- a/tests/logger/dbus/test-tpl-log-store-pidgin.c +++ b/tests/logger/dbus/test-tpl-log-store-pidgin.c @@ -33,7 +33,7 @@ typedef struct    GMainLoop *main_loop; -  TpDBusDaemon *dbus; +  GDBusConnection *dbus;    TpAccountManager *account_manager;    TpAccount *account;    TpTestsSimpleAccount *account_service; @@ -72,7 +72,7 @@ setup_service (PidginTestCaseFixture* fixture,    g_assert (params != NULL); -  fixture->dbus = tp_tests_dbus_daemon_dup_or_die (); +  fixture->dbus = tp_tests_dbus_dup_or_die ();    g_assert (fixture->dbus != NULL);    tp_dbus_daemon_request_name (fixture->dbus, diff --git a/tests/logger/dbus/test-tpl-log-store-sqlite.c b/tests/logger/dbus/test-tpl-log-store-sqlite.c index 5d8a4bf0f..5cfde4309 100644 --- a/tests/logger/dbus/test-tpl-log-store-sqlite.c +++ b/tests/logger/dbus/test-tpl-log-store-sqlite.c @@ -26,12 +26,12 @@ test (Fixture *fixture,      gconstpointer data)  {    TplLogStore *store; -  TpDBusDaemon *bus; +  GDBusConnection *bus;    TpAccount *account;    GError *error = NULL;    TpClientFactory* factory; -  bus = tp_dbus_daemon_dup (&error); +  bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);    g_assert_no_error (error);    factory = _tpl_client_factory_dup (bus); diff --git a/tests/logger/dbus/test-tpl-log-store-xml.c b/tests/logger/dbus/test-tpl-log-store-xml.c index b31ac686a..a3543c9cd 100644 --- a/tests/logger/dbus/test-tpl-log-store-xml.c +++ b/tests/logger/dbus/test-tpl-log-store-xml.c @@ -24,7 +24,7 @@ typedef struct    GMainLoop *main_loop;    gchar *tmp_basedir;    TplLogStore *store; -  TpDBusDaemon *bus; +  GDBusConnection *bus;    TpClientFactory *factory;    TpAccountManager *account_manager;  } XmlTestCaseFixture; @@ -46,7 +46,7 @@ setup (XmlTestCaseFixture* fixture,      log_store_xml_set_basedir (TPL_LOG_STORE_XML (fixture->store),          fixture->tmp_basedir); -  fixture->bus = tp_tests_dbus_daemon_dup_or_die (); +  fixture->bus = tp_tests_dbus_dup_or_die ();    g_assert (fixture->bus != NULL);    tp_dbus_daemon_request_name (fixture->bus, diff --git a/tests/logger/dbus/test-tpl-log-walker.c b/tests/logger/dbus/test-tpl-log-walker.c index cba3f03b9..5c90c770b 100644 --- a/tests/logger/dbus/test-tpl-log-walker.c +++ b/tests/logger/dbus/test-tpl-log-walker.c @@ -24,7 +24,7 @@ typedef struct    GMainLoop *main_loop;    TplLogManager *manager;    TpAccount *account; -  TpDBusDaemon *bus; +  GDBusConnection *bus;    TpClientFactory *factory;    TpTestsSimpleAccount *account_service;  } WalkerTestCaseFixture; @@ -63,7 +63,7 @@ setup (WalkerTestCaseFixture* fixture,    fixture->manager = tpl_log_manager_dup_singleton (); -  fixture->bus = tp_tests_dbus_daemon_dup_or_die (); +  fixture->bus = tp_tests_dbus_dup_or_die ();    g_assert (fixture->bus != NULL);    tp_dbus_daemon_request_name (fixture->bus, | 
