[pawel] 3.7.3cvs13
authorPaweł Pękala <c0rn@gazeta.pl>
Wed, 11 Nov 2009 13:38:28 +0000 (13:38 +0000)
committerPaweł Pękala <c0rn@gazeta.pl>
Wed, 11 Nov 2009 13:38:28 +0000 (13:38 +0000)
* src/addressbook.c
* src/compose.c
* src/compose.h
* src/filtering.c
Fix Bug 1867 Changing account does not change BCC address
Set account specific headers when changing account
in compose window.

ChangeLog
PATCHSETS
configure.ac
src/addressbook.c
src/compose.c
src/compose.h
src/filtering.c

index c8203fed7f6caf11f402a33e34ae8b6eec01b1d9..5259f597eebab20b4148a7d8526d662c8820df90 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+ [pawel]       3.7.3cvs13
+
+       * src/addressbook.c
+       * src/compose.c
+       * src/compose.h
+       * src/filtering.c
+               Fix Bug 1867 Changing account does not change BCC address
+               Set account specific headers when changing account
+               in compose window.
+
 2009-11-07 [colin]     3.7.3cvs12
 
        * src/gtk/prefswindow.c
 2009-11-07 [colin]     3.7.3cvs12
 
        * src/gtk/prefswindow.c
index a88030265ee50a39d0179cd8b9203f5361468774..51a6021c85b8a7764db0bd35759e6c925e5e5b84 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.213.2.194 -r 1.213.2.195 src/folder.c;  ) > 3.7.3cvs10.patchset
 ( cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/gtk/spell_entry.c;  ) > 3.7.3cvs11.patchset
 ( cvs diff -u -r 1.12.2.53 -r 1.12.2.54 src/gtk/prefswindow.c;  ) > 3.7.3cvs12.patchset
 ( cvs diff -u -r 1.213.2.194 -r 1.213.2.195 src/folder.c;  ) > 3.7.3cvs10.patchset
 ( cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/gtk/spell_entry.c;  ) > 3.7.3cvs11.patchset
 ( cvs diff -u -r 1.12.2.53 -r 1.12.2.54 src/gtk/prefswindow.c;  ) > 3.7.3cvs12.patchset
+( cvs diff -u -r 1.60.2.134 -r 1.60.2.135 src/addressbook.c;  cvs diff -u -r 1.382.2.524 -r 1.382.2.525 src/compose.c;  cvs diff -u -r 1.50.2.55 -r 1.50.2.56 src/compose.h;  cvs diff -u -r 1.60.2.53 -r 1.60.2.54 src/filtering.c;  ) > 3.7.3cvs13.patchset
index e94b15066430f633c8a55bbcc6d13cefad11321b..b08bac14aca3f3571e828a97f907bc5740654914 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=12
+EXTRA_VERSION=13
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index da84a41bbb4422891ac73f089986c9ac6e9a7291..94405df9b8b59e6ae3d6688a31c8980e43304bba 100644 (file)
@@ -1766,7 +1766,7 @@ static void addressbook_to_clicked(GtkButton *button, gpointer data)
        addr = (char *)gtk_entry_get_text( GTK_ENTRY( addrbook.entry) );
        if ( addr ) {
                compose_entry_append(
        addr = (char *)gtk_entry_get_text( GTK_ENTRY( addrbook.entry) );
        if ( addr ) {
                compose_entry_append(
-                       compose, addr, (ComposeEntryType)data );
+                       compose, addr, (ComposeEntryType)data , PREF_NONE);
        }
 
        /* Select from address list */
        }
 
        /* Select from address list */
@@ -1781,7 +1781,7 @@ static void addressbook_to_clicked(GtkButton *button, gpointer data)
                            aio->type == ADDR_ITEM_EMAIL ) {
                                addr = addressbook_format_address( aio );
                                compose_entry_append(
                            aio->type == ADDR_ITEM_EMAIL ) {
                                addr = addressbook_format_address( aio );
                                compose_entry_append(
-                                       compose, addr, (ComposeEntryType) data );
+                                       compose, addr, (ComposeEntryType) data, PREF_NONE );
                                g_free( addr );
                        }
                        else if( aio->type == ADDR_ITEM_GROUP ) {
                                g_free( addr );
                        }
                        else if( aio->type == ADDR_ITEM_GROUP ) {
@@ -1793,7 +1793,7 @@ static void addressbook_to_clicked(GtkButton *button, gpointer data)
                                        addr = addressbook_format_address(
                                                        ( AddrItemObject * ) email );
                                        compose_entry_append(
                                        addr = addressbook_format_address(
                                                        ( AddrItemObject * ) email );
                                        compose_entry_append(
-                                               compose, addr, (ComposeEntryType) data );
+                                               compose, addr, (ComposeEntryType) data, PREF_NONE );
                                        g_free( addr );
                                        nodeMail = g_list_next( nodeMail );
                                }
                                        g_free( addr );
                                        nodeMail = g_list_next( nodeMail );
                                }
@@ -1813,7 +1813,7 @@ static void addressbook_to_clicked(GtkButton *button, gpointer data)
                                addr = addressbook_format_address(
                                                ( AddrItemObject * ) email );
                                compose_entry_append(
                                addr = addressbook_format_address(
                                                ( AddrItemObject * ) email );
                                compose_entry_append(
-                                       compose, addr, (ComposeEntryType) data );
+                                       compose, addr, (ComposeEntryType) data, PREF_NONE );
                                g_free( addr );
                                nodeMail = g_list_next( nodeMail );
                        }
                                g_free( addr );
                                nodeMail = g_list_next( nodeMail );
                        }
index b211cc1a41fcd767be5066d566a7777e5b99ba4d..97056e26ab13f03ce3d2891e1a7a6a9fd71d0745 100644 (file)
@@ -328,7 +328,8 @@ static void compose_undo_state_changed              (UndoMain       *undostruct,
                                                 gpointer        data);
 
 static void compose_create_header_entry        (Compose *compose);
                                                 gpointer        data);
 
 static void compose_create_header_entry        (Compose *compose);
-static void compose_add_header_entry   (Compose *compose, const gchar *header, gchar *text);
+static void compose_add_header_entry   (Compose *compose, const gchar *header,
+                                        gchar *text, ComposePrefType pref_type);
 static void compose_remove_header_entries(Compose *compose);
 
 static void compose_update_priority_menu_item(Compose * compose);
 static void compose_remove_header_entries(Compose *compose);
 
 static void compose_update_priority_menu_item(Compose * compose);
@@ -1020,16 +1021,20 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
 
                } else if (item && item->prefs) {
                        if (item->prefs->enable_default_bcc) {
 
                } else if (item && item->prefs) {
                        if (item->prefs->enable_default_bcc) {
-                               compose_entry_append(compose, item->prefs->default_bcc, COMPOSE_BCC);
+                               compose_entry_append(compose, item->prefs->default_bcc,
+                                               COMPOSE_BCC, PREF_FOLDER);
                        }
                        if (item->prefs->enable_default_cc) {
                        }
                        if (item->prefs->enable_default_cc) {
-                               compose_entry_append(compose, item->prefs->default_cc, COMPOSE_CC);
+                               compose_entry_append(compose, item->prefs->default_cc,
+                                               COMPOSE_CC, PREF_FOLDER);
                        }
                        if (item->prefs->enable_default_replyto) {
                        }
                        if (item->prefs->enable_default_replyto) {
-                               compose_entry_append(compose, item->prefs->default_replyto, COMPOSE_REPLYTO);
+                               compose_entry_append(compose, item->prefs->default_replyto,
+                                               COMPOSE_REPLYTO, PREF_FOLDER);
                        }
                        if (item->prefs->enable_default_to) {
                        }
                        if (item->prefs->enable_default_to) {
-                               compose_entry_append(compose, item->prefs->default_to, COMPOSE_TO);
+                               compose_entry_append(compose, item->prefs->default_to,
+                                               COMPOSE_TO, PREF_FOLDER);
                                compose_entry_mark_default_to(compose, item->prefs->default_to);
                        }
                }
                                compose_entry_mark_default_to(compose, item->prefs->default_to);
                        }
                }
@@ -1043,7 +1048,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
                        else
                                compose_entries_set(compose, mailto, COMPOSE_TO);
                } else if (item && FOLDER_CLASS(item->folder) == news_get_class()) {
                        else
                                compose_entries_set(compose, mailto, COMPOSE_TO);
                } else if (item && FOLDER_CLASS(item->folder) == news_get_class()) {
-                       compose_entry_append(compose, item->path, COMPOSE_NEWSGROUPS);
+                       compose_entry_append(compose, item->path, COMPOSE_NEWSGROUPS, PREF_FOLDER);
                }
                /*
                 * CLAWS: just don't allow return receipt request, even if the user
                }
                /*
                 * CLAWS: just don't allow return receipt request, even if the user
@@ -2382,7 +2387,7 @@ GList *compose_get_compose_list(void)
 }
 
 void compose_entry_append(Compose *compose, const gchar *address,
 }
 
 void compose_entry_append(Compose *compose, const gchar *address,
-                         ComposeEntryType type)
+                         ComposeEntryType type, ComposePrefType pref_type)
 {
        const gchar *header;
        gchar *cur, *begin;
 {
        const gchar *header;
        gchar *cur, *begin;
@@ -2427,7 +2432,7 @@ void compose_entry_append(Compose *compose, const gchar *address,
                        begin = cur;
                        while (*tmp == ' ' || *tmp == '\t')
                                tmp++;
                        begin = cur;
                        while (*tmp == ' ' || *tmp == '\t')
                                tmp++;
-                       compose_add_header_entry(compose, header, tmp);
+                       compose_add_header_entry(compose, header, tmp, pref_type);
                        g_free(o_tmp);
                        continue;
                }
                        g_free(o_tmp);
                        continue;
                }
@@ -2441,7 +2446,7 @@ void compose_entry_append(Compose *compose, const gchar *address,
                begin = cur;
                while (*tmp == ' ' || *tmp == '\t')
                        tmp++;
                begin = cur;
                while (*tmp == ' ' || *tmp == '\t')
                        tmp++;
-               compose_add_header_entry(compose, header, tmp);
+               compose_add_header_entry(compose, header, tmp, pref_type);
                g_free(o_tmp);          
        }
 }
                g_free(o_tmp);          
        }
 }
@@ -2542,11 +2547,11 @@ static void compose_entries_set(Compose *compose, const gchar *mailto, ComposeEn
        scan_mailto_url(mailto, NULL, &to, &cc, &bcc, &subject, &body, &attach);
 
        if (to)
        scan_mailto_url(mailto, NULL, &to, &cc, &bcc, &subject, &body, &attach);
 
        if (to)
-               compose_entry_append(compose, to, to_type);
+               compose_entry_append(compose, to, to_type, PREF_MAILTO);
        if (cc)
        if (cc)
-               compose_entry_append(compose, cc, COMPOSE_CC);
+               compose_entry_append(compose, cc, COMPOSE_CC, PREF_MAILTO);
        if (bcc)
        if (bcc)
-               compose_entry_append(compose, bcc, COMPOSE_BCC);
+               compose_entry_append(compose, bcc, COMPOSE_BCC, PREF_MAILTO);
        if (subject) {
                if (!g_utf8_validate (subject, -1, NULL)) {
                        temp = g_locale_to_utf8 (subject, -1, NULL, &len, NULL);
        if (subject) {
                if (!g_utf8_validate (subject, -1, NULL)) {
                        temp = g_locale_to_utf8 (subject, -1, NULL, &len, NULL);
@@ -3007,13 +3012,16 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
        if (compose->account->protocol != A_NNTP) {
                if (msginfo && msginfo->folder && msginfo->folder->prefs) {
                        if (msginfo->folder->prefs->enable_default_replyto) {
        if (compose->account->protocol != A_NNTP) {
                if (msginfo && msginfo->folder && msginfo->folder->prefs) {
                        if (msginfo->folder->prefs->enable_default_replyto) {
-                               compose_entry_append(compose, msginfo->folder->prefs->default_replyto, COMPOSE_REPLYTO);
+                               compose_entry_append(compose, msginfo->folder->prefs->default_replyto,
+                                                       COMPOSE_REPLYTO, PREF_FOLDER);
                        }
                        if (msginfo->folder->prefs->enable_default_bcc) {
                        }
                        if (msginfo->folder->prefs->enable_default_bcc) {
-                               compose_entry_append(compose, msginfo->folder->prefs->default_bcc, COMPOSE_BCC);
+                               compose_entry_append(compose, msginfo->folder->prefs->default_bcc,
+                                                       COMPOSE_BCC, PREF_FOLDER);
                        }
                        if (msginfo->folder->prefs->enable_default_cc) {
                        }
                        if (msginfo->folder->prefs->enable_default_cc) {
-                               compose_entry_append(compose, msginfo->folder->prefs->default_cc, COMPOSE_CC);
+                               compose_entry_append(compose, msginfo->folder->prefs->default_cc,
+                                                       COMPOSE_CC, PREF_FOLDER);
                        }
                }
                if (reply_to_ml && !default_reply_to) {
                        }
                }
                if (reply_to_ml && !default_reply_to) {
@@ -3024,28 +3032,28 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
                                /* normal answer to ml post with a reply-to */
                                compose_entry_append(compose,
                                           compose->ml_post,
                                /* normal answer to ml post with a reply-to */
                                compose_entry_append(compose,
                                           compose->ml_post,
-                                          COMPOSE_TO);
+                                          COMPOSE_TO, PREF_ML);
                                if (compose->replyto
                                &&  !same_address(compose->ml_post, compose->replyto))
                                        compose_entry_append(compose,
                                                compose->replyto,
                                if (compose->replyto
                                &&  !same_address(compose->ml_post, compose->replyto))
                                        compose_entry_append(compose,
                                                compose->replyto,
-                                               COMPOSE_CC);
+                                               COMPOSE_CC, PREF_ML);
                        } else {
                                /* answer to subscription confirmation */
                                if (compose->replyto)
                                        compose_entry_append(compose,
                                                compose->replyto,
                        } else {
                                /* answer to subscription confirmation */
                                if (compose->replyto)
                                        compose_entry_append(compose,
                                                compose->replyto,
-                                               COMPOSE_TO);
+                                               COMPOSE_TO, PREF_ML);
                                else if (msginfo->from)
                                        compose_entry_append(compose,
                                                msginfo->from,
                                else if (msginfo->from)
                                        compose_entry_append(compose,
                                                msginfo->from,
-                                               COMPOSE_TO);
+                                               COMPOSE_TO, PREF_ML);
                        }
                }
                else if (!(to_all || to_sender) && default_reply_to) {
                        compose_entry_append(compose,
                            msginfo->folder->prefs->default_reply_to,
                        }
                }
                else if (!(to_all || to_sender) && default_reply_to) {
                        compose_entry_append(compose,
                            msginfo->folder->prefs->default_reply_to,
-                           COMPOSE_TO);
+                           COMPOSE_TO, PREF_FOLDER);
                        compose_entry_mark_default_to(compose,
                                msginfo->folder->prefs->default_reply_to);
                } else {
                        compose_entry_mark_default_to(compose,
                                msginfo->folder->prefs->default_reply_to);
                } else {
@@ -3060,7 +3068,7 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
                                 (compose->replyto && !to_sender)
                                          ? compose->replyto :
                                          msginfo->from ? msginfo->from : "",
                                 (compose->replyto && !to_sender)
                                          ? compose->replyto :
                                          msginfo->from ? msginfo->from : "",
-                                         COMPOSE_TO);
+                                         COMPOSE_TO, PREF_NONE);
                        else if (!to_all && !to_sender) {
                                if (!folder_has_parent_of_type(msginfo->folder, F_QUEUE) &&
                                    !folder_has_parent_of_type(msginfo->folder, F_OUTBOX) &&
                        else if (!to_all && !to_sender) {
                                if (!folder_has_parent_of_type(msginfo->folder, F_QUEUE) &&
                                    !folder_has_parent_of_type(msginfo->folder, F_OUTBOX) &&
@@ -3068,20 +3076,20 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
                                        if (compose->replyto) {
                                                compose_entry_append(compose,
                                                        compose->replyto,
                                        if (compose->replyto) {
                                                compose_entry_append(compose,
                                                        compose->replyto,
-                                                       COMPOSE_TO);
+                                                       COMPOSE_TO, PREF_NONE);
                                        } else {
                                                compose_entry_append(compose,
                                                          msginfo->from ? msginfo->from : "",
                                        } else {
                                                compose_entry_append(compose,
                                                          msginfo->from ? msginfo->from : "",
-                                                         COMPOSE_TO);
+                                                         COMPOSE_TO, PREF_NONE);
                                        }
                                } else {
                                        /* replying to own mail, use original recp */
                                        compose_entry_append(compose,
                                                  msginfo->to ? msginfo->to : "",
                                        }
                                } else {
                                        /* replying to own mail, use original recp */
                                        compose_entry_append(compose,
                                                  msginfo->to ? msginfo->to : "",
-                                                 COMPOSE_TO);
+                                                 COMPOSE_TO, PREF_NONE);
                                        compose_entry_append(compose,
                                                  msginfo->cc ? msginfo->cc : "",
                                        compose_entry_append(compose,
                                                  msginfo->cc ? msginfo->cc : "",
-                                                 COMPOSE_CC);
+                                                 COMPOSE_CC, PREF_NONE);
                                }
                        }
                }
                                }
                        }
                }
@@ -3092,27 +3100,27 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
                                (compose, 
                                 (compose->replyto ? compose->replyto :
                                        msginfo->from ? msginfo->from : ""),
                                (compose, 
                                 (compose->replyto ? compose->replyto :
                                        msginfo->from ? msginfo->from : ""),
-                                COMPOSE_TO);
+                                COMPOSE_TO, PREF_NONE);
                                 
                else if (followup_and_reply_to || to_all) {
                        compose_entry_append
                                (compose,
                                 (compose->replyto ? compose->replyto :
                                 msginfo->from ? msginfo->from : ""),
                                 
                else if (followup_and_reply_to || to_all) {
                        compose_entry_append
                                (compose,
                                 (compose->replyto ? compose->replyto :
                                 msginfo->from ? msginfo->from : ""),
-                                COMPOSE_TO);                           
+                                COMPOSE_TO, PREF_NONE);                                
                
                        compose_entry_append
                                (compose,
                                 compose->followup_to ? compose->followup_to :
                                 compose->newsgroups ? compose->newsgroups : "",
                
                        compose_entry_append
                                (compose,
                                 compose->followup_to ? compose->followup_to :
                                 compose->newsgroups ? compose->newsgroups : "",
-                                COMPOSE_NEWSGROUPS);
+                                COMPOSE_NEWSGROUPS, PREF_NONE);
                } 
                else 
                        compose_entry_append
                                (compose,
                                 compose->followup_to ? compose->followup_to :
                                 compose->newsgroups ? compose->newsgroups : "",
                } 
                else 
                        compose_entry_append
                                (compose,
                                 compose->followup_to ? compose->followup_to :
                                 compose->newsgroups ? compose->newsgroups : "",
-                                COMPOSE_NEWSGROUPS);
+                                COMPOSE_NEWSGROUPS, PREF_NONE);
        }
 
        if (msginfo->subject && *msginfo->subject) {
        }
 
        if (msginfo->subject && *msginfo->subject) {
@@ -3180,7 +3188,7 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
        if (cc_list) {
                for (cur = cc_list; cur != NULL; cur = cur->next)
                        compose_entry_append(compose, (gchar *)cur->data,
        if (cc_list) {
                for (cur = cc_list; cur != NULL; cur = cur->next)
                        compose_entry_append(compose, (gchar *)cur->data,
-                                            COMPOSE_CC);
+                                            COMPOSE_CC, PREF_NONE);
                slist_free_strings(cc_list);
                g_slist_free(cc_list);
        }
                slist_free_strings(cc_list);
                g_slist_free(cc_list);
        }
@@ -3196,7 +3204,7 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
 #define SET_ADDRESS(type, str) \
 { \
        if (str && *str) \
 #define SET_ADDRESS(type, str) \
 { \
        if (str && *str) \
-               compose_entry_append(compose, str, type); \
+               compose_entry_append(compose, str, type, PREF_NONE); \
 }
 
 static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo)
 }
 
 static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo)
@@ -6364,6 +6372,8 @@ static void compose_create_header_entry(Compose *compose)
        const gchar *header = NULL;
        ComposeHeaderEntry *headerentry;
        gboolean standard_header = FALSE;
        const gchar *header = NULL;
        ComposeHeaderEntry *headerentry;
        gboolean standard_header = FALSE;
+       GtkListStore *model;
+       GtkTreeIter iter;
 #if !(GTK_CHECK_VERSION(2,12,0))
        GtkTooltips *tips = compose->tooltips;
 #endif
 #if !(GTK_CHECK_VERSION(2,12,0))
        GtkTooltips *tips = compose->tooltips;
 #endif
@@ -6371,13 +6381,21 @@ static void compose_create_header_entry(Compose *compose)
        headerentry = g_new0(ComposeHeaderEntry, 1);
 
        /* Combo box */
        headerentry = g_new0(ComposeHeaderEntry, 1);
 
        /* Combo box */
-       combo = gtk_combo_box_entry_new_text();
-       string = headers; 
-       while(*string != NULL) {
-               gtk_combo_box_append_text(GTK_COMBO_BOX(combo),
-                       (gchar*)prefs_common_translated_header_name(*string));
-               string++;
-       }
+       model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN);
+       combo = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(model), 0);
+       COMBOBOX_ADD(model, prefs_common_translated_header_name("To:"),
+                       COMPOSE_TO);
+       COMBOBOX_ADD(model, prefs_common_translated_header_name("Cc:"),
+                       COMPOSE_CC);
+       COMBOBOX_ADD(model, prefs_common_translated_header_name("Bcc:"),
+                       COMPOSE_BCC);
+       COMBOBOX_ADD(model, prefs_common_translated_header_name("Newsgroups:"),
+                       COMPOSE_NEWSGROUPS);                    
+       COMBOBOX_ADD(model, prefs_common_translated_header_name("Reply-To:"),
+                       COMPOSE_REPLYTO);
+       COMBOBOX_ADD(model, prefs_common_translated_header_name("Followup-To:"),
+                       COMPOSE_FOLLOWUPTO);
+
        gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
        g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN((combo)))), "grab_focus",
                         G_CALLBACK(compose_grab_focus_cb), compose);
        gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
        g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN((combo)))), "grab_focus",
                         G_CALLBACK(compose_grab_focus_cb), compose);
@@ -6471,6 +6489,7 @@ static void compose_create_header_entry(Compose *compose)
         headerentry->button = button;
         headerentry->hbox = hbox;
         headerentry->headernum = compose->header_nextrow;
         headerentry->button = button;
         headerentry->hbox = hbox;
         headerentry->headernum = compose->header_nextrow;
+        headerentry->type = PREF_NONE;
 
         compose->header_nextrow++;
        compose->header_last = headerentry;             
 
         compose->header_nextrow++;
        compose->header_last = headerentry;             
@@ -6479,28 +6498,33 @@ static void compose_create_header_entry(Compose *compose)
                               headerentry);
 }
 
                               headerentry);
 }
 
-static void compose_add_header_entry(Compose *compose, const gchar *header, gchar *text) 
+static void compose_add_header_entry(Compose *compose, const gchar *header,
+                               gchar *text, ComposePrefType pref_type) 
 {
        ComposeHeaderEntry *last_header;
        
        last_header = compose->header_last;
 
 {
        ComposeHeaderEntry *last_header;
        
        last_header = compose->header_last;
 
-       gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((last_header->combo)))), header);
+       combobox_select_by_text(GTK_COMBO_BOX(last_header->combo), header);
        gtk_entry_set_text(GTK_ENTRY(last_header->entry), text);
        gtk_entry_set_text(GTK_ENTRY(last_header->entry), text);
+       last_header->type = pref_type;
+}
+
+static void compose_destroy_headerentry(ComposeHeaderEntry *headerentry)
+{
+       gtk_widget_destroy(headerentry->combo);
+       gtk_widget_destroy(headerentry->entry);
+       gtk_widget_destroy(headerentry->button);
+       gtk_widget_destroy(headerentry->hbox);
+       g_free(headerentry);
 }
 
 static void compose_remove_header_entries(Compose *compose) 
 {
        GSList *list;
 }
 
 static void compose_remove_header_entries(Compose *compose) 
 {
        GSList *list;
-       for (list = compose->header_list; list; list = list->next) {
-               ComposeHeaderEntry *headerentry = 
-                       (ComposeHeaderEntry *)list->data;
-               gtk_widget_destroy(headerentry->combo);
-               gtk_widget_destroy(headerentry->entry);
-               gtk_widget_destroy(headerentry->button);
-               gtk_widget_destroy(headerentry->hbox);
-               g_free(headerentry);
-       }
+       for (list = compose->header_list; list; list = list->next)
+               compose_destroy_headerentry((ComposeHeaderEntry *)list->data);
+
        compose->header_last = NULL;
        g_slist_free(compose->header_list);
        compose->header_list = NULL;
        compose->header_last = NULL;
        g_slist_free(compose->header_list);
        compose->header_list = NULL;
@@ -7452,13 +7476,13 @@ static Compose *compose_create(PrefsAccount *account,
        cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoIndent", prefs_common.auto_indent);
 
        if (account->set_autocc && account->auto_cc && mode != COMPOSE_REEDIT)
        cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoIndent", prefs_common.auto_indent);
 
        if (account->set_autocc && account->auto_cc && mode != COMPOSE_REEDIT)
-               compose_entry_append(compose, account->auto_cc, COMPOSE_CC);
+               compose_entry_append(compose, account->auto_cc, COMPOSE_CC, PREF_ACCOUNT);
 
        if (account->set_autobcc && account->auto_bcc && mode != COMPOSE_REEDIT) 
 
        if (account->set_autobcc && account->auto_bcc && mode != COMPOSE_REEDIT) 
-               compose_entry_append(compose, account->auto_bcc, COMPOSE_BCC);
+               compose_entry_append(compose, account->auto_bcc, COMPOSE_BCC, PREF_ACCOUNT);
        
        if (account->set_autoreplyto && account->auto_replyto && mode != COMPOSE_REEDIT)
        
        if (account->set_autoreplyto && account->auto_replyto && mode != COMPOSE_REEDIT)
-               compose_entry_append(compose, account->auto_replyto, COMPOSE_REPLYTO);
+               compose_entry_append(compose, account->auto_replyto, COMPOSE_REPLYTO, PREF_ACCOUNT);
 
        cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/ReplyMode", compose->mode == COMPOSE_REPLY);
        if (account->protocol != A_NNTP)
 
        cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/ReplyMode", compose->mode == COMPOSE_REPLY);
        if (account->protocol != A_NNTP)
@@ -7620,13 +7644,13 @@ static void compose_reply_change_mode(Compose *compose,
        compose_remove_header_entries(compose);
        compose_reply_set_entry(compose, compose->replyinfo, all, ml, sender, followup);
        if (compose->account->set_autocc && compose->account->auto_cc)
        compose_remove_header_entries(compose);
        compose_reply_set_entry(compose, compose->replyinfo, all, ml, sender, followup);
        if (compose->account->set_autocc && compose->account->auto_cc)
-               compose_entry_append(compose, compose->account->auto_cc, COMPOSE_CC);
+               compose_entry_append(compose, compose->account->auto_cc, COMPOSE_CC, PREF_ACCOUNT);
 
        if (compose->account->set_autobcc && compose->account->auto_bcc) 
 
        if (compose->account->set_autobcc && compose->account->auto_bcc) 
-               compose_entry_append(compose, compose->account->auto_bcc, COMPOSE_BCC);
+               compose_entry_append(compose, compose->account->auto_bcc, COMPOSE_BCC, PREF_ACCOUNT);
        
        if (compose->account->set_autoreplyto && compose->account->auto_replyto)
        
        if (compose->account->set_autoreplyto && compose->account->auto_replyto)
-               compose_entry_append(compose, compose->account->auto_replyto, COMPOSE_REPLYTO);
+               compose_entry_append(compose, compose->account->auto_replyto, COMPOSE_REPLYTO, PREF_ACCOUNT);
        compose_show_first_last_header(compose, TRUE);
        compose->modified = was_modified;
        compose_set_title(compose);
        compose_show_first_last_header(compose, TRUE);
        compose->modified = was_modified;
        compose_set_title(compose);
@@ -8074,7 +8098,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl)
                if (buf == NULL) {
                        alertpanel_error(_("Template To format error."));
                } else {
                if (buf == NULL) {
                        alertpanel_error(_("Template To format error."));
                } else {
-                       compose_entry_append(compose, buf, COMPOSE_TO);
+                       compose_entry_append(compose, buf, COMPOSE_TO, PREF_TEMPLATE);
                }
        }
 
                }
        }
 
@@ -8092,7 +8116,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl)
                if (buf == NULL) {
                        alertpanel_error(_("Template Cc format error."));
                } else {
                if (buf == NULL) {
                        alertpanel_error(_("Template Cc format error."));
                } else {
-                       compose_entry_append(compose, buf, COMPOSE_CC);
+                       compose_entry_append(compose, buf, COMPOSE_CC, PREF_TEMPLATE);
                }
        }
 
                }
        }
 
@@ -8110,7 +8134,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl)
                if (buf == NULL) {
                        alertpanel_error(_("Template Bcc format error."));
                } else {
                if (buf == NULL) {
                        alertpanel_error(_("Template Bcc format error."));
                } else {
-                       compose_entry_append(compose, buf, COMPOSE_BCC);
+                       compose_entry_append(compose, buf, COMPOSE_BCC, PREF_TEMPLATE);
                }
        }
 
                }
        }
 
@@ -8932,6 +8956,13 @@ static gboolean compose_edit_size_alloc(GtkEditable *widget,
        return TRUE;
 }
 
        return TRUE;
 }
 
+typedef struct {
+       ComposeEntryType        header;
+       gchar                   *entry;
+       ComposePrefType         type;
+       gboolean                entry_marked;
+} HeaderEntryState;
+
 static void account_activated(GtkComboBox *optmenu, gpointer data)
 {
        Compose *compose = (Compose *)data;
 static void account_activated(GtkComboBox *optmenu, gpointer data)
 {
        Compose *compose = (Compose *)data;
@@ -8941,6 +8972,11 @@ static void account_activated(GtkComboBox *optmenu, gpointer data)
        gint account_id = 0;
        GtkTreeModel *menu;
        GtkTreeIter iter;
        gint account_id = 0;
        GtkTreeModel *menu;
        GtkTreeIter iter;
+       GSList *list, *saved_list = NULL;
+       HeaderEntryState *state;
+       GtkRcStyle *style = NULL;
+       static GdkColor yellow;
+       static gboolean color_set = FALSE;
 
        /* Get ID of active account in the combo box */
        menu = gtk_combo_box_get_model(optmenu);
 
        /* Get ID of active account in the combo box */
        menu = gtk_combo_box_get_model(optmenu);
@@ -8950,9 +8986,74 @@ static void account_activated(GtkComboBox *optmenu, gpointer data)
        ac = account_find_from_id(account_id);
        cm_return_if_fail(ac != NULL);
 
        ac = account_find_from_id(account_id);
        cm_return_if_fail(ac != NULL);
 
-       if (ac != compose->account)
+       if (ac != compose->account) {
                compose_select_account(compose, ac, FALSE);
 
                compose_select_account(compose, ac, FALSE);
 
+               for (list = compose->header_list; list; list = list->next) {
+                       ComposeHeaderEntry *hentry=(ComposeHeaderEntry *)list->data;
+                       
+                       if (hentry->type == PREF_ACCOUNT || !list->next) {
+                               compose_destroy_headerentry(hentry);
+                               continue;
+                       }
+                       
+                       state = g_malloc0(sizeof(HeaderEntryState));
+                       state->header = combobox_get_active_data(
+                                       GTK_COMBO_BOX(hentry->combo));
+                       state->entry = gtk_editable_get_chars(
+                                       GTK_EDITABLE(hentry->entry), 0, -1);
+                       state->type = hentry->type;
+                               
+                       if (!color_set) {
+                               gdk_color_parse("#f5f6be", &yellow);
+                               color_set = gdk_colormap_alloc_color(
+                                                       gdk_colormap_get_system(),
+                                                       &yellow, FALSE, TRUE);
+                       }
+                               
+                       style = gtk_widget_get_modifier_style(hentry->entry);
+                       state->entry_marked = gdk_color_equal(&yellow,
+                                               &style->base[GTK_STATE_NORMAL]);
+
+                       saved_list = g_slist_append(saved_list, state);
+                       compose_destroy_headerentry(hentry);
+               }
+
+               compose->header_last = NULL;
+               g_slist_free(compose->header_list);
+               compose->header_list = NULL;
+               compose->header_nextrow = 1;
+               compose_create_header_entry(compose);
+               
+               if (ac->set_autocc && ac->auto_cc)
+                       compose_entry_append(compose, ac->auto_cc,
+                                               COMPOSE_CC, PREF_ACCOUNT);
+
+               if (ac->set_autobcc && ac->auto_bcc) 
+                       compose_entry_append(compose, ac->auto_bcc,
+                                               COMPOSE_BCC, PREF_ACCOUNT);
+       
+               if (ac->set_autoreplyto && ac->auto_replyto)
+                       compose_entry_append(compose, ac->auto_replyto,
+                                               COMPOSE_REPLYTO, PREF_ACCOUNT);
+               
+               for (list = saved_list; list; list = list->next) {
+                       state = (HeaderEntryState *) list->data;
+                       
+                       compose_entry_append(compose, state->entry,
+                                               state->header, state->type);
+                       if (state->entry_marked)
+                               compose_entry_mark_default_to(compose, state->entry);
+                               
+                       g_free(state->entry);
+               }
+               g_slist_free(saved_list);
+               
+               combobox_select_by_data(GTK_COMBO_BOX(compose->header_last->combo),
+                                       (ac->protocol == A_NNTP) ? 
+                                       COMPOSE_NEWSGROUPS : COMPOSE_TO);
+       }
+
        /* Set message save folder */
        if (account_get_special_folder(compose->account, F_OUTBOX)) {
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), prefs_common.savemsg);
        /* Set message save folder */
        if (account_get_special_folder(compose->account, F_OUTBOX)) {
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), prefs_common.savemsg);
@@ -10782,7 +10883,7 @@ static void compose_add_field_list( Compose *compose, GList *listAddress ) {
        node = listAddress;
        while( node ) {
                addr = ( gchar * ) node->data;
        node = listAddress;
        while( node ) {
                addr = ( gchar * ) node->data;
-               compose_entry_append( compose, addr, COMPOSE_TO );
+               compose_entry_append( compose, addr, COMPOSE_TO, PREF_NONE );
                node = g_list_next( node );
        }
 }
                node = g_list_next( node );
        }
 }
index 7b1cdc0a07cea5a90a1cca6e64655c64ff6b49cc..0980d6016be3a3acf0bcc4c11bf4caf67966d311 100644 (file)
@@ -77,6 +77,15 @@ typedef enum
        COMPOSE_REEDIT
 } ComposeMode;
 
        COMPOSE_REEDIT
 } ComposeMode;
 
+typedef enum {
+       PREF_ACCOUNT,
+       PREF_FOLDER,
+       PREF_TEMPLATE,
+       PREF_ML,
+       PREF_MAILTO,
+       PREF_NONE
+} ComposePrefType;
+
 typedef struct {
        guint headernum;
        Compose *compose;
 typedef struct {
        guint headernum;
        Compose *compose;
@@ -84,6 +93,7 @@ typedef struct {
        GtkWidget *entry;
        GtkWidget *button;
        GtkWidget *hbox;
        GtkWidget *entry;
        GtkWidget *button;
        GtkWidget *hbox;
+       ComposePrefType type;
 } ComposeHeaderEntry;
 
 struct _Compose
 } ComposeHeaderEntry;
 
 struct _Compose
@@ -285,7 +295,8 @@ GList *compose_get_compose_list             (void);
 
 void compose_entry_append              (Compose          *compose,
                                         const gchar      *address,
 
 void compose_entry_append              (Compose          *compose,
                                         const gchar      *address,
-                                        ComposeEntryType  type);
+                                        ComposeEntryType  type,
+                                        ComposePrefType   pref_type);
 
 
 gint compose_send                      (Compose          *compose);
 
 
 gint compose_send                      (Compose          *compose);
index d0690bb8fe3bd909b873ee01a9783cfa016b9678..ffc7dbf1a58dd6422f7771e1ad4c2b7ee194a673 100644 (file)
@@ -400,7 +400,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                compose_entry_append(compose, action->destination,
                                     compose->account->protocol == A_NNTP
                                            ? COMPOSE_NEWSGROUPS
                compose_entry_append(compose, action->destination,
                                     compose->account->protocol == A_NNTP
                                            ? COMPOSE_NEWSGROUPS
-                                           : COMPOSE_TO);
+                                           : COMPOSE_TO, PREF_NONE);
 
                val = compose_send(compose);
 
 
                val = compose_send(compose);
 
@@ -413,7 +413,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                        break;
                else
                        compose_entry_append(compose, action->destination,
                        break;
                else
                        compose_entry_append(compose, action->destination,
-                                            COMPOSE_TO);
+                                            COMPOSE_TO, PREF_NONE);
 
                val = compose_send(compose);
                
 
                val = compose_send(compose);