Work to fix bugs getting the From: field in the editor for new messages
authorJose Dapena Paz <jdapena@igalia.com>
Mon, 18 Jun 2007 10:12:11 +0000 (10:12 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Mon, 18 Jun 2007 10:12:11 +0000 (10:12 +0000)
and messages opened in drafts folder (fixes NB#58214, NB#58219):
* src/modest-ui-actions.c:
        * Now "New message" and "open message from drafts" fill the from
          field in the editor with the default account instead of the
          current folder active account.
* src/maemo/modest-msg-edit-window.c:
        * Fills the From: field with the account name passed in the
          constructor.

pmo-trunk-r2272

src/maemo/modest-msg-edit-window.c
src/modest-ui-actions.c

index c405a77..6473f57 100644 (file)
@@ -831,6 +831,7 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name)
        ModestConf *conf;
        gboolean prefer_formatted;
        gint file_format;
+       ModestPair *account_pair = NULL;
 
        g_return_val_if_fail (msg, NULL);
        g_return_val_if_fail (account_name, NULL);
@@ -912,6 +913,10 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name)
 
        setup_insensitive_handlers (MODEST_MSG_EDIT_WINDOW (obj));
 
+       account_pair = modest_pair_list_find_by_first_as_string (priv->from_field_protos, account_name);
+       if (account_pair != NULL)
+               modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->from_field), account_pair->first);
+
        set_msg (MODEST_MSG_EDIT_WINDOW (obj), msg);
 
        text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), MODEST_MSG_EDIT_WINDOW (obj));
index 0af6fe9..5dc7a56 100644 (file)
@@ -492,9 +492,9 @@ modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win)
                        return;
        }
        
-       account_name = g_strdup(modest_window_get_active_account (win));
+       account_name = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr ());
        if (!account_name)
-               account_name = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
+               account_name = g_strdup (modest_window_get_active_account (win));
        if (!account_name) {
                g_printerr ("modest: no account found\n");
                goto cleanup;
@@ -584,9 +584,9 @@ open_msg_cb (ModestMailOperation *mail_op,
        headers_action_mark_as_read (header, MODEST_WINDOW(parent_win), NULL);
 
        /* Get account */
-       account =  g_strdup (modest_window_get_active_account (MODEST_WINDOW (parent_win)));
+       account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
        if (!account)
-               account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
+               account =  g_strdup (modest_window_get_active_account (MODEST_WINDOW (parent_win)));
        
        /* Gets folder type (OUTBOX headers will be opened in edit window */
        if (modest_tny_folder_is_local_folder (folder))