2007-07-06 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Fri, 6 Jul 2007 13:52:59 +0000 (13:52 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Fri, 6 Jul 2007 13:52:59 +0000 (13:52 +0000)
* libtinymail/tny-enums.h:
* libtinymail/tny-error.h: Added
TNY_ACCOUNT_ERROR_TRY_CONNECT_HOST_LOOKUP_FAILED,
TNY_ACCOUNT_ERROR_TRY_CONNECT_SERVICE_UNAVAILABLE and
TNY_ACCOUNT_ERROR_TRY_CONNECT_AUTHENTICATION_NOT_SUPPORTED so
that the TnyAccountStore::alert_func() callback can sometimes get
more specific information, so that it doesn't need to just blindly show
the camel internal error message.
* libtinymail/tny-error.c: Updated tny_error_get_type(), though this should be
generated code as in GTK+.

* libtinymail-camel/tny-camel-account-priv.h:
* libtinymail-camel/tny-camel-account.c:
Added _tny_camel_account_get_tny_error_code_for_camel_exception_id() for
choosing a suitable tinymail GError code.
(_tny_camel_account_try_connect), (_tny_camel_account_set_online):
Use a specific error code for the GErrors.

* libtinymail-camel/tny-session-camel.c:
(tny_session_camel_alert_user): Add a TODO noting that this is where we
lose some specific error codes, and where we do a dodgy string comparison
on the message text.

* camel/camel-exception-list.def: Added a
CAMEL_EXCEPTION_SYSTEM_HOST_LOOKUP_FAILED error code enum value.
* camel/camel-net-utils.c: (camel_getaddrinfo):
Use the new error code when appropriate.

pmo-trunk-r2612

src/maemo/easysetup/modest-easysetup-wizard.c
src/maemo/modest-account-settings-dialog.c
src/maemo/modest-main-window.c
src/modest-tny-account-store.c

index aa60311..8a198d8 100644 (file)
@@ -206,11 +206,7 @@ static GList* check_for_supported_auth_methods(ModestEasysetupWizardDialog* acco
        if(error == NULL || error->domain != modest_maemo_utils_get_supported_secure_authentication_error_quark() ||
                        error->code != MODEST_MAEMO_UTILS_GET_SUPPORTED_SECURE_AUTHENTICATION_ERROR_CANCELED)
        {
-               GtkWidget* error_dialog = gtk_message_dialog_new(GTK_WINDOW(account_wizard),
-                                                                GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
-                                                                GTK_BUTTONS_OK, (error != NULL) ? error->message : _("Server does not support secure authentication!"));
-               gtk_dialog_run(GTK_DIALOG(error_dialog));
-               gtk_widget_destroy(error_dialog);
+               show_error (GTK_WINDOW (account_wizard), _("Could not discover supported secure authentication methods."));
        }
 
        if(error != NULL) g_error_free(error);
index 82ce5dd..6c226de 100644 (file)
@@ -898,14 +898,12 @@ check_data (ModestAccountSettingsDialog *self)
                                if(error == NULL || error->domain != modest_maemo_utils_get_supported_secure_authentication_error_quark() ||
                                                error->code != MODEST_MAEMO_UTILS_GET_SUPPORTED_SECURE_AUTHENTICATION_ERROR_CANCELED)
                                {
-                                       GtkWidget* error_dialog = gtk_message_dialog_new(GTK_WINDOW(self),
-                                                                                        GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
-                                                                                        GTK_BUTTONS_OK, (error != NULL) ? error->message : _("Server does not support secure authentication!"));
-                                       gtk_dialog_run(GTK_DIALOG(error_dialog));
-                                       gtk_widget_destroy(error_dialog);
+                                       show_error (GTK_WINDOW (self), _("Could not discover supported secure authentication methods."));
                                }
 
-                               if(error != NULL) g_error_free(error);
+                               if(error != NULL)
+                                       g_error_free(error);
+                                       
                                /* This is a nasty hack. jschmid. */
                                /* Don't let the dialog close */
                                /*g_signal_stop_emission_by_name (dialog, "response");*/
index 58c5a14..5281a49 100644 (file)
@@ -483,6 +483,10 @@ on_response (GtkDialog *dialog, gint arg1, gpointer user_data)
 static void
 on_sendqueue_error_happened (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, GError *err, ModestMainWindow *user_data)
 {
+       if (err) {
+               printf ("DEBUG: %s: err->code=%d, err->message=%s\n", __FUNCTION__, err->code, err->message);
+       }
+
        if (header) {
                gchar *str = g_strdup_printf ("%s. Do you want to remove the message (%s)?",
                        err->message, tny_header_get_subject (header));
index 34e541b..3f1d5cc 100644 (file)
@@ -973,6 +973,33 @@ modest_tny_account_store_alert (TnyAccountStore *self, TnyAlertType type,
        /* const gchar *prompt = NULL; */
        gchar *prompt = NULL;
        switch (error->code) {
+               case TNY_ACCOUNT_STORE_ERROR_CANCEL_ALERT:
+                       /* Don't show waste the user's time by showing him a dialog telling the 
+                        * user that he has just cancelled something: */
+                       g_debug ("%s: Handling GError domain=%d, code=%d (cancelled) without showing a dialog, message=%s", 
+                               __FUNCTION__, error->domain, error->code, error->message);
+                       prompt = NULL;
+                       break;
+               case TNY_ACCOUNT_ERROR_TRY_CONNECT_HOST_LOOKUP_FAILED:
+                       g_debug ("%s: Handling GError domain=%d, code=%d (lookup failed), message=%s", 
+                               __FUNCTION__, error->domain, error->code, error->message);
+                       prompt = g_strdup (_("emev_ni_ui_pop3_msg_connect_error"));
+                       /*
+                       prompt = g_strdup_printf(
+                               "%s\n Host lookup failed.%s", 
+                               _("Incorrect Account Settings"), 
+                               error->message);
+                       */
+                       break;
+               case TNY_ACCOUNT_ERROR_TRY_CONNECT_AUTHENTICATION_NOT_SUPPORTED:
+                       g_debug ("%s: Handling GError domain=%d, code=%d (authentication not supported), message=%s", 
+                               __FUNCTION__, error->domain, error->code, error->message);
+                       prompt = g_strdup_printf(
+                               "%s\n The secure authentication method is not supported.\n%s", 
+                               _("Incorrect Account Settings"), 
+                               error->message);
+                       break;
+               
                case TNY_ACCOUNT_ERROR_TRY_CONNECT:
                /* The tinymail camel implementation just sends us this for almost 
                 * everything, so we have to guess at the cause.
@@ -984,7 +1011,7 @@ modest_tny_account_store_alert (TnyAccountStore *self, TnyAlertType type,
                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: Handling GError domain=%d, code=%d, message=%s", 
+                       g_debug ("%s: Handling GError domain=%d, code=%d, message=%s", 
                                __FUNCTION__, error->domain, error->code, error->message);
                        
                        /* TODO: Remove the internal error message for the real release.