2008-12-09 [colin] 3.6.1cvs66
authorColin Leroy <colin@colino.net>
Tue, 9 Dec 2008 16:55:21 +0000 (16:55 +0000)
committerColin Leroy <colin@colino.net>
Tue, 9 Dec 2008 16:55:21 +0000 (16:55 +0000)
* src/compose.c
* src/compose.h
* src/folder_item_prefs.h
* src/prefs_common.c
* src/prefs_common.h
* src/common/defs.h
Fix bug 1792, '"Save Message to" should
retain list of recently selected folders'
Also, make Enchant-related prefs stick
even if the build doesn't enable enchant

ChangeLog
PATCHSETS
configure.ac
src/common/defs.h
src/compose.c
src/compose.h
src/folder_item_prefs.h
src/prefs_common.c
src/prefs_common.h

index 191611b938e190ea0f2c2df9bf0e089d28b30684..0173e9f265500bc4953ab478fc8795bbe5f72d6a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-12-09 [colin]     3.6.1cvs66
+
+       * src/compose.c
+       * src/compose.h
+       * src/folder_item_prefs.h
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/common/defs.h
+               Fix bug 1792, '"Save Message to" should 
+               retain list of recently selected folders'
+               Also, make Enchant-related prefs stick
+               even if the build doesn't enable enchant
+
 2008-12-09 [paul]      3.6.1cvs65
 
        * src/messageview.c
index 58f5c91e98cda4a12a23b505c35b8867626f7fd6..c8220005c5c0be052000aabe86b903a6f7c43342 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.60.2.66 -r 1.60.2.67 src/prefs_actions.c;  cvs diff -u -r 1.5.2.55 -r 1.5.2.56 src/gtk/pluginwindow.c;  ) > 3.6.1cvs63.patchset
 ( cvs diff -u -r 1.59.2.74 -r 1.59.2.75 src/prefs_filtering.c;  ) > 3.6.1cvs64.patchset
 ( cvs diff -u -r 1.94.2.192 -r 1.94.2.193 src/messageview.c;  ) > 3.6.1cvs65.patchset
+( cvs diff -u -r 1.382.2.488 -r 1.382.2.489 src/compose.c;  cvs diff -u -r 1.50.2.51 -r 1.50.2.52 src/compose.h;  cvs diff -u -r 1.2.2.19 -r 1.2.2.20 src/folder_item_prefs.h;  cvs diff -u -r 1.204.2.183 -r 1.204.2.184 src/prefs_common.c;  cvs diff -u -r 1.103.2.119 -r 1.103.2.120 src/prefs_common.h;  cvs diff -u -r 1.9.2.46 -r 1.9.2.47 src/common/defs.h;  ) > 3.6.1cvs66.patchset
index 2d869355a2f4319f41cdb97bb1586a4eabd5dd5e..2cc81981af4b8e88dba88f0f8de0906100b6a6ae 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=6
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=65
+EXTRA_VERSION=66
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index c8f891de86f4099bb3bb6e8adafffe59ca6106b9..05c7a26803ed14fbba183112ad471c4679b7022c 100644 (file)
@@ -72,6 +72,7 @@
 #define SUMMARY_SEARCH_BODY_HISTORY    "summary_searchbody_history"
 #define SUMMARY_SEARCH_ADV_CONDITION_HISTORY   "summarysearch_adv_history"
 #define MESSAGE_SEARCH_HISTORY "messagesearch_history"
+#define COMPOSE_SAVE_TO_HISTORY        "compose_save_to_history"
 #define ADDRESSBOOK_CUSTOM_ATTRIBUTES "attributesrc"
 #define TEMPLATE_DIR           "templates"
 #define TMP_DIR                        "tmp"
index 89a45cfbdd67963d01a8c1c80f7273afcd3475d3..63d6458898d5c35a805a9263aeca4b96b86d0407 100644 (file)
@@ -886,6 +886,41 @@ Compose *compose_new_with_list( PrefsAccount *account, GList *listAddress )
                cmark);                                         \
 }
 
+static void compose_set_save_to(Compose *compose, const gchar *folderidentifier)
+{
+       GtkEditable *entry;
+       if (folderidentifier) {
+               combobox_unset_popdown_strings(GTK_COMBO_BOX(compose->savemsg_combo));
+               prefs_common.compose_save_to_history = add_history(
+                               prefs_common.compose_save_to_history, folderidentifier);
+               combobox_set_popdown_strings(GTK_COMBO_BOX(compose->savemsg_combo),
+                               prefs_common.compose_save_to_history);
+       }
+
+       entry = GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(compose->savemsg_combo)));
+       if (folderidentifier)
+               gtk_entry_set_text(GTK_ENTRY(entry), folderidentifier);
+       else
+               gtk_entry_set_text(GTK_ENTRY(entry), "");
+}
+
+static gchar *compose_get_save_to(Compose *compose)
+{
+       GtkEditable *entry;
+       gchar *result = NULL;
+       entry = GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(compose->savemsg_combo)));
+       result = gtk_editable_get_chars(entry, 0, -1);
+       
+       if (result) {
+               combobox_unset_popdown_strings(GTK_COMBO_BOX(compose->savemsg_combo));
+               prefs_common.compose_save_to_history = add_history(
+                               prefs_common.compose_save_to_history, result);
+               combobox_set_popdown_strings(GTK_COMBO_BOX(compose->savemsg_combo),
+                               prefs_common.compose_save_to_history);
+       }
+       return result;
+}
+
 Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderItem *item,
                             GPtrArray *attach_files, GList *listAddress )
 {
@@ -1102,7 +1137,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
 
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), prefs_common.savemsg);
                folderidentifier = folder_item_get_identifier(item);
-               gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), folderidentifier);
+               compose_set_save_to(compose, folderidentifier);
                g_free(folderidentifier);
        }
        
@@ -1413,7 +1448,7 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
 
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), TRUE);
                folderidentifier = folder_item_get_identifier(msginfo->folder);
-               gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), folderidentifier);
+               compose_set_save_to(compose, folderidentifier);
                g_free(folderidentifier);
        }
 
@@ -1713,7 +1748,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
 
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), TRUE);
                folderidentifier = folder_item_get_identifier(msginfo->folder);
-               gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), folderidentifier);
+               compose_set_save_to(compose, folderidentifier);
                g_free(folderidentifier);
        }
 
@@ -2118,11 +2153,8 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
 
                /* Set message save folder */
                if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf, sizeof(queueheader_buf), "SCF:")) {
-                       gint startpos = 0;
-
                        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), TRUE);
-                       gtk_editable_delete_text(GTK_EDITABLE(compose->savemsg_entry), 0, -1);
-                       gtk_editable_insert_text(GTK_EDITABLE(compose->savemsg_entry), &queueheader_buf[4], strlen(&queueheader_buf[4]), &startpos);
+                       compose_set_save_to(compose, &queueheader_buf[4]);
                }
                if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf, sizeof(queueheader_buf), "RRCPT:")) {
                        gint active = atoi(&queueheader_buf[strlen("RRCPT:")]);
@@ -2248,7 +2280,7 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
 
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), prefs_common.savemsg);
                folderidentifier = folder_item_get_identifier(item);
-               gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), folderidentifier);
+               compose_set_save_to(compose, folderidentifier);
                g_free(folderidentifier);
        }
 
@@ -5558,7 +5590,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn))) {
                gchar *savefolderid;
                
-               savefolderid = gtk_editable_get_chars(GTK_EDITABLE(compose->savemsg_entry), 0, -1);
+               savefolderid = compose_get_save_to(compose);
                err |= (fprintf(fp, "SCF:%s\n", savefolderid) < 0);
                g_free(savefolderid);
        }
@@ -6444,7 +6476,7 @@ static GtkWidget *compose_create_others(Compose *compose)
 {
        GtkWidget *table;
        GtkWidget *savemsg_checkbtn;
-       GtkWidget *savemsg_entry;
+       GtkWidget *savemsg_combo;
        GtkWidget *savemsg_select;
        
        guint rowcount = 0;
@@ -6467,16 +6499,23 @@ static GtkWidget *compose_create_others(Compose *compose)
        g_signal_connect(G_OBJECT(savemsg_checkbtn), "toggled",
                         G_CALLBACK(compose_savemsg_checkbtn_cb), compose);
 
-       savemsg_entry = gtk_entry_new();
-       gtk_widget_show(savemsg_entry);
-       gtk_table_attach_defaults(GTK_TABLE(table), savemsg_entry, 1, 2, rowcount, rowcount + 1);
-       gtk_editable_set_editable(GTK_EDITABLE(savemsg_entry), prefs_common.savemsg);
-       g_signal_connect_after(G_OBJECT(savemsg_entry), "grab_focus",
+       savemsg_combo = gtk_combo_box_entry_new_text();
+       compose->savemsg_checkbtn = savemsg_checkbtn;
+       compose->savemsg_combo = savemsg_combo;
+       gtk_widget_show(savemsg_combo);
+
+       if (prefs_common.compose_save_to_history)
+               combobox_set_popdown_strings(GTK_COMBO_BOX(savemsg_combo),
+                               prefs_common.compose_save_to_history);
+
+       gtk_table_attach(GTK_TABLE(table), savemsg_combo, 1, 2, rowcount, rowcount + 1, GTK_FILL|GTK_EXPAND, GTK_SHRINK, 0, 0);
+       gtk_widget_set_sensitive(GTK_WIDGET(savemsg_combo), prefs_common.savemsg);
+       g_signal_connect_after(G_OBJECT(savemsg_combo), "grab_focus",
                         G_CALLBACK(compose_grab_focus_cb), compose);
        if (account_get_special_folder(compose->account, F_OUTBOX)) {
                folderidentifier = folder_item_get_identifier(account_get_special_folder
                                  (compose->account, F_OUTBOX));
-               gtk_entry_set_text(GTK_ENTRY(savemsg_entry), folderidentifier);
+               compose_set_save_to(compose, folderidentifier);
                g_free(folderidentifier);
        }
 
@@ -6489,15 +6528,12 @@ static GtkWidget *compose_create_others(Compose *compose)
 
        rowcount++;
 
-       compose->savemsg_checkbtn = savemsg_checkbtn;
-       compose->savemsg_entry = savemsg_entry;
-
        return table;   
 }
 
 static void compose_savemsg_checkbtn_cb(GtkWidget *widget, Compose *compose) 
 {
-       gtk_editable_set_editable(GTK_EDITABLE(compose->savemsg_entry),
+       gtk_widget_set_sensitive(GTK_WIDGET(compose->savemsg_combo),
                gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn)));
 }
 
@@ -6511,7 +6547,7 @@ static void compose_savemsg_select_cb(GtkWidget *widget, Compose *compose)
 
        path = folder_item_get_identifier(dest);
 
-       gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), path);
+       compose_set_save_to(compose, path);
        g_free(path);
 }
 
@@ -8732,11 +8768,11 @@ static void account_activated(GtkComboBox *optmenu, gpointer data)
        g_signal_connect(G_OBJECT(compose->savemsg_checkbtn), "toggled",
                         G_CALLBACK(compose_savemsg_checkbtn_cb), compose);
                           
-       gtk_editable_delete_text(GTK_EDITABLE(compose->savemsg_entry), 0, -1);
+       compose_set_save_to(compose, NULL);
        if (account_get_special_folder(compose->account, F_OUTBOX)) {
                folderidentifier = folder_item_get_identifier(account_get_special_folder
                                  (compose->account, F_OUTBOX));
-               gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), folderidentifier);
+               compose_set_save_to(compose, folderidentifier);
                g_free(folderidentifier);
        }
 }
@@ -8925,7 +8961,7 @@ gboolean compose_draft (gpointer data, guint action)
        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn))) {
                gchar *savefolderid;
 
-               savefolderid = gtk_editable_get_chars(GTK_EDITABLE(compose->savemsg_entry), 0, -1);
+               savefolderid = compose_get_save_to(compose);
                err |= (fprintf(fp, "SCF:%s\n", savefolderid) < 0);
                g_free(savefolderid);
        }
index 9a51ad6c8f556ca0ef71286b4361e5a3259a3b0a..9773b3a89336d53c551491ca92f0df1349cfc0d1 100644 (file)
@@ -110,7 +110,7 @@ struct _Compose
 
        /* Others */
        GtkWidget *savemsg_checkbtn;
-       GtkWidget *savemsg_entry;
+       GtkWidget *savemsg_combo;
 
        /* Headers notebook */
        GtkWidget *notebook;
@@ -200,12 +200,6 @@ struct _Compose
        GIOChannel *exteditor_ch;
        gint        exteditor_tag;
 
-#if USE_ENCHANT
-        /* GNU/aspell spell checker */
-        GtkAspell *gtkaspell;
-       GtkWidget *aspell_options_menu;
-#endif
-
        /* Priority */
        gint priority;
 
@@ -235,6 +229,11 @@ struct _Compose
        GtkWidget *first_entry;
        
        GtkUIManager *ui_manager;
+#if USE_ENCHANT
+        /* GNU/aspell spell checker */
+        GtkAspell *gtkaspell;
+       GtkWidget *aspell_options_menu;
+#endif
 };
 
 struct _AttachInfo
index 629c7ab7511c56ad7dd9b5918e938ecef91ca5f8..0a31259c6f5f9d8eb48914b8627ff222f020cb4e 100644 (file)
@@ -52,12 +52,12 @@ struct _FolderItemPrefs {
        gint folder_chmod;
        gboolean enable_default_account;
        gint default_account;
-#if USE_ENCHANT
+
        gboolean enable_default_dictionary;
        gchar *default_dictionary;
        gboolean enable_default_alt_dictionary;
        gchar *default_alt_dictionary;
-#endif
+
        gboolean save_copy_to_folder;
        guint color;
 
index 9eb5ae6054016ec91e2c7272c5cb00bbb39e5167..6f4fab10cca05f39bd66d67796706e3be08e1874 100644 (file)
@@ -243,7 +243,7 @@ static PrefParam param[] = {
         P_BOOL, NULL, NULL, NULL},
         {"autosave_length", "50", &prefs_common.autosave_length, P_INT,
         NULL, NULL, NULL},
-#if USE_ENCHANT
+
        {"enable_aspell", "TRUE", &prefs_common.enable_aspell, P_BOOL,
         NULL, NULL, NULL},
        {"dictionary",  "", &prefs_common.dictionary, P_STRING,
@@ -260,7 +260,7 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"use_both_dicts", "FALSE", &prefs_common.use_both_dicts, P_BOOL,
         NULL, NULL, NULL},
-#endif
+
        {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL,
         NULL, NULL, NULL},
        {"compose_dnd_insert_or_attach", "0", &prefs_common.compose_dnd_mode, P_ENUM,
@@ -1212,6 +1212,8 @@ void prefs_common_read_config(void)
                prefs_common_read_history(SUMMARY_SEARCH_ADV_CONDITION_HISTORY);
        prefs_common.message_search_history =
                prefs_common_read_history(MESSAGE_SEARCH_HISTORY);
+       prefs_common.compose_save_to_history =
+               prefs_common_read_history(COMPOSE_SAVE_TO_HISTORY);
 
        prefs_common.addressbook_custom_attributes = addressbook_update_custom_attr_from_prefs();
 
@@ -1308,6 +1310,8 @@ void prefs_common_write_config(void)
                prefs_common.summary_search_adv_condition_history);
        prefs_common_save_history(MESSAGE_SEARCH_HISTORY, 
                prefs_common.message_search_history);
+       prefs_common_save_history(COMPOSE_SAVE_TO_HISTORY, 
+               prefs_common.compose_save_to_history);
 
        prefs_common_save_history_to_dir(ADDRBOOK_DIR,
                ADDRESSBOOK_CUSTOM_ATTRIBUTES, 
index ede5904af15fc62056ff61979059e53f3f8009cc..e64464e82604c229c3aed21782a3f32805c5ab67 100644 (file)
@@ -167,7 +167,6 @@ struct _PrefsCommon
        gboolean block_cursor;
        gchar *quote_chars;
        
-#if USE_ENCHANT
        gboolean enable_aspell;
        gchar *dictionary;
        gchar *alt_dictionary;
@@ -176,7 +175,6 @@ struct _PrefsCommon
        gboolean recheck_when_changing_dict;
        gboolean use_alternate;
        gboolean use_both_dicts;
-#endif
         
        /* Display */
        /* obsolete fonts */
@@ -426,6 +424,7 @@ struct _PrefsCommon
        GList *summary_search_body_history;
        GList *summary_search_adv_condition_history;
        GList *message_search_history;
+       GList *compose_save_to_history;
 
        gint filteringwin_width;
        gint filteringwin_height;