* Fixes NB#62423, the first INBOX folder is not selected when the MMC is removed...
authorSergio Villar Senin <svillar@igalia.com>
Thu, 4 Oct 2007 16:49:20 +0000 (16:49 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 4 Oct 2007 16:49:20 +0000 (16:49 +0000)
* Partially fixes NB#63761, Modest does not try to connect to send a new message, we still need that tinymail does not try to send if the device is offline in order to avoid an error message
* Added some missing account registrations in the mail operations

pmo-trunk-r3472

src/modest-mail-operation.c
src/modest-tny-send-queue.c
src/modest-ui-actions.c
src/widgets/modest-folder-view.c
src/widgets/modest-msg-view-window.h

index 96bf48a..aa21936 100644 (file)
@@ -804,6 +804,7 @@ modest_mail_operation_send_new_mail (ModestMailOperation *self,
 
        priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
        priv->op_type = MODEST_MAIL_OPERATION_TYPE_SEND;
+       priv->account = TNY_ACCOUNT (g_object_ref (transport_account));
 
        /* Check parametters */
        if (to == NULL) {
@@ -1506,6 +1507,7 @@ modest_mail_operation_update_account (ModestMailOperation *self,
                goto error;
        }
 
+       priv->account = g_object_ref (store_account);
        
        /* Get the transport account, we can not do it in the thread
           due to some problems with dbus */
@@ -1586,6 +1588,9 @@ modest_mail_operation_create_folder (ModestMailOperation *self,
        
        priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self);
        priv->op_type = MODEST_MAIL_OPERATION_TYPE_INFO;
+       priv->account = (TNY_IS_ACCOUNT (parent)) ? 
+               g_object_ref (parent) : 
+               modest_tny_folder_get_account (TNY_FOLDER (parent));
 
        /* Check for already existing folder */
        if (modest_tny_folder_has_subfolder_with_name (parent, name)) {
@@ -2320,10 +2325,8 @@ modest_mail_operation_get_msgs_full (ModestMailOperation *self,
                        folder = tny_header_get_folder (header);
                        if (folder) {           
                                priv->account = modest_tny_folder_get_account (TNY_FOLDER(folder));
-
                                g_object_unref (folder);
                        }
-
                        g_object_unref (header);
                }
 
index 46a642d..1e37c43 100644 (file)
@@ -235,10 +235,10 @@ modest_tny_send_queue_add (ModestTnySendQueue *self, TnyMsg *msg, GError **err)
        g_return_if_fail (TNY_IS_CAMEL_MSG(msg));
 
        tny_camel_send_queue_add_async (TNY_CAMEL_SEND_QUEUE(self), 
-                                 msg, 
-                                 _on_added_to_outbox, 
-                                 NULL, 
-                                 NULL);
+                                       msg, 
+                                       _on_added_to_outbox, 
+                                       NULL, 
+                                       NULL);
 }
 
 
index a734068..b4f3773 100644 (file)
@@ -2203,10 +2203,6 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window)
        if (!modest_msg_edit_window_check_names (edit_window, TRUE))
                return;
        
-       /* Offer the connection dialog, if necessary: */        
-       if (!modest_platform_connect_and_wait (GTK_WINDOW (edit_window), NULL))
-               return;
-       
        /* FIXME: Code added just for testing. The final version will
           use the send queue provided by tinymail and some
           classifier */
index 9ae1997..4dba8fc 100644 (file)
@@ -909,6 +909,7 @@ on_account_removed (TnyAccountStore *account_store,
        ModestFolderViewPrivate *priv;
        GtkTreeModel *sort_model, *filter_model;
        GtkTreeSelection *sel = NULL;
+       TnyAccount *folder_selected_account;
 
        /* Ignore transport account removals, we're not showing them
           in the folder view */
@@ -971,8 +972,14 @@ on_account_removed (TnyAccountStore *account_store,
                                              MODEST_CONF_FOLDER_VIEW_KEY);
        }
 
-       /* Select the INBOX */
-       modest_folder_view_select_first_inbox_or_local (self);
+       /* Select the first INBOX if the currently selected folder
+          belongs to the account that is being deleted */
+       folder_selected_account = (TNY_IS_FOLDER (priv->cur_folder_store)) ?
+               modest_tny_folder_get_account (TNY_FOLDER (priv->cur_folder_store)) :
+               TNY_ACCOUNT (g_object_ref (priv->cur_folder_store));
+       if (account == folder_selected_account)
+               modest_folder_view_select_first_inbox_or_local (self);
+       g_object_unref (folder_selected_account);
 }
 
 void
index 6cad5e0..b703f72 100644 (file)
@@ -31,6 +31,7 @@
 #define __MODEST_MSG_VIEW_WINDOW_H__
 
 #include <tny-msg.h>
+#include <tny-folder.h>
 #include <widgets/modest-window.h>
 #include <gtk/gtktreemodel.h>