dialog = modest_account_settings_dialog_new ();
modest_account_settings_dialog_set_account_name (dialog, modest_account_name);
modest_account_settings_dialog_switch_to_user_info (dialog);
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
g_hash_table_insert (priv->account_settings_dialog_hash, g_strdup (modest_account_name), dialog);
}
/* Show an explanatory temporary banner: */
- hildon_banner_show_information (
- GTK_WIDGET(dialog), NULL, _("mcen_ib_username_pw_incorrect"));
+ hildon_banner_show_information (GTK_WIDGET(dialog), NULL, _("mcen_ib_username_pw_incorrect"));
if (created_dialog) {
/* Forget it when it closes: */
return account;
}
+TnyAccount*
+modest_tny_account_store_get_mmc_folders_account (ModestTnyAccountStore *self)
+{
+ g_return_val_if_fail (MODEST_IS_TNY_ACCOUNT_STORE (self), NULL);
+
+ return modest_tny_account_store_get_tny_account_by (self, MODEST_TNY_ACCOUNT_STORE_QUERY_ID,
+ MODEST_MMC_ACCOUNT_ID);
+
+}
+
/*********************************************************************************/
static void
add_existing_accounts (ModestTnyAccountStore *self)
g_object_unref (per_account_outbox);
}
-
/*
* This function will be used for both adding new accounts and for the
* initialization. In the initialization we do not want to emit
store_account = create_tny_account (self, account, TNY_ACCOUNT_TYPE_STORE);
transport_account = create_tny_account (self, account, TNY_ACCOUNT_TYPE_TRANSPORT);
- /* Add to the list, and notify the observers */
- if (store_account) {
- tny_list_append (priv->store_accounts, G_OBJECT (store_account));
- if (notify)
- g_signal_emit (G_OBJECT (self), signals [ACCOUNT_INSERTED_SIGNAL], 0, store_account);
- g_object_unref (store_account);
- }
-
- /* Add to the list, and notify the observers */
- if (transport_account) {
- /* Add account to the list */
- tny_list_append (priv->transport_accounts, G_OBJECT (transport_account));
- g_assert (TNY_IS_ACCOUNT (transport_account));
-
- /* Create a new pseudo-account with an outbox for this
- transport account and add it to the global outbox
- in the local account */
- add_outbox_from_transport_account_to_global_outbox (self, account, transport_account);
+ g_assert (store_account);
+ g_assert (transport_account);
- if (notify) {
- TnyAccount *local_account = NULL;
+ /* Add accounts to the lists */
+ tny_list_append (priv->store_accounts, G_OBJECT (store_account));
+ tny_list_append (priv->transport_accounts, G_OBJECT (transport_account));
- /* Notify that the local account changed */
- local_account = modest_tny_account_store_get_local_folders_account (self);
- g_signal_emit (G_OBJECT (self), signals [ACCOUNT_CHANGED_SIGNAL], 0, local_account);
- g_object_unref (local_account);
-
- /* Notify the observers about the new account */
- g_signal_emit (G_OBJECT (self), signals [ACCOUNT_INSERTED_SIGNAL], 0, transport_account);
- }
-
- g_object_unref (transport_account);
+ /* Create a new pseudo-account with an outbox for this
+ transport account and add it to the global outbox
+ in the local account */
+ add_outbox_from_transport_account_to_global_outbox (self, account, transport_account);
+
+ /* Notify the observers. We do it after everything is
+ created */
+ if (notify) {
+ TnyAccount *local_account = NULL;
+
+ /* Notify the observers about the new server & transport accounts */
+ g_signal_emit (G_OBJECT (self), signals [ACCOUNT_INSERTED_SIGNAL], 0, store_account);
+ g_signal_emit (G_OBJECT (self), signals [ACCOUNT_INSERTED_SIGNAL], 0, transport_account);
+
+ /* Notify that the local account changed */
+ local_account = modest_tny_account_store_get_local_folders_account (self);
+ g_signal_emit (G_OBJECT (self), signals [ACCOUNT_CHANGED_SIGNAL], 0, local_account);
+ g_object_unref (local_account);
}
+
+ /* Frees */
+ g_object_unref (store_account);
+ g_object_unref (transport_account);
}
static void
iter = g_slist_next (iter);
}
}
+
+TnyMsg *
+modest_tny_account_store_find_msg_in_outboxes (ModestTnyAccountStore *self,
+ const gchar *uri,
+ TnyAccount **ac_out)
+{
+ TnyIterator *acc_iter;
+ ModestTnyAccountStorePrivate *priv;
+ TnyMsg *msg = NULL;
+ TnyAccount *msg_account = NULL;
+
+ g_return_val_if_fail (MODEST_IS_TNY_ACCOUNT_STORE (self), NULL);
+ priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self);
+
+ acc_iter = tny_list_create_iterator (priv->store_accounts_outboxes);
+ while (!msg && !tny_iterator_is_done (acc_iter)) {
+ TnyList *folders = tny_simple_list_new ();
+ TnyAccount *account = TNY_ACCOUNT (tny_iterator_get_current (acc_iter));
+ TnyIterator *folders_iter = NULL;
+
+ tny_folder_store_get_folders (TNY_FOLDER_STORE (account), folders, NULL, NULL);
+ folders_iter = tny_list_create_iterator (folders);
+
+ while (msg == NULL && !tny_iterator_is_done (folders_iter)) {
+ TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (folders_iter));
+ msg = tny_folder_find_msg (folder, uri, NULL);
+
+ if (msg)
+ msg_account = g_object_ref (account);
+
+ g_object_unref (folder);
+ tny_iterator_next (folders_iter);
+ }
+
+ g_object_unref (folders);
+ g_object_unref (account);
+ tny_iterator_next (acc_iter);
+ }
+
+ g_object_unref (acc_iter);
+
+ if (ac_out != NULL)
+ *ac_out = msg_account;
+
+ return msg;
+}