Fixes NB#115325, show error note when trying to create a folder under outbox folder
authorSergio Villar Senín <svillar@igalia.com>
Fri, 8 May 2009 16:12:50 +0000 (18:12 +0200)
committerSergio Villar Senín <svillar@igalia.com>
Fri, 8 May 2009 16:12:50 +0000 (18:12 +0200)
src/hildon2/modest-platform.c
src/modest-ui-actions.c

index dea33a8..de71edf 100644 (file)
@@ -645,7 +645,8 @@ on_response (GtkDialog *dialog,
                parent = g_object_get_data (G_OBJECT (picker), FOLDER_PICKER_CURRENT_FOLDER);
 
        /* Look for another folder with the same name */
-       if (modest_tny_folder_has_subfolder_with_name (parent, new_name, TRUE))
+       if (!TNY_IS_MERGE_FOLDER (parent) &&
+           modest_tny_folder_has_subfolder_with_name (parent, new_name, TRUE))
                exists = TRUE;
 
        if (!exists) {
@@ -893,15 +894,17 @@ folder_picker_clicked (GtkButton *button,
        store = folder_chooser_dialog_run (helper->folder_view);
        if (store) {
                const gchar *current_name;
-               gboolean exists;
+               gboolean exists = FALSE;
 
                folder_picker_set_store (GTK_BUTTON (button), store);
 
                /* Update the name of the folder */
                current_name = gtk_entry_get_text (helper->entry);
-               exists = modest_tny_folder_has_subfolder_with_name (store,
-                                                                   current_name,
-                                                                   TRUE);
+
+               if (TNY_IS_FOLDER_STORE (store))
+                       exists = modest_tny_folder_has_subfolder_with_name (store,
+                                                                           current_name,
+                                                                           TRUE);
                if (exists) {
                        gchar *new_name = get_next_folder_name (NULL, store);
                        gtk_entry_set_text (helper->entry, new_name);
index b191daa..20cff0a 100644 (file)
@@ -46,6 +46,7 @@
 #include "modest-platform.h"
 #include "modest-debug.h"
 #include <tny-mime-part.h>
+#include <tny-error.h>
 #include <tny-camel-folder.h>
 #include <tny-camel-imap-folder.h>
 #include <tny-camel-pop-folder.h>
@@ -3361,6 +3362,19 @@ do_create_folder_performer (gboolean canceled,
        if (canceled || err) {
                /* In memory full conditions we could get this error here */
                check_memory_full_error ((GtkWidget *) parent_window, err);
+
+               /* This happens if we have selected the outbox folder
+                  as the parent */
+               if (err->code == TNY_SERVICE_ERROR_UNKNOWN &&
+                   TNY_IS_MERGE_FOLDER (helper->parent)) {
+                       /* Show an error and retry */
+                       modest_platform_information_banner ((GtkWidget *) parent_window,
+                                                           NULL,
+                                                           _("mail_in_ui_folder_create_error"));
+
+                       do_create_folder (parent_window, helper->parent, helper->folder_name);
+               }
+
                goto frees;
        }