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 | |
parent | 25fe1de65572fecd8b369f4c01df32e47d5afc28 (diff) | |
download | gsoc2013-empathy-bb173d8e042303ab7a0d9ec15c7a07f752cde200.tar gsoc2013-empathy-bb173d8e042303ab7a0d9ec15c7a07f752cde200.tar.gz gsoc2013-empathy-bb173d8e042303ab7a0d9ec15c7a07f752cde200.tar.bz2 gsoc2013-empathy-bb173d8e042303ab7a0d9ec15c7a07f752cde200.tar.lz gsoc2013-empathy-bb173d8e042303ab7a0d9ec15c7a07f752cde200.tar.xz 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>
-rw-r--r-- | libempathy/empathy-utils.c | 34 | ||||
-rw-r--r-- | libempathy/empathy-utils.h | 2 |
2 files changed, 36 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; +} diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index 13093b8a1..97e5e85b7 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -87,6 +87,8 @@ void empathy_signal_connect_weak (gpointer instance, TpAccount * empathy_get_account_for_connection (TpConnection *connection); +gboolean empathy_account_manager_get_accounts_connected (gboolean *connecting); + G_END_DECLS #endif /* __EMPATHY_UTILS_H__ */ |