* Added information dialog for folder creation
authorSergio Villar Senin <svillar@igalia.com>
Tue, 24 Apr 2007 18:30:34 +0000 (18:30 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 24 Apr 2007 18:30:34 +0000 (18:30 +0000)
* Added information dialog for folder removal

pmo-trunk-r1657

src/gnome/modest-platform.c
src/maemo/modest-platform.c
src/modest-platform.h
src/modest-ui-actions.c

index f89c112..999e462 100644 (file)
@@ -175,3 +175,17 @@ modest_platform_run_confirmation_dialog (GtkWindow *parent_window,
        /* TODO implement confirmation dialog */
        return GTK_RESPONSE_CANCEL;
 }
+
+void
+modest_platform_run_information_dialog (GtkWindow *parent_window,
+                                       ModestInformationDialogType type)
+{
+       switch (type) {
+       case MODEST_INFORMATION_CREATE_FOLDER:
+               break;
+       case MODEST_INFORMATION_DELETE_FOLDER:
+               break;
+       };
+
+       /* TODO: implement a information dialog */
+}
index 5280a21..a4965a6 100644 (file)
@@ -484,3 +484,27 @@ modest_platform_run_confirmation_dialog (GtkWindow *parent_window,
 
        return response;
 }
+
+void
+modest_platform_run_information_dialog (GtkWindow *parent_window,
+                                       ModestInformationDialogType type)
+{
+       GtkWidget *dialog;
+       gchar *message = NULL;
+
+       switch (type) {
+       case MODEST_INFORMATION_CREATE_FOLDER:
+               message = _("mail_in_ui_folder_create_error");
+               break;
+       case MODEST_INFORMATION_DELETE_FOLDER:
+               message = _("mail_in_ui_folder_delete_error");
+               break;
+       };
+
+       dialog = hildon_note_new_information (parent_window, message);
+
+       gtk_dialog_run (GTK_DIALOG (dialog));
+
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+       g_free (message);
+}
index 557aee9..7f74f31 100644 (file)
@@ -39,6 +39,11 @@ typedef enum _ModestConfirmationDialogType {
        MODEST_CONFIRMATION_DELETE_FOLDER,
 } ModestConfirmationDialogType;
 
+typedef enum _ModestInformationDialogType {
+       MODEST_INFORMATION_CREATE_FOLDER,
+       MODEST_INFORMATION_DELETE_FOLDER,
+} ModestInformationDialogType;
+
 /**
  * modest_platform_platform_init:
  *
@@ -138,6 +143,9 @@ gint      modest_platform_run_confirmation_dialog      (GtkWindow *parent_window
                                                        ModestConfirmationDialogType type,
                                                        gpointer user_data);
 
+void      modest_platform_run_information_dialog       (GtkWindow *parent_window,
+                                                       ModestInformationDialogType type);
+
 G_END_DECLS
 
 #endif /* __MODEST_PLATFORM_UTILS_H__ */
index 5a3ba73..fe0b54f 100644 (file)
@@ -1281,7 +1281,7 @@ modest_ui_actions_on_new_folder (GtkAction *action, ModestMainWindow *main_windo
                                finished = TRUE;
                        } else {
                                ModestMailOperation *mail_op = modest_mail_operation_new ();
-                               TnyFolder *new_folder;
+                               TnyFolder *new_folder = NULL;
 
                                modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), 
                                                                 mail_op);
@@ -1298,6 +1298,9 @@ modest_ui_actions_on_new_folder (GtkAction *action, ModestMainWindow *main_windo
                                        g_printerr ("%s", error->message);
                                        /* TODO: check error and follow proper actions */
 /*                                     suggested_name = X; */
+                                       /* Show error to the user */
+                                       modest_platform_run_information_dialog (GTK_WINDOW (main_window),
+                                                                               MODEST_INFORMATION_CREATE_FOLDER);
                                }
                                g_object_unref (mail_op);
                        }
@@ -1375,6 +1378,12 @@ delete_folder (ModestMainWindow *main_window, gboolean move_to_trash)
                modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
                                                 mail_op);
                modest_mail_operation_remove_folder (mail_op, TNY_FOLDER (folder), move_to_trash);
+
+               /* Show error if happened */
+               if (modest_mail_operation_get_error (mail_op))
+                       modest_platform_run_information_dialog (GTK_WINDOW (main_window),
+                                                               MODEST_INFORMATION_DELETE_FOLDER);
+
                g_object_unref (G_OBJECT (mail_op));
        }