show_password_warning_only ()
{
ModestWindow *main_window =
- modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
-
+ modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE); /* don't create */
+
/* Show an explanatory temporary banner: */
- hildon_banner_show_information (
- GTK_WIDGET(main_window), NULL, _("mcen_ib_username_pw_incorrect"));
+ if (main_window)
+ hildon_banner_show_information (
+ GTK_WIDGET(main_window), NULL, _("mcen_ib_username_pw_incorrect"));
+ else
+ g_warning ("%s: %s", __FUNCTION__, _("mcen_ib_username_pw_incorrect"));
}
-
+
+
static void
show_wrong_password_dialog (TnyAccount *account)
{
/* This is easier than using a struct for the user_data: */
ModestTnyAccountStore *self = modest_runtime_get_account_store();
ModestTnyAccountStorePrivate *priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
-
- const gchar *modest_account_name =
- modest_tny_account_get_parent_modest_account_name_for_server_account (account);
+ ModestWindow *main_window;
+ const gchar *modest_account_name;
+
+ main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (),
+ FALSE); /* don't create */
+ if (!main_window) {
+ g_warning ("%s: password was wrong; ignoring because no main window", __FUNCTION__);
+ return;
+ }
+
+ modest_account_name = modest_tny_account_get_parent_modest_account_name_for_server_account (account);
if (!modest_account_name) {
g_warning ("%s: modest_tny_account_get_parent_modest_account_name_for_server_account() failed.\n",
__FUNCTION__);
}
ModestAccountSettingsDialog *dialog = dialog_as_gpointer;
- ModestWindow *main_window =
- modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
-
gboolean created_dialog = FALSE;
if (!found || !dialog) {
dialog = modest_account_settings_dialog_new ();
gboolean *cancel,
gboolean *remember)
{
- g_signal_emit (G_OBJECT(account_store), signals[PASSWORD_REQUESTED_SIGNAL], 0,
- server_account_id, /* server_account_name */
- username, password, cancel, remember);
+ g_signal_emit (G_OBJECT(account_store), signals[PASSWORD_REQUESTED_SIGNAL], 0,
+ server_account_id, /* server_account_name */
+ username, password, cancel, remember);
}
/* This callback will be called by Tinymail when it needs the password
g_free (username);
username = NULL;
} else
- *cancel = FALSE;
+ if (cancel)
+ *cancel = FALSE;
/* printf(" DEBUG: %s: returning %s\n", __FUNCTION__, pwd); */
it will return NULL because there is no outbox folder for
this specific transport accounts, and it's a must that the
send queue returns an outbox */
- if (FALSE)
+ if (TRUE)
/* Add connection-specific transport accounts */
add_connection_specific_transport_accounts (MODEST_TNY_ACCOUNT_STORE(obj));
if (error->code == TNY_ACCOUNT_ERROR_TRY_CONNECT_CERTIFICATE)
- retval = modest_platform_run_certificate_conformation_dialog (server_name,
+ retval = modest_platform_run_certificate_confirmation_dialog (server_name,
error->message);
else
retval = modest_platform_run_alert_dialog (prompt, question);
return retval;
}
-static TnyAccount*
-get_smtp_specific_transport_account_for_open_connection (ModestTnyAccountStore *self,
- const gchar *account_name)
+TnyAccount*
+modest_tny_account_store_get_smtp_specific_transport_account_for_open_connection (ModestTnyAccountStore *self,
+ const gchar *account_name)
{
/* Get the current connection: */
TnyDevice *device = modest_runtime_get_device ();
/* Get the connection-specific transport acccount, if any: */
/* Note: This gives us a reference: */
TnyAccount *account =
- get_smtp_specific_transport_account_for_open_connection (self, account_name);
+ modest_tny_account_store_get_smtp_specific_transport_account_for_open_connection (self, account_name);
/* If there is no connection-specific transport account (the common case),
* just get the regular transport account: */
}
}
+TnyTransportAccount *
+modest_tny_account_store_new_connection_specific_transport_account (ModestTnyAccountStore *self,
+ const gchar *name)
+{
+ ModestTnyAccountStorePrivate *priv = NULL;
+ TnyAccount * tny_account = NULL;
+
+ priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+
+ /* Add the account: */
+ tny_account =
+ modest_tny_account_new_from_server_account_name (priv->account_mgr,
+ priv->session,
+ name,
+ get_password,
+ forget_password);
+ if (tny_account) {
+ g_object_set_data (G_OBJECT(tny_account),
+ "account_store",
+ (gpointer)self);
+
+ tny_list_append (priv->transport_accounts, G_OBJECT (tny_account));
+ add_outbox_from_transport_account_to_global_outbox (self,
+ name,
+ tny_account);
+
+ } else
+ g_printerr ("modest: failed to create smtp-specific account for %s\n",
+ name);
+
+ return TNY_TRANSPORT_ACCOUNT (tny_account);
+}
+
+
static void
add_connection_specific_transport_accounts (ModestTnyAccountStore *self)
{
iter = g_slist_next (iter);
if (iter) {
const gchar* transport_account_name = (const gchar*) (iter->data);
- if (transport_account_name) {
- TnyAccount * tny_account = NULL;
- /* Add the account: */
- tny_account =
- modest_tny_account_new_from_server_account_name (priv->account_mgr,
- priv->session,
- transport_account_name);
- if (tny_account) {
- g_object_set_data (G_OBJECT(tny_account),
- "account_store",
- (gpointer)self);
-
- tny_list_append (priv->transport_accounts, G_OBJECT (tny_account));
- g_object_unref (tny_account);
- } else
- g_printerr ("modest: failed to create smtp-specific account for %s\n",
- transport_account_name);
- }
+ TnyTransportAccount * account = NULL;
+ account = modest_tny_account_store_new_connection_specific_transport_account (
+ self, transport_account_name);
+ if (account)
+ g_object_unref (account);
}
iter = g_slist_next (iter);
}