From 9ddd25f8589ae0cd5ec8e09c4c012e4ccac6a416 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 18 Aug 2011 11:31:10 +0200 Subject: Port to new tp-glib client factory - EmpathyChannelFactory has been changed to EmpathyClientFactory and inherit from TpAutomaticClientFactory. - We now always use the _with_am variant of TpSimple* constructors - We define our own factory as default. - Replace empathy_get_account_for_connection() by tp_connection_get_account() - The factory is passed to EmpathyTpChat and TpyCallChannel - Use tp_simple_client_factory_ensure_account() instead of tp_account_manager_ensure_account(). - Rely on the factory to prepare connection features. This should ensure that all the TpProxy and TpContact objects created in Empathy are shared and use EmpathyClientFactory. https://bugzilla.gnome.org/show_bug.cgi?id=655799 --- libempathy/empathy-utils.c | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 'libempathy/empathy-utils.c') diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 5f9178a55..04a6c7836 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -46,6 +46,7 @@ #include #include +#include "empathy-client-factory.h" #include "empathy-utils.h" #include "empathy-contact-manager.h" #include "empathy-individual-manager.h" @@ -83,6 +84,8 @@ void empathy_init (void) { static gboolean initialized = FALSE; + TpAccountManager *am; + EmpathyClientFactory *factory; if (initialized) return; @@ -103,6 +106,13 @@ empathy_init (void) emp_cli_init (); initialized = TRUE; + + factory = empathy_client_factory_dup (); + am = tp_account_manager_new_with_factory (TP_SIMPLE_CLIENT_FACTORY (factory)); + tp_account_manager_set_default (am); + + g_object_unref (factory); + g_object_unref (am); } gboolean @@ -559,36 +569,6 @@ empathy_service_name_to_display_name (const gchar *service_name) return service_name; } -/* Note: this function depends on the account manager having its core feature - * prepared. */ -TpAccount * -empathy_get_account_for_connection (TpConnection *connection) -{ - TpAccountManager *manager; - TpAccount *account = NULL; - GList *accounts, *l; - - manager = tp_account_manager_dup (); - - accounts = tp_account_manager_get_valid_accounts (manager); - - for (l = accounts; l != NULL; l = l->next) - { - TpAccount *a = l->data; - - if (tp_account_get_connection (a) == connection) - { - account = a; - break; - } - } - - g_list_free (accounts); - g_object_unref (manager); - - return account; -} - gboolean empathy_account_manager_get_accounts_connected (gboolean *connecting) { -- cgit v1.2.3