Fixed compilation warnings
[modest] / src / modest-ui-actions.c
index abc79a4..781b52c 100644 (file)
@@ -35,6 +35,7 @@
 #include <glib/gprintf.h>
 #include <string.h>
 #include <modest-runtime.h>
+#include <modest-defs.h>
 #include <modest-tny-folder.h>
 #include <modest-tny-msg.h>
 #include <modest-tny-account.h>
@@ -2068,12 +2069,12 @@ modest_ui_actions_on_sort (GtkAction *action,
 
        if (!header_view) {
                modest_platform_information_banner (NULL, NULL, _CS("ckdg_ib_nothing_to_sort"));
-               
+
                return;
        }
 
        /* Show sorting dialog */
-       modest_utils_run_sort_dialog (GTK_WINDOW (window), MODEST_SORT_HEADERS);        
+       modest_utils_run_sort_dialog (GTK_WINDOW (window), MODEST_SORT_HEADERS);
 }
 
 static void
@@ -3382,7 +3383,7 @@ do_create_folder (GtkWindow *parent_window,
                                                        &parent_folder);
 
        if (result == GTK_RESPONSE_ACCEPT && parent_folder) {
-               CreateFolderConnect *helper = (CreateFolderConnect *) g_slice_new0 (CreateFolderHelper);
+               CreateFolderConnect *helper = (CreateFolderConnect *) g_slice_new0 (CreateFolderConnect);
                helper->folder_name = g_strdup (folder_name);
                helper->parent = g_object_ref (parent_folder);
 
@@ -4900,36 +4901,43 @@ on_move_to_dialog_response (GtkDialog *dialog,
                            gint       response,
                            gpointer   user_data)
 {
-       GtkWidget *parent_win, *folder_view;
+       GtkWidget *parent_win;
        MoveToInfo *helper = NULL;
+       ModestFolderView *folder_view;
 
        helper = (MoveToInfo *) user_data;
 
        parent_win = (GtkWidget *) helper->win;
-       folder_view = GTK_WIDGET (g_object_get_data (G_OBJECT (dialog),
-                                                    MODEST_MOVE_TO_DIALOG_FOLDER_VIEW));
+       folder_view = MODEST_FOLDER_VIEW (g_object_get_data (G_OBJECT (dialog),
+                                                            MODEST_MOVE_TO_DIALOG_FOLDER_VIEW));
 
        switch (response) {
                TnyFolderStore *dst_folder;
 
        case MODEST_GTK_RESPONSE_NEW_FOLDER:
-               modest_ui_actions_create_folder (GTK_WIDGET (dialog), folder_view);
+               modest_ui_actions_create_folder (GTK_WIDGET (dialog), GTK_WIDGET (folder_view));
                return;
        case GTK_RESPONSE_NONE:
        case GTK_RESPONSE_CANCEL:
        case GTK_RESPONSE_DELETE_EVENT:
                break;
        case GTK_RESPONSE_OK:
-               dst_folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
-               /* Do window specific stuff */
+               dst_folder = modest_folder_view_get_selected (folder_view);
+
                if (MODEST_IS_MAIN_WINDOW (parent_win)) {
+                       /* Clean list to move used for filtering */
+                       modest_folder_view_set_list_to_move (folder_view, NULL);
+
                        modest_ui_actions_on_main_window_move_to (NULL,
-                                                                 folder_view,
+                                                                 GTK_WIDGET (folder_view),
                                                                  dst_folder,
                                                                  MODEST_MAIN_WINDOW (parent_win));
 #ifdef MODEST_TOOLKIT_HILDON2
                } else if (MODEST_IS_FOLDER_WINDOW (parent_win)) {
-                       modest_ui_actions_on_folder_window_move_to (folder_view,
+                       /* Clean list to move used for filtering */
+                       modest_folder_view_set_list_to_move (folder_view, NULL);
+
+                       modest_ui_actions_on_folder_window_move_to (GTK_WIDGET (folder_view),
                                                                    dst_folder,
                                                                    helper->list,
                                                                    GTK_WINDOW (parent_win));
@@ -4942,6 +4950,9 @@ on_move_to_dialog_response (GtkDialog *dialog,
                                return;
                        }
 
+                       /* Clean list to move used for filtering */
+                       modest_folder_view_set_list_to_move (folder_view, NULL);
+
                        /* Moving from headers window in edit mode */
                        modest_ui_actions_on_window_move_to (NULL, helper->list,
                                                             dst_folder, 
@@ -4965,7 +4976,8 @@ on_move_to_dialog_response (GtkDialog *dialog,
 
 static GtkWidget*
 create_move_to_dialog (GtkWindow *win,
-                      GtkWidget *folder_view)
+                      GtkWidget *folder_view,
+                      TnyList *list_to_move)
 {
        GtkWidget *dialog, *tree_view = NULL;
 
@@ -5034,6 +5046,8 @@ create_move_to_dialog (GtkWindow *win,
 
        /* Hide special folders */
        modest_folder_view_show_non_move_folders (MODEST_FOLDER_VIEW (tree_view), FALSE);
+       if (list_to_move)
+               modest_folder_view_set_list_to_move (MODEST_FOLDER_VIEW (tree_view), list_to_move);
 #ifndef MODEST_TOOLKIT_HILDON2
        modest_folder_view_select_first_inbox_or_local (MODEST_FOLDER_VIEW (tree_view));
 #endif
@@ -5895,7 +5909,7 @@ modest_ui_actions_on_edit_mode_move_to (ModestWindow *win)
        }
 
        /* Create and run the dialog */
-       dialog = create_move_to_dialog (GTK_WINDOW (win), NULL);
+       dialog = create_move_to_dialog (GTK_WINDOW (win), NULL, list_to_move);
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
                                     GTK_WINDOW (dialog), 
                                     (GtkWindow *) win);