From d16f291bfe9ea0fe791e348fb6e8c3837b670356 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Fri, 19 Jan 2007 12:51:16 +0000 Subject: [PATCH] * Added some more UI actions implementations * Fixed some problems with the tests pmo-trunk-r674 --- src/gtk/modest-main-window.c | 1 - src/gtk/ui/modest-ui.xml | 4 +-- src/modest-mail-operation.c | 8 ++--- src/modest-ui-actions.h | 3 ++ src/modest-ui.c | 55 +++++++++++++++++++++++++++++++++-- src/widgets/modest-main-window-ui.h | 1 + tests/Makefile.am | 2 ++ 7 files changed, 65 insertions(+), 9 deletions(-) diff --git a/src/gtk/modest-main-window.c b/src/gtk/modest-main-window.c index 76c78b3..3ff82f4 100644 --- a/src/gtk/modest-main-window.c +++ b/src/gtk/modest-main-window.c @@ -427,7 +427,6 @@ on_folder_view_button_press_event (ModestFolderView *folder_view, return FALSE; } - static gboolean show_context_popup_menu (ModestMainWindow *window, GtkTreeView *tree_view, diff --git a/src/gtk/ui/modest-ui.xml b/src/gtk/ui/modest-ui.xml index 4abe8a4..7b4da63 100644 --- a/src/gtk/ui/modest-ui.xml +++ b/src/gtk/ui/modest-ui.xml @@ -63,6 +63,7 @@ + @@ -101,6 +102,5 @@ + - - diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index 9d79383..171915b 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -75,10 +75,10 @@ static TnyMimePart * add_body_part (TnyMsg *msg, gboolean has_attachments); -static void modest_mail_operation_xfer_folder (ModestMailOperation *self, - TnyFolder *folder, - TnyFolderStore *parent, - gboolean delete_original); +static void modest_mail_operation_xfer_folder (ModestMailOperation *self, + TnyFolder *folder, + TnyFolderStore *parent, + gboolean delete_original); static gboolean modest_mail_operation_xfer_msg (ModestMailOperation *self, TnyHeader *header, diff --git a/src/modest-ui-actions.h b/src/modest-ui-actions.h index edcdc25..64eb000 100644 --- a/src/modest-ui-actions.h +++ b/src/modest-ui-actions.h @@ -109,5 +109,8 @@ void _modest_ui_actions_on_rename_folder (GtkWidget *widget, void _modest_ui_actions_on_delete_folder (GtkWidget *widget, ModestMainWindow *main_window); +void _modest_ui_actions_on_move_to_trash_folder (GtkWidget *widget, + ModestMainWindow *main_window); + G_END_DECLS #endif /* __MODEST_UI_ACTIONS_H__ */ diff --git a/src/modest-ui.c b/src/modest-ui.c index 738f5e7..6a78ebb 100644 --- a/src/modest-ui.c +++ b/src/modest-ui.c @@ -44,6 +44,7 @@ #include #include #include +#include #define MODEST_UI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ MODEST_TYPE_UI, \ @@ -1353,12 +1354,62 @@ void _modest_ui_actions_on_rename_folder (GtkWidget *widget, ModestMainWindow *main_window) { - g_print ("Rename Folder"); + TnyFolder *folder; + ModestFolderView *folder_view; + ModestWidgetFactory *widget_factory; + + widget_factory = modest_window_get_widget_factory (MODEST_WINDOW (main_window)); + folder_view = modest_widget_factory_get_folder_view (widget_factory); + folder = modest_folder_view_get_selected (folder_view); + + if (folder) { + gchar *folder_name; + + folder_name = ask_for_folder_name (GTK_WINDOW (main_window), + _("Please enter a new name for the folder")); + + if (folder_name != NULL && strlen (folder_name) > 0) { + ModestMailOperation *mail_op; + + mail_op = modest_mail_operation_new (); + modest_mail_operation_rename_folder (mail_op, + folder, + (const gchar *) folder_name); + g_object_unref (mail_op); + } + g_object_unref (folder); + } + g_object_unref (G_OBJECT (widget_factory)); +} + +static void +delete_folder (ModestMainWindow *main_window, + gboolean move_to_trash) +{ + TnyFolder *folder; + ModestFolderView *folder_view; + ModestWidgetFactory *widget_factory; + ModestMailOperation *mail_op; + + widget_factory = modest_window_get_widget_factory (MODEST_WINDOW (main_window)); + folder_view = modest_widget_factory_get_folder_view (widget_factory); + folder = modest_folder_view_get_selected (folder_view); + + mail_op = modest_mail_operation_new (); + modest_mail_operation_remove_folder (mail_op, folder, move_to_trash); + g_object_unref (mail_op); } void _modest_ui_actions_on_delete_folder (GtkWidget *widget, ModestMainWindow *main_window) { - g_print ("Delete Folder"); + delete_folder (main_window, FALSE); +} + +void +_modest_ui_actions_on_move_to_trash_folder (GtkWidget *widget, + ModestMainWindow *main_window) +{ + delete_folder (main_window, TRUE); } diff --git a/src/widgets/modest-main-window-ui.h b/src/widgets/modest-main-window-ui.h index 9325f2e..de1e4cb 100644 --- a/src/widgets/modest-main-window-ui.h +++ b/src/widgets/modest-main-window-ui.h @@ -78,6 +78,7 @@ static const GtkActionEntry modest_action_entries [] = { { "ActionsFolderNew", NULL, N_("New Folder"), NULL, N_("Create a new folder"), G_CALLBACK (_modest_ui_actions_on_new_folder) }, { "ActionsFolderDelete", NULL, N_("Delete Folder"), NULL, N_("Delete the folder"), G_CALLBACK (_modest_ui_actions_on_delete_folder) }, { "ActionsFolderRename", NULL, N_("Rename Folder"), NULL, N_("Rename the folder"), G_CALLBACK (_modest_ui_actions_on_rename_folder) }, + { "ActionsFolderMoveToTrash", NULL, N_("Move Folder to Trash"), NULL, N_("Move folder to Trash"), G_CALLBACK (_modest_ui_actions_on_move_to_trash_folder) }, /* GOTO */ diff --git a/tests/Makefile.am b/tests/Makefile.am index 813d483..1c94c48 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,6 +13,7 @@ TESTS = \ check_folder-xfer \ check_text-utils \ check_modest-conf \ + check_update_account \ check_account-mgr noinst_PROGRAMS= \ @@ -20,6 +21,7 @@ noinst_PROGRAMS= \ check_modest-conf \ check_text-utils \ check_modest-presets \ + check_update_account \ check_account-mgr INCLUDES=\ -- 1.7.9.5