diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-18 17:31:10 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-18 18:15:06 +0800 |
commit | 9ddd25f8589ae0cd5ec8e09c4c012e4ccac6a416 (patch) | |
tree | 4e4cfd5b8f801acff74edfdd5072f45d7038e00b /libempathy/empathy-utils.c | |
parent | 7fbf3e0c200b0a3c5086fdce0cc19afe48c429bb (diff) | |
download | gsoc2013-empathy-9ddd25f8589ae0cd5ec8e09c4c012e4ccac6a416.tar.gz gsoc2013-empathy-9ddd25f8589ae0cd5ec8e09c4c012e4ccac6a416.tar.zst gsoc2013-empathy-9ddd25f8589ae0cd5ec8e09c4c012e4ccac6a416.zip |
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
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r-- | libempathy/empathy-utils.c | 40 |
1 files changed, 10 insertions, 30 deletions
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 <telepathy-glib/dbus.h> #include <telepathy-glib/util.h> +#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) { |