2007-07-07 Armin Burgmeier <armin@openismus.com>
authorArmin Burgmeier <armin@openismus.com>
Sat, 7 Jul 2007 18:28:59 +0000 (18:28 +0000)
committerArmin Burgmeier <armin@openismus.com>
Sat, 7 Jul 2007 18:28:59 +0000 (18:28 +0000)
* src/maemo/easysetup/modest-easysetup-wizard.c: Translate
ckdg_ib_maximum_characters_reached from correct package.

* src/modest-ui-actions.c: Show an error message when a folder could
not be created. Tinymail does not give us specific error codes about
what has gone wrong, so we assume that a folder with that name
already exists, though there might be other reasons.

pmo-trunk-r2626

ChangeLog2
src/maemo/easysetup/modest-easysetup-wizard.c
src/modest-ui-actions.c

index d10e4e1..f26dbb2 100644 (file)
@@ -1,3 +1,13 @@
+2007-07-07  Armin Burgmeier  <armin@openismus.com>
+
+       * src/maemo/easysetup/modest-easysetup-wizard.c: Translate
+       ckdg_ib_maximum_characters_reached from correct package.
+
+       * src/modest-ui-actions.c: Show an error message when a folder could
+       not be created. Tinymail does not give us specific error codes about
+       what has gone wrong, so we assume that a folder with that name
+       already exists, though there might be other reasons.
+
 2007-07-06  Murray Cumming <murrayc@murrayc.com>
 
        * src/modest-tny-account-store.c: (modest_tny_account_store_alert):
index 8a198d8..881e376 100644 (file)
@@ -351,7 +351,7 @@ static void
 on_entry_max (ModestValidatingEntry *self, gpointer user_data)
 {
        ModestEasysetupWizardDialog *dialog = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
-       show_error (GTK_WINDOW (dialog), _("ckdg_ib_maximum_characters_reached"));
+       show_error (GTK_WINDOW (dialog), _CS("ckdg_ib_maximum_characters_reached"));
 }
 
 static void
index 98f9d7e..be1d2a0 100644 (file)
@@ -2126,6 +2126,25 @@ modest_ui_actions_on_remove_attachments (GtkAction *action,
        modest_msg_edit_window_remove_attachments (window, NULL);
 }
 
+static void
+modest_ui_actions_new_folder_error_handler (ModestMailOperation *mail_op,
+                                            gpointer user_data)
+{
+       ModestMainWindow *window = MODEST_MAIN_WINDOW (user_data);
+
+       /* TODO: Note that folder creation might go wrong due to other
+        * failures such as when the parent folder is non-writable. We can
+        * query a GError* with modest_mail_operation_get_error(), but the
+        * the error code (from tinymail) does not give us a clue about what
+        * has gone wrong. We might use the error->message but it might come
+        * from camel and not be suitable to show to the user directly. */
+       modest_platform_information_banner (GTK_WIDGET (window), NULL,
+                                           _CS("ckdg_ib_folder_already_exists"));
+
+/*     modest_platform_information_banner (GTK_WIDGET (window), NULL,
+                                           modest_mail_operation_get_error (mail_op)->message);*/
+}
+
 void 
 modest_ui_actions_on_new_folder (GtkAction *action, ModestMainWindow *main_window)
 {
@@ -2153,14 +2172,20 @@ modest_ui_actions_on_new_folder (GtkAction *action, ModestMainWindow *main_windo
                                                                        suggested_name,
                                                                        &folder_name);
 
+                       g_free (suggested_name);
+                       suggested_name = NULL;
+
                        if (result == GTK_RESPONSE_REJECT) {
                                finished = TRUE;
                        } else {
                                ModestMailOperation *mail_op;
                                TnyFolder *new_folder = NULL;
 
-                               mail_op  = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_INFO, 
-                                                                     G_OBJECT(main_window));
+                               mail_op  = modest_mail_operation_new_with_error_handling (MODEST_MAIL_OPERATION_TYPE_INFO,
+                                                                                         G_OBJECT(main_window),
+                                                                                         modest_ui_actions_new_folder_error_handler,
+                                                                                         main_window);
+
                                modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), 
                                                                 mail_op);
                                new_folder = modest_mail_operation_create_folder (mail_op,
@@ -2172,7 +2197,8 @@ modest_ui_actions_on_new_folder (GtkAction *action, ModestMainWindow *main_windo
                                }
                                g_object_unref (mail_op);
                        }
-                       g_free (folder_name);
+
+                       suggested_name = folder_name;
                        folder_name = NULL;
                }