diff options
author | Jonny Lamb <jonnylamb@gnome.org> | 2009-10-24 21:47:04 +0800 |
---|---|---|
committer | Jonny Lamb <jonnylamb@gnome.org> | 2009-10-24 21:47:04 +0800 |
commit | bb173d8e042303ab7a0d9ec15c7a07f752cde200 (patch) | |
tree | 8e4aaca30d6c3464f21e5e8cf64522d7bd53c1a5 /libempathy/empathy-utils.c | |
parent | 25fe1de65572fecd8b369f4c01df32e47d5afc28 (diff) | |
download | gsoc2013-empathy-bb173d8e042303ab7a0d9ec15c7a07f752cde200.tar.gz gsoc2013-empathy-bb173d8e042303ab7a0d9ec15c7a07f752cde200.tar.zst gsoc2013-empathy-bb173d8e042303ab7a0d9ec15c7a07f752cde200.zip |
Add empathy_account_manager_get_accounts_connected function.
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r-- | libempathy/empathy-utils.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index dacc1d88c..eb080c2c2 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -523,3 +523,37 @@ empathy_get_account_for_connection (TpConnection *connection) return account; } + +gboolean +empathy_account_manager_get_accounts_connected (gboolean *connecting) +{ + TpAccountManager *manager; + GList *accounts, *l; + gboolean out_connecting = FALSE; + gboolean out_connected = FALSE; + + manager = tp_account_manager_dup (); + accounts = tp_account_manager_get_valid_accounts (manager); + + for (l = accounts; l != NULL; l = l->next) + { + TpConnectionStatus s = tp_account_get_connection_status ( + TP_ACCOUNT (l->data), NULL); + + if (s == TP_CONNECTION_STATUS_CONNECTING) + out_connecting = TRUE; + else if (s == TP_CONNECTION_STATUS_CONNECTED) + out_connected = TRUE; + + if (out_connecting && out_connected) + break; + } + + g_list_free (accounts); + g_object_unref (manager); + + if (connecting != NULL) + *connecting = out_connecting; + + return out_connected; +} |