GtkTreeIter *iter,
gpointer user_data);
static gboolean accounts_dialog_flash_connecting_cb (EmpathyAccountsDialog *dialog);
-static gboolean accounts_dialog_are_accounts_connecting (MissionControl *mc);
static void accounts_dialog_connection_changed_cb (EmpathyAccountManager *manager,
McAccount *account,
TpConnectionStatusReason reason,
GtkTreePath *treepath;
GtkTreeIter iter;
- if (accounts_dialog_are_accounts_connecting (dialog->mc)) {
+ if (empathy_account_manager_get_connecting_accounts (dialog->account_manager) > 0) {
dialog->connecting_id = g_timeout_add (FLASH_TIMEOUT,
(GSourceFunc) accounts_dialog_flash_connecting_cb,
dialog);
* parameter for CM that have it. */
current_name = mc_account_get_display_name (account);
mc_account_get_param_string (account, "account", &account_param);
- if (!G_STR_EMPTY (account_param)) {
+ if (!EMP_STR_EMPTY (account_param)) {
McProfile *profile;
const gchar *profile_name;
gchar *new_name;
return TRUE;
}
-static gboolean
-accounts_dialog_are_accounts_connecting (MissionControl *mc)
-{
- GList *accounts, *l;
- gboolean found = FALSE;
-
- /* Check if there is still accounts in CONNECTING state */
- accounts = mc_accounts_list_by_enabled (TRUE);
- for (l = accounts; l; l = l->next) {
- McAccount *this_account = l->data;
- TpConnectionStatus status;
-
- status = mission_control_get_connection_status (mc, this_account,
- NULL);
- if (status == TP_CONNECTION_STATUS_CONNECTING) {
- found = TRUE;
- break;
- }
- }
- mc_accounts_list_free (accounts);
-
- return found;
-}
-
static void
accounts_dialog_connection_changed_cb (EmpathyAccountManager *manager,
McAccount *account,
gtk_tree_path_free (path);
}
- found = accounts_dialog_are_accounts_connecting (dialog->mc);
+ found = (empathy_account_manager_get_connecting_accounts (manager) > 0);
if (!found && dialog->connecting_id) {
g_source_remove (dialog->connecting_id);
dialog->connecting_id = 0;
}
+
if (found && !dialog->connecting_id) {
dialog->connecting_id = g_timeout_add (FLASH_TIMEOUT,
(GSourceFunc) accounts_dialog_flash_connecting_cb,
/* Create account */
account = mc_account_create (profile);
+ if (account == NULL) {
+ /* We can't display an error to the user as MC doesn't give us
+ * any clue about the reason of the failure... */
+ return;
+ }
+
/* To translator: %s is the protocol name */
str = g_strdup_printf (_("New %s account"),
mc_profile_get_display_name (profile));
dialog);
/* Set up signalling */
- dialog->account_manager = empathy_account_manager_new ();
- dialog->mc = empathy_mission_control_new ();
+ dialog->account_manager = empathy_account_manager_dup_singleton ();
+ dialog->mc = empathy_mission_control_dup_singleton ();
g_signal_connect (dialog->account_manager, "account-created",
G_CALLBACK (accounts_dialog_account_added_cb),