* Fixed an infinite loop in on_cert_dialog_response caused by a recursive gtk_dialog_response in the handler
* Fixed a logical id
* Removed some unused debug code
* Fixes NB#62237, new notification for invalid certificates (using some previous code from djcb)
* Fixes NB#60517, the Send&Receive option in the main menu no longer freezes the progress bar
pmo-trunk-r3278
return widget;
}
+
+gboolean
+modest_platform_run_alert_dialog (const gchar* prompt,
+ gboolean is_question)
+{
+ /* TODO */
+ return TRUE;
+}
refresh_action_name = g_strconcat ("SendReceive", account_data->account_name, NULL);
refresh_account_action = gtk_action_new ((const gchar*) refresh_action_name,
display_name, NULL, NULL);
- printf("DEBUG: %s: menu display_name=%s\n", __FUNCTION__, display_name);
gtk_action_group_add_action (priv->view_additions_group, refresh_account_action);
merge_id = (guint8) gtk_ui_manager_new_merge_id (parent_priv->ui_manager);
static void
on_cert_dialog_response (GtkDialog *dialog, gint response_id, const gchar* cert)
{
- // handle ok/cancel in the normal way
- if (response_id != GTK_RESPONSE_HELP)
- gtk_dialog_response (dialog, response_id);
- else {
- // GTK_RESPONSE_HELP means we need to show the certificate
+ /* GTK_RESPONSE_HELP means we need to show the certificate */
+ if (response_id == GTK_RESPONSE_HELP) {
GtkWidget *note;
gchar *msg;
+ /* Do not close the dialog */
+ g_signal_stop_emission_by_name (dialog, "response");
+
msg = g_strdup_printf (_("mcen_ni_view_unknown_certificate"), cert);
note = hildon_note_new_information (GTK_WINDOW(dialog), msg);
gtk_dialog_run (GTK_DIALOG(note));
GtkWindow *main_win =
(GtkWindow*)modest_window_mgr_get_main_window (modest_runtime_get_window_mgr());
- gchar *question = g_strdup_printf (_("mcen_mc_unknown_certificate"),
+ gchar *question = g_strdup_printf (_("mcen_nc_unknown_certificate"),
server_name);
note = hildon_note_new_confirmation_add_buttons (
_("mcen_bd_dialog_cancel"), GTK_RESPONSE_CANCEL,
NULL, NULL);
- g_signal_connect (G_OBJECT(note), "response", G_CALLBACK(on_cert_dialog_response),
- (gpointer)certificate);
+ g_signal_connect (G_OBJECT(note), "response",
+ G_CALLBACK(on_cert_dialog_response),
+ (gpointer) certificate);
response = gtk_dialog_run(GTK_DIALOG(note));
gtk_widget_destroy(GTK_WIDGET(note));
gboolean
-modest_platform_run_alert_dialog (const gchar* prompt, gboolean is_question)
+modest_platform_run_alert_dialog (const gchar* prompt,
+ gboolean is_question)
{
ModestWindow *main_window =
modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
priv->done = 0;
priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS;
- /* Get the Modest account */
+ /* Get the store account */
store_account = (TnyStoreAccount *)
modest_tny_account_store_get_server_account (modest_runtime_get_account_store (),
account_name,
TNY_ACCOUNT_TYPE_STORE);
- /* Make sure that we have a connection, and request one
- * if necessary:
- * TODO: Is there some way to trigger this for every attempt to
- * use the network? */
- if (!modest_platform_connect_and_wait (NULL, TNY_ACCOUNT (store_account)))
- goto error;
-
if (!store_account) {
g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
/* remove message from folder */
tny_folder_remove_msgs (folder, headers, &(priv->error));
if (!priv->error) {
- if (TNY_IS_CAMEL_IMAP_FOLDER (folder))
+ if (TNY_IS_CAMEL_IMAP_FOLDER (folder) ||
+ TNY_IS_CAMEL_POP_FOLDER (folder))
tny_folder_sync_async(folder, FALSE, NULL, NULL, NULL); /* FALSE --> don't expunge */
-/* tny_folder_sync (folder, FALSE, &(priv->error)); /\* FALSE --> don't expunge */
- else if (TNY_IS_CAMEL_POP_FOLDER (folder))
- tny_folder_sync_async(folder, FALSE, NULL, NULL, NULL); /* TRUE --> dont expunge */
-/* tny_folder_sync (folder, TRUE, &(priv->error)); /\* TRUE --> expunge */
else
/* local folders */
tny_folder_sync_async(folder, TRUE, NULL, NULL, NULL); /* TRUE --> expunge */
-/* tny_folder_sync (folder, TRUE, &(priv->error)); /\* TRUE --> expunge */
}
-static void
-log_alert_error (const GError *err)
-{
- if (err)
- g_warning ("%s: %d, message=%s", __FUNCTION__, err->domain, err->message);
-}
-
-
static gboolean
-modest_tny_account_store_alert (TnyAccountStore *self, TnyAccount *account, TnyAlertType type,
- gboolean question, const GError *error)
+modest_tny_account_store_alert (TnyAccountStore *self,
+ TnyAccount *account,
+ TnyAlertType type,
+ gboolean question,
+ const GError *error)
{
ModestTransportStoreProtocol proto =
MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
const gchar* server_name = NULL;
gchar *prompt = NULL;
gboolean retval;
-
+
+ g_return_val_if_fail (account, FALSE);
g_return_val_if_fail (error, FALSE);
- log_alert_error (error);
if ((error->domain != TNY_ACCOUNT_ERROR) && (error->domain != TNY_ACCOUNT_STORE_ERROR))
return FALSE;
/* Get the server name: */
- if (account && TNY_IS_ACCOUNT (account))
- server_name = tny_account_get_hostname (account);
- if (!server_name) {
- g_warning ("%s: cannot get server name", __FUNCTION__);
- return FALSE;
- }
+ server_name = tny_account_get_hostname (account);
if (account) {
const gchar *proto_name = tny_account_get_proto (account);
server_name);
break;
default:
- g_warning ("%s: should not be reached (%d)", __FUNCTION__, proto);
- return FALSE;
+ g_return_val_if_reached (FALSE);
}
break;
break;
case TNY_ACCOUNT_ERROR_TRY_CONNECT_CERTIFICATE:
- /* TODO: This needs a logical ID and/or some specified way to ask the
- * different certificate questions: */
- prompt = g_strdup_printf(
- _("Certificate Problem:\n%s"),
- error->message);
+ /* We'll show the proper dialog later */
break;
case TNY_ACCOUNT_ERROR_TRY_CONNECT:
* specific dialog messages from Chapter 12 of the UI spec.
*/
case TNY_ACCOUNT_STORE_ERROR_UNKNOWN_ALERT:
- /* This debug output is useful. Please keep it uncommented until
- * we have fixed the problems in this function: */
- g_debug ("%s: %d, message=%s",__FUNCTION__,
- error->domain, error->message);
/* TODO: Remove the internal error message for the real release.
* This is just so the testers can give us more information: */
break;
default:
- g_warning ("%s: Unhandled GError code: %d, message=%s",
- __FUNCTION__, error->code, error->message);
- prompt = NULL;
- break;
+ g_return_val_if_reached (FALSE);
}
- if (!prompt)
- return FALSE;
+
+ if (error->code == TNY_ACCOUNT_ERROR_TRY_CONNECT_CERTIFICATE)
+ retval = modest_platform_run_certificate_conformation_dialog (server_name,
+ error->message);
else
retval = modest_platform_run_alert_dialog (prompt, question);
- g_free (prompt);
+ if (prompt)
+ g_free (prompt);
return retval;
}
{
gchar *acc_name = NULL;
ModestMailOperation *mail_op;
+ TnyAccount *store_account = NULL;
/* If no account name was provided then get the current account, and if
there is no current account then pick the default one: */
acc_name = g_strdup (account_name);
}
+
+ /* Ensure that we have a connection available */
+ store_account =
+ modest_tny_account_store_get_server_account (modest_runtime_get_account_store (),
+ account_name,
+ TNY_ACCOUNT_TYPE_STORE);
+ if (!modest_platform_connect_and_wait (NULL, TNY_ACCOUNT (store_account))) {
+ g_object_unref (store_account);
+ return;
+ }
+ g_object_unref (store_account);
+
/* Set send/receive operation in progress */
modest_main_window_notify_send_receive_initied (MODEST_MAIN_WINDOW(win));