* Added some more UI actions implementations
authorSergio Villar Senin <svillar@igalia.com>
Fri, 19 Jan 2007 12:51:16 +0000 (12:51 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Fri, 19 Jan 2007 12:51:16 +0000 (12:51 +0000)
* Fixed some problems with the tests

pmo-trunk-r674

src/gtk/modest-main-window.c
src/gtk/ui/modest-ui.xml
src/modest-mail-operation.c
src/modest-ui-actions.h
src/modest-ui.c
src/widgets/modest-main-window-ui.h
tests/Makefile.am

index 76c78b3..3ff82f4 100644 (file)
@@ -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,
index 4abe8a4..7b4da63 100644 (file)
@@ -63,6 +63,7 @@
       <menuitem name="ActionsFolderNewMenu" action="ActionsFolderNew"/>
       <menuitem name="ActionsFolderDeleteMenu" action="ActionsFolderDelete"/>
       <menuitem name="ActionsFolderRenameMenu" action="ActionsFolderRename"/>
+      <menuitem name="ActionsFolderMoveToTrashMenu" action="ActionsFolderMoveToTrash"/>
     </menu>
 
     <menu name="OptionsMenu" action="Options">
     <menuitem action="ActionsFolderNew"/>
     <menuitem action="ActionsFolderDelete"/>
     <menuitem action="ActionsFolderRename"/>
+    <menuitem action="ActionsFolderMoveToTrash"/>
   </popup>
-
-</ui>
index 9d79383..171915b 100644 (file)
@@ -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, 
index edcdc25..64eb000 100644 (file)
@@ -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__ */
index 738f5e7..6a78ebb 100644 (file)
@@ -44,6 +44,7 @@
 #include <modest-widget-memory.h>
 #include <tny-error.h>
 #include <tny-simple-list.h>
+#include <tny-msg-view.h>
 
 #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);
 }
index 9325f2e..de1e4cb 100644 (file)
@@ -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 */
index 813d483..1c94c48 100644 (file)
@@ -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=\