summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/telepathy-glib-sections.txt5
-rw-r--r--telepathy-glib/account-manager.c49
-rw-r--r--telepathy-glib/account-manager.h3
-rw-r--r--telepathy-glib/simple-client-factory-internal.h3
-rw-r--r--telepathy-glib/simple-client-factory.c122
-rw-r--r--telepathy-glib/simple-client-factory.h16
6 files changed, 40 insertions, 158 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 0a0dd1b18..d8d00c47b 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -4470,6 +4470,7 @@ TpAccountClassPrivate
TpAccountManager
TpAccountManagerClass
tp_account_manager_new
+tp_account_manager_new_with_factory
tp_account_manager_init_known_interfaces
tp_account_manager_set_default
tp_account_manager_dup
@@ -5749,10 +5750,6 @@ TpSimpleClientFactoryClass
tp_simple_client_factory_new
tp_simple_client_factory_get_dbus_daemon
<SUBSECTION>
-tp_simple_client_factory_ensure_account_manager
-tp_simple_client_factory_dup_account_manager_features
-tp_simple_client_factory_add_account_manager_features
-<SUBSECTION>
tp_simple_client_factory_ensure_account
tp_simple_client_factory_dup_account_features
tp_simple_client_factory_add_account_features
diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c
index ba45bcc28..a20276a9d 100644
--- a/telepathy-glib/account-manager.c
+++ b/telepathy-glib/account-manager.c
@@ -694,6 +694,19 @@ tp_account_manager_init_known_interfaces (void)
}
}
+static TpAccountManager *
+_tp_account_manager_new_internal (TpSimpleClientFactory *factory,
+ TpDBusDaemon *bus_daemon)
+{
+ return TP_ACCOUNT_MANAGER (g_object_new (TP_TYPE_ACCOUNT_MANAGER,
+ "dbus-daemon", bus_daemon,
+ "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
+ "bus-name", TP_ACCOUNT_MANAGER_BUS_NAME,
+ "object-path", TP_ACCOUNT_MANAGER_OBJECT_PATH,
+ "factory", factory,
+ NULL));
+}
+
/**
* tp_account_manager_new:
* @bus_daemon: Proxy for the D-Bus daemon
@@ -710,26 +723,32 @@ tp_account_manager_init_known_interfaces (void)
TpAccountManager *
tp_account_manager_new (TpDBusDaemon *bus_daemon)
{
- return _tp_account_manager_new_with_factory (NULL, bus_daemon);
+ g_return_val_if_fail (TP_IS_DBUS_DAEMON (bus_daemon), NULL);
+
+ return _tp_account_manager_new_internal (NULL, bus_daemon);
}
+/**
+ * tp_account_manager_new_with_factory:
+ * @factory: a #TpSimpleClientFactory
+ *
+ * Convenience function to create a new account manager proxy. The returned
+ * #TpAccountManager is not guaranteed to be ready on return.
+ *
+ * Should be used only by applications having their own #TpSimpleClientFactory
+ * subclass. Usually this should be done at application startup and followed by
+ * a call to tp_account_manager_set_default() to ensure other libraries/plugins
+ * will use this custom factory as well.
+ *
+ * Returns: a new reference to an account manager proxy
+ */
TpAccountManager *
-_tp_account_manager_new_with_factory (TpSimpleClientFactory *factory,
- TpDBusDaemon *bus_daemon)
+tp_account_manager_new_with_factory (TpSimpleClientFactory *factory)
{
- TpAccountManager *self;
-
- g_return_val_if_fail (TP_IS_DBUS_DAEMON (bus_daemon), NULL);
-
- self = TP_ACCOUNT_MANAGER (g_object_new (TP_TYPE_ACCOUNT_MANAGER,
- "dbus-daemon", bus_daemon,
- "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
- "bus-name", TP_ACCOUNT_MANAGER_BUS_NAME,
- "object-path", TP_ACCOUNT_MANAGER_OBJECT_PATH,
- "factory", factory,
- NULL));
+ g_return_val_if_fail (TP_IS_SIMPLE_CLIENT_FACTORY (factory), NULL);
- return self;
+ return _tp_account_manager_new_internal (factory,
+ tp_simple_client_factory_get_dbus_daemon (factory));
}
static gpointer starter_account_manager_proxy = NULL;
diff --git a/telepathy-glib/account-manager.h b/telepathy-glib/account-manager.h
index b8ddcf8a2..05432f1b6 100644
--- a/telepathy-glib/account-manager.h
+++ b/telepathy-glib/account-manager.h
@@ -73,6 +73,9 @@ GQuark tp_account_manager_get_feature_quark_core (void) G_GNUC_CONST;
TpAccountManager *tp_account_manager_new (TpDBusDaemon *bus_daemon)
G_GNUC_WARN_UNUSED_RESULT;
+TpAccountManager *tp_account_manager_new_with_factory (
+ TpSimpleClientFactory *factory) G_GNUC_WARN_UNUSED_RESULT;
+
void tp_account_manager_set_default (TpAccountManager *manager);
TpAccountManager *tp_account_manager_dup (void) G_GNUC_WARN_UNUSED_RESULT;
diff --git a/telepathy-glib/simple-client-factory-internal.h b/telepathy-glib/simple-client-factory-internal.h
index a7acb9a34..61f81d8c6 100644
--- a/telepathy-glib/simple-client-factory-internal.h
+++ b/telepathy-glib/simple-client-factory-internal.h
@@ -41,9 +41,6 @@ _tp_simple_client_factory_ensure_channel_dispatch_operation (
GHashTable *immutable_properties,
GError **error);
-TpAccountManager *_tp_account_manager_new_with_factory (
- TpSimpleClientFactory *factory, TpDBusDaemon *bus_daemon);
-
TpAccount *_tp_account_new_with_factory (TpSimpleClientFactory *factory,
TpDBusDaemon *bus_daemon,
const gchar *object_path,
diff --git a/telepathy-glib/simple-client-factory.c b/telepathy-glib/simple-client-factory.c
index 01c3e6615..5a68b5e98 100644
--- a/telepathy-glib/simple-client-factory.c
+++ b/telepathy-glib/simple-client-factory.c
@@ -34,7 +34,7 @@
* caller's responsibility to do so. By default, only core features are
* requested.
*
- * Currently supported classes are #TpAccountManager, #TpAccount, #TpConnection,
+ * Currently supported classes are #TpAccount, #TpConnection,
* #TpChannel and #TpContact. Those objects should always be acquired through a
* factory, rather than being constructed directly.
*
@@ -66,10 +66,6 @@
/**
* TpSimpleClientFactoryClass:
* @parent_class: the parent
- * @create_account_manager: create a #TpAccountManager;
- * see tp_simple_client_factory_ensure_account_manager()
- * @dup_account_manager_features: implementation of
- * tp_simple_client_factory_dup_account_manager_features()
* @create_account: create a #TpAccount;
* see tp_simple_client_factory_ensure_account()
* @dup_account_features: implementation of tp_simple_client_factory_dup_account_features()
@@ -87,7 +83,7 @@
* The class structure for #TpSimpleClientFactory.
*
* #TpSimpleClientFactory maintains a cache of previously-constructed proxy
- * objects, so the implementations of @create_account_manager, @create_account,
+ * objects, so the implementations of @create_account,
* @create_connection, @create_channel, and @create_contact may assume that a
* new object should be created when they are called. The default
* implementations create unadorned instances of the relevant classes;
@@ -120,7 +116,6 @@ struct _TpSimpleClientFactoryPrivate
TpDBusDaemon *dbus;
/* Owned object-path -> weakref to TpProxy */
GHashTable *proxy_cache;
- GArray *desired_account_manager_features;
GArray *desired_account_features;
GArray *desired_connection_features;
GArray *desired_channel_features;
@@ -179,20 +174,6 @@ _tp_simple_client_factory_insert_proxy (TpSimpleClientFactory *self,
insert_proxy (self, proxy);
}
-static TpAccountManager *
-create_account_manager_impl (TpSimpleClientFactory *self)
-{
- return _tp_account_manager_new_with_factory (self, self->priv->dbus);
-}
-
-static GArray *
-dup_account_manager_features_impl (TpSimpleClientFactory *self,
- TpAccountManager *manager)
-{
- return _tp_quark_array_copy (
- (GQuark *) self->priv->desired_account_manager_features->data);
-}
-
static TpAccount *
create_account_impl (TpSimpleClientFactory *self,
const gchar *object_path,
@@ -327,8 +308,6 @@ tp_simple_client_factory_finalize (GObject *object)
g_clear_object (&self->priv->dbus);
tp_clear_pointer (&self->priv->proxy_cache, g_hash_table_unref);
- tp_clear_pointer (&self->priv->desired_account_manager_features,
- g_array_unref);
tp_clear_pointer (&self->priv->desired_account_features, g_array_unref);
tp_clear_pointer (&self->priv->desired_connection_features, g_array_unref);
tp_clear_pointer (&self->priv->desired_channel_features, g_array_unref);
@@ -347,11 +326,6 @@ tp_simple_client_factory_init (TpSimpleClientFactory *self)
self->priv->proxy_cache = g_hash_table_new (g_str_hash, g_str_equal);
- self->priv->desired_account_manager_features = g_array_new (TRUE, FALSE,
- sizeof (GQuark));
- feature = TP_ACCOUNT_MANAGER_FEATURE_CORE;
- g_array_append_val (self->priv->desired_account_manager_features, feature);
-
self->priv->desired_account_features = g_array_new (TRUE, FALSE,
sizeof (GQuark));
feature = TP_ACCOUNT_FEATURE_CORE;
@@ -384,8 +358,6 @@ tp_simple_client_factory_class_init (TpSimpleClientFactoryClass *klass)
object_class->constructed = tp_simple_client_factory_constructed;
object_class->finalize = tp_simple_client_factory_finalize;
- klass->create_account_manager = create_account_manager_impl;
- klass->dup_account_manager_features = dup_account_manager_features_impl;
klass->create_account = create_account_impl;
klass->dup_account_features = dup_account_features_impl;
klass->create_connection = create_connection_impl;
@@ -447,96 +419,6 @@ tp_simple_client_factory_get_dbus_daemon (TpSimpleClientFactory *self)
}
/**
- * tp_simple_client_factory_ensure_account_manager:
- * @self: a #TpSimpleClientFactory object
- *
- * Returns a #TpAccountManager object.
- *
- * The returned #TpAccountManager is cached; the same #TpAccountManager object
- * will be returned by this function repeatedly, as long as at least one
- * reference exists. Note that the returned #TpAccountManager is not guaranteed
- * to be ready on return.
- *
- * Returns: (transfer full): a reference to a #TpAccountManager;
- * see tp_account_manager_new().
- *
- * Since: 0.UNRELEASED
- */
-TpAccountManager *
-tp_simple_client_factory_ensure_account_manager (TpSimpleClientFactory *self)
-{
- TpAccountManager *manager;
-
- g_return_val_if_fail (TP_IS_SIMPLE_CLIENT_FACTORY (self), NULL);
-
- manager = lookup_proxy (self, TP_ACCOUNT_MANAGER_OBJECT_PATH);
- if (manager != NULL)
- return g_object_ref (manager);
-
- manager = TP_SIMPLE_CLIENT_FACTORY_GET_CLASS (self)->create_account_manager (
- self);
- insert_proxy (self, manager);
-
- return manager;
-}
-
-/**
- * tp_simple_client_factory_dup_account_manager_features:
- * @self: a #TpSimpleClientFactory object
- * @manager: a #TpAccountManager
- *
- * Returns a zero-terminated #GArray containing the #TpAccountManager features
- * that should be prepared on @manager.
- *
- * Returns: (transfer full) (element-type GLib.Quark): a newly allocated
- * #GArray
- *
- * Since: 0.UNRELEASED
- */
-GArray *
-tp_simple_client_factory_dup_account_manager_features (
- TpSimpleClientFactory *self,
- TpAccountManager *manager)
-{
- g_return_val_if_fail (TP_IS_SIMPLE_CLIENT_FACTORY (self), NULL);
- g_return_val_if_fail (TP_IS_ACCOUNT_MANAGER (manager), NULL);
- g_return_val_if_fail (tp_proxy_get_factory (manager) == self, NULL);
-
- return TP_SIMPLE_CLIENT_FACTORY_GET_CLASS (self)->dup_account_manager_features
- (self, manager);
-}
-
-/**
- * tp_simple_client_factory_add_account_manager_features:
- * @self: a #TpSimpleClientFactory object
- * @features: (transfer none) (array zero-terminated=1) (allow-none): an array
- * of desired features, ending with 0; %NULL is equivalent to an array
- * containing only 0
- *
- * Add @features to the desired features to be prepared on #TpAccountManager
- * object. Those features will be added to the features already returned be
- * tp_simple_client_factory_dup_account_manager_features().
- *
- * It is not necessary to add %TP_ACCOUNT_MANAGER_FEATURE_CORE as it is already
- * included by default.
- *
- * Note that these features will not be added to existing #TpAccountManager
- * objects; the user must call tp_proxy_prepare_async() themself.
- *
- * Since: 0.UNRELEASED
- */
-void
-tp_simple_client_factory_add_account_manager_features (
- TpSimpleClientFactory *self,
- const GQuark *features)
-{
- g_return_if_fail (TP_IS_SIMPLE_CLIENT_FACTORY (self));
-
- _tp_quark_array_merge (self->priv->desired_account_manager_features, features,
- -1);
-}
-
-/**
* tp_simple_client_factory_ensure_account:
* @self: a #TpSimpleClientFactory object
* @object_path: the object path of an account
diff --git a/telepathy-glib/simple-client-factory.h b/telepathy-glib/simple-client-factory.h
index 433e3acb1..3b9a8d0b5 100644
--- a/telepathy-glib/simple-client-factory.h
+++ b/telepathy-glib/simple-client-factory.h
@@ -21,7 +21,6 @@
#ifndef __TP_SIMPLE_CLIENT_FACTORY_H__
#define __TP_SIMPLE_CLIENT_FACTORY_H__
-#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/account.h>
#include <telepathy-glib/channel.h>
#include <telepathy-glib/channel-dispatch-operation.h>
@@ -40,11 +39,6 @@ struct _TpSimpleClientFactoryClass {
/*<public>*/
GObjectClass parent_class;
- /* TpAccountManager */
- TpAccountManager * (*create_account_manager) (TpSimpleClientFactory *self);
- GArray * (*dup_account_manager_features) (TpSimpleClientFactory *self,
- TpAccountManager *manager);
-
/* TpAccount */
TpAccount * (*create_account) (TpSimpleClientFactory *self,
const gchar *object_path,
@@ -111,16 +105,6 @@ TpSimpleClientFactory * tp_simple_client_factory_new (TpDBusDaemon *dbus);
TpDBusDaemon *tp_simple_client_factory_get_dbus_daemon (
TpSimpleClientFactory *self);
-/* TpAccountManager */
-TpAccountManager *tp_simple_client_factory_ensure_account_manager (
- TpSimpleClientFactory *self);
-GArray *tp_simple_client_factory_dup_account_manager_features (
- TpSimpleClientFactory *self,
- TpAccountManager *manager);
-void tp_simple_client_factory_add_account_manager_features (
- TpSimpleClientFactory *self,
- const GQuark *features);
-
/* TpAccount */
TpAccount *tp_simple_client_factory_ensure_account (TpSimpleClientFactory *self,
const gchar *object_path,