diff options
Diffstat (limited to 'libempathy')
-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__ */ |