* Merged fixes for NB#85060. NB#86079 and NB#85621 from trunk
authorSergio Villar Senin <svillar@igalia.com>
Wed, 4 Jun 2008 10:09:04 +0000 (10:09 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Wed, 4 Jun 2008 10:09:04 +0000 (10:09 +0000)
pmo-diablo-r4604

src/gnome/modest-main-window.c
src/maemo/modest-main-window.c
src/modest-mail-operation.c
src/modest-main.c
src/modest-ui-actions.c
src/widgets/modest-header-view.c

index d1432fc..1caf907 100644 (file)
@@ -420,12 +420,6 @@ connect_signals (ModestMainWindow *self)
        g_signal_connect (G_OBJECT(priv->msg_preview), "recpt-activated",
                          G_CALLBACK(modest_ui_actions_on_msg_recpt_activated), self);
 
        g_signal_connect (G_OBJECT(priv->msg_preview), "recpt-activated",
                          G_CALLBACK(modest_ui_actions_on_msg_recpt_activated), self);
 
-       /* Account store */
-       /* Emmitted by our TnyAccountStore::get_password_func() implementation,
-        * This is not a normal part of tinymail: */
-       g_signal_connect (G_OBJECT (modest_runtime_get_account_store()), "password_requested",
-                         G_CALLBACK (modest_ui_actions_on_password_requested), self);
-       
        /* Device */
        g_signal_connect (G_OBJECT(priv->online_toggle), "toggled",
                          G_CALLBACK(on_online_toggle_toggled), self);
        /* Device */
        g_signal_connect (G_OBJECT(priv->online_toggle), "toggled",
                          G_CALLBACK(on_online_toggle_toggled), self);
index 312e6d9..86925f8 100644 (file)
@@ -1051,13 +1051,6 @@ connect_signals (ModestMainWindow *self)
                                           "account_changed", 
                                           G_CALLBACK (on_account_changed),
                                           self);
                                           "account_changed", 
                                           G_CALLBACK (on_account_changed),
                                           self);
-
-       priv->sighandlers = 
-               modest_signal_mgr_connect (priv->sighandlers,
-                                          G_OBJECT (modest_runtime_get_account_store()), 
-                                          "password_requested",
-                                          G_CALLBACK (modest_ui_actions_on_password_requested), 
-                                          self);
 }
 
 static void 
 }
 
 static void 
@@ -1334,7 +1327,7 @@ modest_main_window_new (void)
        helper->handler_id = g_signal_connect (G_OBJECT(self), "show",
                                               G_CALLBACK (modest_main_window_on_show), 
                                               helper);
        helper->handler_id = g_signal_connect (G_OBJECT(self), "show",
                                               G_CALLBACK (modest_main_window_on_show), 
                                               helper);
-               
+       
        /* Set window icon */
        window_icon = modest_platform_get_icon (MODEST_APP_ICON, MODEST_ICON_SIZE_BIG);
        if (window_icon) {
        /* Set window icon */
        window_icon = modest_platform_get_icon (MODEST_APP_ICON, MODEST_ICON_SIZE_BIG);
        if (window_icon) {
index 9eec9ff..0988394 100644 (file)
@@ -2824,6 +2824,7 @@ modest_mail_operation_xfer_msgs (ModestMailOperation *self,
        ModestTnyFolderRules rules = 0;
        TnyAccount *dst_account = NULL;
        gboolean leave_on_server;
        ModestTnyFolderRules rules = 0;
        TnyAccount *dst_account = NULL;
        gboolean leave_on_server;
+       ModestMailOperationState *state;
 
        g_return_if_fail (self && MODEST_IS_MAIL_OPERATION (self));
        g_return_if_fail (headers && TNY_IS_LIST (headers));
 
        g_return_if_fail (self && MODEST_IS_MAIL_OPERATION (self));
        g_return_if_fail (headers && TNY_IS_LIST (headers));
@@ -2935,6 +2936,14 @@ modest_mail_operation_xfer_msgs (ModestMailOperation *self,
        helper->delete = (leave_on_server) ? FALSE : delete_original;
 
        modest_mail_operation_notify_start (self);
        helper->delete = (leave_on_server) ? FALSE : delete_original;
 
        modest_mail_operation_notify_start (self);
+
+       /* Start notifying progress */
+       state = modest_mail_operation_clone_state (self);
+       state->done = 0;
+       state->total = 0;
+       g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
+       g_slice_free (ModestMailOperationState, state);
+
        tny_folder_transfer_msgs_async (src_folder, 
                                        helper->headers, 
                                        folder, 
        tny_folder_transfer_msgs_async (src_folder, 
                                        helper->headers, 
                                        folder, 
index b330ca2..edfd795 100644 (file)
  */
 
 #include <config.h>
  */
 
 #include <config.h>
-
+#include <gdk/gdk.h>
+#include <string.h>
 #include <glib.h>
 #include <modest-runtime.h>
 #include <modest-init.h>
 #include "modest-platform.h"
 #include <glib.h>
 #include <modest-runtime.h>
 #include <modest-init.h>
 #include "modest-platform.h"
-#include <gdk/gdk.h>
+#include "modest-ui-actions.h"
 #include <widgets/modest-main-window.h>
 #include <widgets/modest-main-window.h>
-#include <string.h>
 
 typedef struct {
        gulong queue_handler;
        gulong window_list_handler;
 
 typedef struct {
        gulong queue_handler;
        gulong window_list_handler;
+       gulong get_password_handler;
 } MainSignalHandlers;
 
 static gboolean
 } MainSignalHandlers;
 
 static gboolean
@@ -56,13 +57,16 @@ on_idle_exit_modest (gpointer data)
                                     handlers->queue_handler);
        g_signal_handler_disconnect (modest_runtime_get_window_mgr (), 
                                     handlers->window_list_handler);
                                     handlers->queue_handler);
        g_signal_handler_disconnect (modest_runtime_get_window_mgr (), 
                                     handlers->window_list_handler);
-
+       g_signal_handler_disconnect (modest_runtime_get_account_store (), 
+                                    handlers->get_password_handler);
+       g_free (handlers);
+       
        /* Wait for remaining tasks */
        while (gtk_events_pending ())
                gtk_main_iteration ();
 
        gtk_main_quit ();
        /* Wait for remaining tasks */
        while (gtk_events_pending ())
                gtk_main_iteration ();
 
        gtk_main_quit ();
-
+       
        gdk_threads_leave ();
 
        return FALSE;
        gdk_threads_leave ();
 
        return FALSE;
@@ -136,20 +140,28 @@ main (int argc, char *argv[])
                goto cleanup;
        }
 
                goto cleanup;
        }
 
-       /* Connect to the queue-emtpy signal */
        handlers = g_malloc0 (sizeof (MainSignalHandlers));
        handlers = g_malloc0 (sizeof (MainSignalHandlers));
+       /* Connect to the "queue-emtpy" signal */
        handlers->queue_handler = 
                g_signal_connect (modest_runtime_get_mail_operation_queue (),
                                  "queue-empty",
                                  G_CALLBACK (on_queue_empty),
                                  handlers);
 
        handlers->queue_handler = 
                g_signal_connect (modest_runtime_get_mail_operation_queue (),
                                  "queue-empty",
                                  G_CALLBACK (on_queue_empty),
                                  handlers);
 
+       /* Connect to the "window-list-emtpy" signal */
        handlers->window_list_handler = 
                g_signal_connect (modest_runtime_get_window_mgr (),
                                  "window-list-empty",
                                  G_CALLBACK (on_window_list_empty),
                                  handlers);
 
        handlers->window_list_handler = 
                g_signal_connect (modest_runtime_get_window_mgr (),
                                  "window-list-empty",
                                  G_CALLBACK (on_window_list_empty),
                                  handlers);
 
+       /* Connect to the "password-requested" signal */
+       handlers->get_password_handler = 
+               g_signal_connect (modest_runtime_get_account_store (),
+                                 "password_requested",
+                                 G_CALLBACK (modest_ui_actions_on_password_requested),
+                                 NULL);
+
        /* Usually, we only show the UI when we get the "top_application" D-Bus method.
         * This allows modest to start via D-Bus activation to provide a service,
         * without showing the UI.
        /* Usually, we only show the UI when we get the "top_application" D-Bus method.
         * This allows modest to start via D-Bus activation to provide a service,
         * without showing the UI.
index 9de9190..1bf4c95 100644 (file)
@@ -1357,7 +1357,7 @@ open_msgs_from_headers (TnyList *headers, ModestWindow *win)
                        }
                }
        }
                        }
                }
        }
-       
+
        /* Register the headers before actually creating the windows: */
        iter_not_opened = tny_list_create_iterator (not_opened_headers);
        while (!tny_iterator_is_done (iter_not_opened)) {
        /* Register the headers before actually creating the windows: */
        iter_not_opened = tny_list_create_iterator (not_opened_headers);
        while (!tny_iterator_is_done (iter_not_opened)) {
@@ -2256,8 +2256,6 @@ modest_ui_actions_on_header_activated (ModestHeaderView *header_view,
        if (!GTK_WIDGET_IS_SENSITIVE (open_widget))
                return;
 
        if (!GTK_WIDGET_IS_SENSITIVE (open_widget))
                return;
 
-/*     headers = tny_simple_list_new (); */
-/*     tny_list_prepend (headers, G_OBJECT (header)); */
        headers = modest_header_view_get_selected_headers (header_view);
 
        open_msgs_from_headers (headers, MODEST_WINDOW (main_window));
        headers = modest_header_view_get_selected_headers (header_view);
 
        open_msgs_from_headers (headers, MODEST_WINDOW (main_window));
@@ -5029,6 +5027,11 @@ xfer_messages_error_handler (ModestMailOperation *mail_op,
        }
 }
 
        }
 }
 
+typedef struct {
+       TnyFolderStore *dst_folder;
+       TnyList *headers;
+} XferMsgsHelper;
+
 /**
  * Utility function that transfer messages from both the main window
  * and the msg view window when using the "Move to" dialog
 /**
  * Utility function that transfer messages from both the main window
  * and the msg view window when using the "Move to" dialog
@@ -5040,12 +5043,15 @@ xfer_messages_performer  (gboolean canceled,
                          TnyAccount *account, 
                          gpointer user_data)
 {
                          TnyAccount *account, 
                          gpointer user_data)
 {
-       TnyFolderStore *dst_folder = TNY_FOLDER_STORE (user_data);
        ModestWindow *win = MODEST_WINDOW (parent_window);
        ModestWindow *win = MODEST_WINDOW (parent_window);
-       TnyList *headers = NULL;
        TnyAccount *dst_account = NULL;
        const gchar *proto_str = NULL;
        gboolean dst_is_pop = FALSE;
        TnyAccount *dst_account = NULL;
        const gchar *proto_str = NULL;
        gboolean dst_is_pop = FALSE;
+       XferMsgsHelper *helper;
+       MoveToHelper *movehelper;
+       ModestMailOperation *mail_op;
+
+       helper = (XferMsgsHelper *) user_data;
 
        if (canceled)
                goto end;
 
        if (canceled)
                goto end;
@@ -5062,7 +5068,7 @@ xfer_messages_performer  (gboolean canceled,
                goto end;
        }
 
                goto end;
        }
 
-       dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder));
+       dst_account = tny_folder_get_account (TNY_FOLDER (helper->dst_folder));
        proto_str = tny_account_get_proto (dst_account);
 
        /* tinymail will return NULL for local folders it seems */
        proto_str = tny_account_get_proto (dst_account);
 
        /* tinymail will return NULL for local folders it seems */
@@ -5072,57 +5078,49 @@ xfer_messages_performer  (gboolean canceled,
 
        g_object_unref (dst_account);
 
 
        g_object_unref (dst_account);
 
-       /* Get selected headers */
-       headers = get_selected_headers (MODEST_WINDOW (win));
-       if (!headers) {
-               g_warning ("%s: no headers selected", __FUNCTION__);
-               goto end;
-       }
-
        if (dst_is_pop) {
                modest_platform_information_banner (GTK_WIDGET (win),
                                                    NULL,
                                                    ngettext("mail_in_ui_folder_move_target_error",
                                                             "mail_in_ui_folder_move_targets_error",
        if (dst_is_pop) {
                modest_platform_information_banner (GTK_WIDGET (win),
                                                    NULL,
                                                    ngettext("mail_in_ui_folder_move_target_error",
                                                             "mail_in_ui_folder_move_targets_error",
-                                                            tny_list_get_length (headers)));
-               g_object_unref (headers);
+                                                            tny_list_get_length (helper->headers)));
                goto end;
        }
 
                goto end;
        }
 
-       MoveToHelper *helper = g_new0 (MoveToHelper, 1);
-       helper->banner = modest_platform_animation_banner (GTK_WIDGET (win), NULL,
-                                                          _CS("ckct_nw_pasting"));
-       if (helper->banner != NULL)  {
-               g_object_ref (helper->banner);
-               gtk_window_set_modal (GTK_WINDOW(helper->banner), FALSE);
-               gtk_widget_show (GTK_WIDGET(helper->banner));
+       movehelper = g_new0 (MoveToHelper, 1);
+       movehelper->banner = modest_platform_animation_banner (GTK_WIDGET (win), NULL,
+                                                              _CS("ckct_nw_pasting"));
+       if (movehelper->banner != NULL)  {
+               g_object_ref (movehelper->banner);
+               gtk_widget_show (GTK_WIDGET (movehelper->banner));
        }
 
        if (MODEST_IS_MAIN_WINDOW (win)) {
                GtkWidget *header_view = 
                        modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
                                                             MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
        }
 
        if (MODEST_IS_MAIN_WINDOW (win)) {
                GtkWidget *header_view = 
                        modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
                                                             MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
-               helper->reference = get_next_after_selected_headers (MODEST_HEADER_VIEW (header_view));
+               movehelper->reference = get_next_after_selected_headers (MODEST_HEADER_VIEW (header_view));
        }
 
        }
 
-       ModestMailOperation *mail_op = 
-               modest_mail_operation_new_with_error_handling (G_OBJECT(win),
-                                                              xfer_messages_error_handler,
-                                                              NULL, NULL);
+       /* Perform the mail operation */
+       mail_op = modest_mail_operation_new_with_error_handling (G_OBJECT(win),
+                                                                xfer_messages_error_handler,
+                                                                movehelper, NULL);
        modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), 
                                         mail_op);
 
        modest_mail_operation_xfer_msgs (mail_op, 
        modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), 
                                         mail_op);
 
        modest_mail_operation_xfer_msgs (mail_op, 
-                                        headers,
-                                        TNY_FOLDER (dst_folder),
+                                        helper->headers,
+                                        TNY_FOLDER (helper->dst_folder),
                                         TRUE,
                                         msgs_move_to_cb,
                                         TRUE,
                                         msgs_move_to_cb,
-                                        helper);
+                                        movehelper);
 
        g_object_unref (G_OBJECT (mail_op));
 
        g_object_unref (G_OBJECT (mail_op));
-       g_object_unref (headers);
  end:
  end:
-       g_object_unref (dst_folder);
+       g_object_unref (helper->dst_folder);
+       g_object_unref (helper->headers);
+       g_slice_free (XferMsgsHelper, helper);
 }
 
 typedef struct {
 }
 
 typedef struct {
@@ -5285,6 +5283,7 @@ modest_ui_actions_transfer_messages_helper (GtkWindow *win,
 {
        gboolean need_connection = TRUE;
        gboolean do_xfer = TRUE;
 {
        gboolean need_connection = TRUE;
        gboolean do_xfer = TRUE;
+       XferMsgsHelper *helper;
        
        modest_ui_actions_xfer_messages_check (win, TNY_FOLDER_STORE (src_folder), 
                                               headers, TNY_FOLDER (dst_folder),
        
        modest_ui_actions_xfer_messages_check (win, TNY_FOLDER_STORE (src_folder), 
                                               headers, TNY_FOLDER (dst_folder),
@@ -5295,11 +5294,16 @@ modest_ui_actions_transfer_messages_helper (GtkWindow *win,
        if (!do_xfer)
                return;
 
        if (!do_xfer)
                return;
 
+       /* Create the helper */
+       helper = g_slice_new (XferMsgsHelper);
+       helper->dst_folder = g_object_ref (dst_folder);
+       helper->headers = g_object_ref (headers);
+
        if (need_connection) {
                DoubleConnectionInfo *connect_info = g_slice_new (DoubleConnectionInfo);
                connect_info->callback = xfer_messages_performer;
                connect_info->dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder));
        if (need_connection) {
                DoubleConnectionInfo *connect_info = g_slice_new (DoubleConnectionInfo);
                connect_info->callback = xfer_messages_performer;
                connect_info->dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder));
-               connect_info->data = g_object_ref (dst_folder);
+               connect_info->data = helper;
                
                modest_platform_double_connect_and_perform(GTK_WINDOW (win), TRUE,
                                                           TNY_FOLDER_STORE (src_folder), 
                
                modest_platform_double_connect_and_perform(GTK_WINDOW (win), TRUE,
                                                           TNY_FOLDER_STORE (src_folder), 
@@ -5307,7 +5311,7 @@ modest_ui_actions_transfer_messages_helper (GtkWindow *win,
        } else {
                TnyAccount *src_account = get_account_from_folder_store (TNY_FOLDER_STORE (src_folder));
                xfer_messages_performer (FALSE, NULL, GTK_WINDOW (win),
        } else {
                TnyAccount *src_account = get_account_from_folder_store (TNY_FOLDER_STORE (src_folder));
                xfer_messages_performer (FALSE, NULL, GTK_WINDOW (win),
-                                        src_account, g_object_ref (dst_folder));
+                                        src_account, helper);
                g_object_unref (src_account);
        }
 }
                g_object_unref (src_account);
        }
 }
index 3fcc74c..c3aa831 100644 (file)
@@ -1827,7 +1827,7 @@ on_button_press_event(GtkWidget * self, GdkEventButton * event, gpointer userdat
        /* If it's already opened then do not let the button-press
           event go on because it'll perform a message open because
           we're clicking on to an already selected header */
        /* If it's already opened then do not let the button-press
           event go on because it'll perform a message open because
           we're clicking on to an already selected header */
-       return (already_opened) ? TRUE : FALSE;
+       return FALSE;
 }
 
 static void
 }
 
 static void