diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-24 06:13:12 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-24 06:21:56 +0800 |
commit | 25bd33610962da0a8ff8dba645ac84e9f84d7e4f (patch) | |
tree | 45ac6baef883b5194cedcaea3f27653920ccf726 /libempathy/empathy-account-manager.c | |
parent | 74bba154cc8476d831140e27148d4897633e2d18 (diff) | |
download | gsoc2013-empathy-25bd33610962da0a8ff8dba645ac84e9f84d7e4f.tar gsoc2013-empathy-25bd33610962da0a8ff8dba645ac84e9f84d7e4f.tar.gz gsoc2013-empathy-25bd33610962da0a8ff8dba645ac84e9f84d7e4f.tar.bz2 gsoc2013-empathy-25bd33610962da0a8ff8dba645ac84e9f84d7e4f.tar.lz gsoc2013-empathy-25bd33610962da0a8ff8dba645ac84e9f84d7e4f.tar.xz gsoc2013-empathy-25bd33610962da0a8ff8dba645ac84e9f84d7e4f.tar.zst gsoc2013-empathy-25bd33610962da0a8ff8dba645ac84e9f84d7e4f.zip |
Add a new _ensure_account API
Have one call which only gets the account if it exists and a different one
which creates the account on the given path when needed.
Diffstat (limited to 'libempathy/empathy-account-manager.c')
-rw-r--r-- | libempathy/empathy-account-manager.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c index 2f0f13415..20facd379 100644 --- a/libempathy/empathy-account-manager.c +++ b/libempathy/empathy-account-manager.c @@ -337,6 +337,15 @@ empathy_account_manager_get_account (EmpathyAccountManager *manager, const gchar *path) { EmpathyAccountManagerPriv *priv = GET_PRIV (manager); + + return g_hash_table_lookup (priv->accounts, path); +} + +EmpathyAccount * +empathy_account_manager_ensure_account (EmpathyAccountManager *manager, + const gchar *path) +{ + EmpathyAccountManagerPriv *priv = GET_PRIV (manager); EmpathyAccount *account; account = g_hash_table_lookup (priv->accounts, path); @@ -352,6 +361,7 @@ empathy_account_manager_get_account (EmpathyAccountManager *manager, return account; } + static void account_manager_got_all_cb (TpProxy *proxy, GHashTable *properties, @@ -378,7 +388,7 @@ account_manager_got_all_cb (TpProxy *proxy, { gchar *name = g_ptr_array_index (accounts, i); - empathy_account_manager_get_account (manager, name); + empathy_account_manager_ensure_account (manager, name); } } @@ -397,7 +407,7 @@ account_validity_changed_cb (TpAccountManager *proxy, if (!valid) return; - empathy_account_manager_get_account (manager, path); + empathy_account_manager_ensure_account (manager, path); } static void @@ -909,7 +919,7 @@ empathy_account_manager_created_cb (TpAccountManager *proxy, return; } - account = empathy_account_manager_get_account (manager, account_path); + account = empathy_account_manager_ensure_account (manager, account_path); g_hash_table_insert (priv->create_results, account, my_res); } |