From a3ae9fe39b2b7dfaa416329bf3b0626e0d706fd7 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Tue, 24 Apr 2007 18:30:34 +0000 Subject: [PATCH] * Added information dialog for folder creation * Added information dialog for folder removal pmo-trunk-r1657 --- src/gnome/modest-platform.c | 14 ++++++++++++++ src/maemo/modest-platform.c | 24 ++++++++++++++++++++++++ src/modest-platform.h | 8 ++++++++ src/modest-ui-actions.c | 11 ++++++++++- 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/gnome/modest-platform.c b/src/gnome/modest-platform.c index f89c112..999e462 100644 --- a/src/gnome/modest-platform.c +++ b/src/gnome/modest-platform.c @@ -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 */ +} diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index 5280a21..a4965a6 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -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); +} diff --git a/src/modest-platform.h b/src/modest-platform.h index 557aee9..7f74f31 100644 --- a/src/modest-platform.h +++ b/src/modest-platform.h @@ -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__ */ diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 5a3ba73..fe0b54f 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -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)); } -- 1.7.9.5