fix bug 4239, 'Preferences: Text Options Header Display modal is not modal' (sic)
[claws.git] / src / prefs_other.c
index aee7ef280171f4c5864427eb0b809a56300a5497..30c18b9ee3fe3ac0f438e1b647892ff22862ec17 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2005-2011 Colin Leroy <colin@colino.net> & The Claws Mail Team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2005-2019 Colin Leroy and The Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 #ifdef HAVE_CONFIG_H
-#  include "config.h"
+#include "config.h"
+#include "claws-features.h"
 #endif
 
 #include "defs.h"
 #include "gtk/gtkutils.h"
 #include "gtk/prefswindow.h"
 #include "combobox.h"
+#ifndef PASSWORD_CRYPTO_OLD
+#include "password.h"
+#include "password_gtk.h"
+#endif
 
 #include "manage_window.h"
 #ifdef HAVE_LIBETPAN
@@ -55,12 +59,17 @@ typedef struct _OtherPage
        GtkWidget *checkbtn_askonclean;
        GtkWidget *checkbtn_warnqueued;
        GtkWidget *spinbtn_iotimeout;
+       GtkWidget *checkbtn_gtk_enable_accels;
        GtkWidget *checkbtn_gtk_can_change_accels;
        GtkWidget *checkbtn_askonfilter;
        GtkWidget *checkbtn_use_shred;
        GtkWidget *checkbtn_real_time_sync;
        GtkWidget *flush_metadata_faster_radiobtn;
        GtkWidget *flush_metadata_safer_radiobtn;
+       GtkWidget *checkbtn_transhdr;
+#ifndef PASSWORD_CRYPTO_OLD
+       GtkWidget *checkbtn_use_passphrase;
+#endif
 } OtherPage;
 
 static struct KeybindDialog {
@@ -77,6 +86,10 @@ static gboolean prefs_keybind_key_pressed    (GtkWidget      *widget,
                                                 gpointer        data);
 static void prefs_keybind_cancel               (void);
 static void prefs_keybind_apply_clicked                (GtkWidget      *widget);
+#ifndef PASSWORD_CRYPTO_OLD
+static void prefs_change_master_passphrase(GtkButton *button, gpointer data);
+static void prefs_use_passphrase_toggled(GtkToggleButton *button, gpointer data);
+#endif
 
 
 static void prefs_keybind_select(void)
@@ -97,6 +110,7 @@ static void prefs_keybind_select(void)
        gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
        gtk_window_set_modal (GTK_WINDOW (window), TRUE);
        gtk_window_set_resizable(GTK_WINDOW (window), FALSE);
+       gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
        manage_window_set_transient (GTK_WINDOW (window));
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
@@ -159,7 +173,7 @@ static void prefs_keybind_select(void)
 static gboolean prefs_keybind_key_pressed(GtkWidget *widget, GdkEventKey *event,
                                          gpointer data)
 {
-       if (event && event->keyval == GDK_Escape)
+       if (event && event->keyval == GDK_KEY_Escape)
                prefs_keybind_cancel();
        return FALSE;
 }
@@ -193,6 +207,10 @@ static void prefs_keybind_apply(struct KeyBind keybind[], gint num)
                const gchar *accel_key
                        = keybind[i].accel_key ? keybind[i].accel_key : "";
                gtk_accelerator_parse(accel_key, &key, &mods);
+               if (key == 0 && mods == 0) {
+                       g_message("Failed parsing accelerator '%s' for path '%s'\n",
+                                 accel_key, keybind[i].accel_path);
+               }
                gtk_accel_map_change_entry(keybind[i].accel_path,
                                           key, mods, TRUE);
        }
@@ -221,11 +239,11 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 
                {"<Actions>/Menu/View/ShowHide/MessageView",            "V"},
                {"<Actions>/Menu/View/ThreadView",                      "<control>T"},
-               {"<Actions>/Menu/View/GoTo/Prev",                       "P"},
-               {"<Actions>/Menu/View/GoTo/Next",                       "N"},
-               {"<Actions>/Menu/View/GoTo/PrevUnread",                 "<shift>P"},
-               {"<Actions>/Menu/View/GoTo/NextUnread",                 "<shift>N"},
-               {"<Actions>/Menu/View/GoTo/OtherFolder",                "G"},
+               {"<Actions>/Menu/View/Goto/Prev",                       "P"},
+               {"<Actions>/Menu/View/Goto/Next",                       "N"},
+               {"<Actions>/Menu/View/Goto/PrevUnread",                 "<shift>P"},
+               {"<Actions>/Menu/View/Goto/NextUnread",                 "<shift>N"},
+               {"<Actions>/Menu/View/Goto/Folder",                     "G"},
                {"<Actions>/Menu/View/OpenNewWindow",                   "<control><alt>N"},
                {"<Actions>/Menu/View/MessageSource",                   "<control>U"},
                {"<Actions>/Menu/View/AllHeaders",                      "<control>H"},
@@ -301,11 +319,11 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 
                {"<Actions>/Menu/View/ShowHide/MessageView",            ""},
                {"<Actions>/Menu/View/ThreadView",                      "<shift>T"},
-               {"<Actions>/Menu/View/GoTo/Prev",                       "P"},
-               {"<Actions>/Menu/View/GoTo/Next",                       "N"},
-               {"<Actions>/Menu/View/GoTo/PrevUnread",                 "<shift>P"},
-               {"<Actions>/Menu/View/GoTo/NextUnread",                 "<shift>N"},
-               {"<Actions>/Menu/View/GoTo/OtherFolder",                "G"},
+               {"<Actions>/Menu/View/Goto/Prev",                       "P"},
+               {"<Actions>/Menu/View/Goto/Next",                       "N"},
+               {"<Actions>/Menu/View/Goto/PrevUnread",                 "<shift>P"},
+               {"<Actions>/Menu/View/Goto/NextUnread",                 "<shift>N"},
+               {"<Actions>/Menu/View/Goto/Folder",                     "G"},
                {"<Actions>/Menu/View/OpenNewWindow",                   "<control><alt>N"},
                {"<Actions>/Menu/View/MessageSource",                   "<control>U"},
                {"<Actions>/Menu/View/AllHeaders",                      "<shift>H"},
@@ -345,59 +363,56 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 
        static struct KeyBind mutt_menurc[] = {
                /* main */
-               {"<Actions>/Menu/File/EmptyTrashes",                    ""},
-               {"<Actions>/Menu/File/SaveAs",                          "S"},
-               {"<Actions>/Menu/File/Print",                           "P"},
-               {"<Actions>/Menu/File/Exit",                            "Q"},
-
-               {"<Actions>/Menu/Edit/Copy",                            "<control>C"},
-               {"<Actions>/Menu/Edit/SelectAll",                       "<control>A"},
-               {"<Actions>/Menu/Edit/Find",                            "<control>F"},
-               {"<Actions>/Menu/Edit/SearchFolder",                    "/"},
-
-               {"<Actions>/Menu/View/ShowHide/MessageView",            "V"},
-               {"<Actions>/Menu/View/ThreadView",                      "<control>T"},
-               {"<Actions>/Menu/View/GoTo/Prev",                       ""},
-               {"<Actions>/Menu/View/GoTo/Next",                       ""},
-               {"<Actions>/Menu/View/GoTo/PrevUnread",                 ""},
-               {"<Actions>/Menu/View/GoTo/NextUnread",                 ""},
-               {"<Actions>/Menu/View/GoTo/OtherFolder",                "C"},
-               {"<Actions>/Menu/View/OpenNewWindow",                   "<control><alt>N"},
-               {"<Actions>/Menu/View/MessageSource",                   "<control>U"},
-               {"<Actions>/Menu/View/AllHeaders",                      "<control>H"},
-               {"<Actions>/Menu/View/UpdateSummary",                   "<control><alt>U"},
-
-               {"<Actions>/Menu/Message/Receive/CurrentAccount",
-                                                                       "<control>I"},
-               {"<Actions>/Menu/Message/Receive/AllAccounts",          "<shift><control>I"},
-               {"<Actions>/Menu/Message/ComposeEmail",                 "M"},
-               {"<Actions>/Menu/Message/Reply",                        "R"},
-               {"<Actions>/Menu/Message/ReplyTo/All",                  "G"},
-               {"<Actions>/Menu/Message/ReplyTo/Sender",               ""},
-               {"<Actions>/Menu/Message/ReplyTo/List",                 "<control>L"},
-               {"<Actions>/Menu/Message/Forward",                      "F"},
-               {"<Actions>/Menu/Message/Move",                         "<control>O"},
-               {"<Actions>/Menu/Message/Copy",                         "<shift>C"},
-               {"<Actions>/Menu/Message/Trash",                        "D"},
-               {"<Actions>/Menu/Message/Mark/Mark",                    "<shift>F"},
-               {"<Actions>/Menu/Message/Mark/Unmark",                  "U"},
-               {"<Actions>/Menu/Message/Mark/MarkUnread",              "<shift>N"},
-               {"<Actions>/Menu/Message/Mark/MarkRead",                ""},
-
-               {"<Actions>/Menu/Tools/AddressBook",                    "<shift><control>A"},
-               {"<Actions>/Menu/Tools/Execute",                        "X"},
-               {"<Actions>/Menu/Tools/NetworkLog",                     "<shift><control>L"},
+               {"<Actions>/Menu/File/SaveAs",                          "S"}, /* save-message */
+               {"<Actions>/Menu/File/Print",                           "P"}, /* print-message */
+               {"<Actions>/Menu/File/Exit",                            "Q"}, /* quit */
+
+               {"<Actions>/Menu/Edit/Copy",                            "<control>C"}, /* - */
+               {"<Actions>/Menu/Edit/SelectAll",                       "<control>A"}, /* - */
+               {"<Actions>/Menu/Edit/Find",                            "<alt>B"}, /* <esc>B: search in message bodies */
+               {"<Actions>/Menu/Edit/SearchFolder",                    "slash"}, /* search */
+               {"<Actions>/Menu/Edit/QuickSearch",                     "L"}, /* limit */
+
+               {"<Actions>/Menu/View/ShowHide/MessageView",            "V"}, /* - */
+               {"<Actions>/Menu/View/ThreadView",                      "<control>T"}, /* - */
+               {"<Actions>/Menu/View/Goto/Prev",                       "K"}, /* previous-entry */
+               {"<Actions>/Menu/View/Goto/Next",                       "J"}, /* next-entry */
+               {"<Actions>/Menu/View/Goto/PrevUnread",                 "<alt>U"}, /* <esc>Tab: previous-new-then-unread */
+               {"<Actions>/Menu/View/Goto/NextUnread",                 "U"}, /* Tab: next-new-then-unread */
+               {"<Actions>/Menu/View/Goto/Folder",                     "C"}, /* change-folder */
+               {"<Actions>/Menu/View/OpenNewWindow",                   "<control><alt>N"}, /* - */
+               {"<Actions>/Menu/View/MessageSource",                   "E"}, /* edit the raw message */
+               {"<Actions>/Menu/View/AllHeaders",                      "H"}, /* display-toggle-weed */
+               {"<Actions>/Menu/View/UpdateSummary",                   "<control><alt>U"}, /* - */
+
+               {"<Actions>/Menu/Message/Receive/CurrentAccount",       "<control>I"}, /* - */
+               {"<Actions>/Menu/Message/Receive/AllAccounts",          "<shift>G"}, /* fetch-mail */
+               {"<Actions>/Menu/Message/ComposeEmail",                 "M"}, /* mail */
+               {"<Actions>/Menu/Message/Reply",                        "R"}, /* reply */
+               {"<Actions>/Menu/Message/ReplyTo/All",                  "G"}, /* group-reply */
+               {"<Actions>/Menu/Message/ReplyTo/List",                 "<shift>L"}, /* list-reply */
+               {"<Actions>/Menu/Message/Forward",                      "F"}, /* forward-message */
+               {"<Actions>/Menu/Message/Move",                         "<control>O"}, /* - */
+               {"<Actions>/Menu/Message/Copy",                         "<shift>C"}, /* copy-message */
+               {"<Actions>/Menu/Message/Trash",                        "D"}, /* delete-message */
+               {"<Actions>/Menu/Message/Mark/Mark",                    "<shift>F"}, /* flag-message */
+               {"<Actions>/Menu/Message/Mark/Unmark",                  "<control><shift>F"}, /* - */
+               {"<Actions>/Menu/Message/Mark/MarkUnread",              "<shift>N"}, /* toggle-new */
+               {"<Actions>/Menu/Message/Mark/MarkRead",                "<control>R"}, /* read-thread */
+
+               {"<Actions>/Menu/Tools/AddressBook",                    "<shift><control>A"}, /* - */
+               {"<Actions>/Menu/Tools/Execute",                        "dollar"}, /* sync-mailbox */
+               {"<Actions>/Menu/Tools/NetworkLog",                     "<shift><control>L"}, /* - */
                /* compose */
-               {"<Actions>/Menu/Message/Close",                        "<alt>W"},
-               {"<Actions>/Menu/Edit/SelectAll",                       ""},
-               {"<Actions>/Menu/Edit/Advanced/BackWord",               "<alt>B"},
-               {"<Actions>/Menu/Edit/Advanced/ForwWord",               "<alt>F"},
-               {"<Actions>/Menu/Edit/Advanced/BegLine",                "<control>A"},
-               {"<Actions>/Menu/Edit/Advanced/DelBackWord",            "<control>W"},
-               {"<Actions>/Menu/Edit/Advanced/DelForwWord",            "<alt>D"},
+               {"<Actions>/Menu/Message/Close",                        "<alt>W"}, /* - */
+               {"<Actions>/Menu/Edit/Advanced/BackWord",               "<alt>B"}, /* - */
+               {"<Actions>/Menu/Edit/Advanced/ForwWord",               "<alt>F"}, /* - */
+               {"<Actions>/Menu/Edit/Advanced/BegLine",                "<control>A"}, /* - */
+               {"<Actions>/Menu/Edit/Advanced/DelBackWord",            "<control>W"}, /* - */
+               {"<Actions>/Menu/Edit/Advanced/DelForwWord",            "<alt>D"}, /* - */
        };
 
-       text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(keybind.combo));
+       text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(keybind.combo));
 
        if (!strcmp(text, _("Default"))) {
                menurc = default_menurc;
@@ -441,14 +456,16 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 
        GtkWidget *frame_keys;
        GtkWidget *vbox_keys;
+       GtkWidget *checkbtn_gtk_enable_accels;
        GtkWidget *checkbtn_gtk_can_change_accels;
        GtkWidget *button_keybind;
 
        GtkWidget *label_iotimeout;
        GtkWidget *spinbtn_iotimeout;
-       GtkObject *spinbtn_iotimeout_adj;
+       GtkAdjustment *spinbtn_iotimeout_adj;
 
        GtkWidget *vbox2;
+       GtkWidget *checkbtn_transhdr;
        GtkWidget *checkbtn_askonclean;
        GtkWidget *checkbtn_askonfilter;
        GtkWidget *checkbtn_use_shred;
@@ -460,8 +477,14 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        GtkWidget *flush_metadata_faster_radiobtn;
        GtkWidget *flush_metadata_safer_radiobtn;
 
+#ifndef PASSWORD_CRYPTO_OLD
+       GtkWidget *vbox_passphrase;
+       GtkWidget *frame_passphrase;
+       GtkWidget *checkbtn_use_passphrase;
+       GtkWidget *button_change_passphrase;
+#endif
+
        gchar *shred_binary = NULL;
-       CLAWS_TIP_DECL();
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -491,6 +514,9 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 
        vbox_keys = gtkut_get_options_frame(vbox1, &frame_keys, _("Keyboard shortcuts"));
 
+       PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_enable_accels,
+                       _("Enable keyboard shortcuts"));
+
        PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_can_change_accels,
                        _("Enable customisable keyboard shortcuts"));
 
@@ -541,13 +567,12 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        gtk_widget_show (label_iotimeout);
        gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
 
-       spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 0);
+       spinbtn_iotimeout_adj = GTK_ADJUSTMENT(gtk_adjustment_new (60, 0, 1000, 1, 10, 0));
        spinbtn_iotimeout = gtk_spin_button_new
                (GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0);
        gtk_widget_show (spinbtn_iotimeout);
        gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout,
                            FALSE, FALSE, 0);
-       gtk_widget_set_size_request (spinbtn_iotimeout, 64, -1);
        gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE);
 
        label_iotimeout = gtk_label_new (_("seconds"));
@@ -558,6 +583,11 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        gtk_widget_show (vbox2);
        gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
 
+       PACK_CHECK_BUTTON(vbox2, checkbtn_transhdr,
+                          _("Translate header names"));
+       CLAWS_SET_TIP(checkbtn_transhdr,
+                            _("The display of standard headers (such as 'From:', 'Subject:') "
+                            "will be translated into your language."));
        PACK_CHECK_BUTTON (vbox2, checkbtn_askonclean, 
                           _("Ask before emptying trash"));
        PACK_CHECK_BUTTON (vbox2, checkbtn_askonfilter,
@@ -581,6 +611,33 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        PACK_CHECK_BUTTON (vbox2, checkbtn_real_time_sync,
                           _("Synchronise offline folders as soon as possible"));
 
+#ifndef PASSWORD_CRYPTO_OLD
+       vbox_passphrase = gtkut_get_options_frame(vbox1, &frame_passphrase, _("Master passphrase"));
+
+       PACK_CHECK_BUTTON(vbox_passphrase, checkbtn_use_passphrase,
+                       _("Use a master passphrase"));
+
+       CLAWS_SET_TIP(checkbtn_use_passphrase,
+                       _("If checked, your saved account passwords will be protected "
+                               "by a master passphrase. If no master passphrase is set, "
+                               "you will be prompted to set one."));
+
+       button_change_passphrase = gtk_button_new_with_label(
+                       _("Change master passphrase"));
+       gtk_widget_show (button_change_passphrase);
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox_passphrase), hbox1, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (hbox1), button_change_passphrase,
+                       FALSE, FALSE, 0);
+       g_signal_connect (G_OBJECT (checkbtn_use_passphrase), "toggled",
+                               G_CALLBACK (prefs_use_passphrase_toggled), button_change_passphrase);
+       g_signal_connect (G_OBJECT (button_change_passphrase), "clicked",
+                         G_CALLBACK (prefs_change_master_passphrase), NULL);
+#endif
+       SET_TOGGLE_SENSITIVITY(checkbtn_gtk_enable_accels, checkbtn_gtk_can_change_accels);
+       SET_TOGGLE_SENSITIVITY(checkbtn_gtk_enable_accels, button_keybind);
+
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_addaddrbyclick), 
                prefs_common.add_address_by_click);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_confonexit), 
@@ -591,12 +648,16 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
                prefs_common.ask_on_clean);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_warnqueued), 
                prefs_common.warn_queued_on_exit);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_enable_accels),
+               prefs_common.gtk_enable_accels);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_can_change_accels),
                prefs_common.gtk_can_change_accels);
 
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_iotimeout),
                prefs_common.io_timeout_secs);
 
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_transhdr),
+               prefs_common.trans_hdr);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonfilter), 
                prefs_common.ask_apply_per_account_filtering_rules);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_shred), 
@@ -604,24 +665,37 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync), 
                prefs_common.real_time_sync);
 
+#ifndef PASSWORD_CRYPTO_OLD
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_passphrase),
+               prefs_common.use_master_passphrase);
+       gtk_widget_set_sensitive(button_change_passphrase,
+                       prefs_common.use_master_passphrase);
+#endif
+
        prefs_other->checkbtn_addaddrbyclick = checkbtn_addaddrbyclick;
        prefs_other->checkbtn_confonexit = checkbtn_confonexit;
        prefs_other->checkbtn_cleanonexit = checkbtn_cleanonexit;
        prefs_other->checkbtn_askonclean = checkbtn_askonclean;
        prefs_other->checkbtn_warnqueued = checkbtn_warnqueued;
        prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
+       prefs_other->checkbtn_transhdr = checkbtn_transhdr;
+       prefs_other->checkbtn_gtk_enable_accels = checkbtn_gtk_enable_accels;
        prefs_other->checkbtn_gtk_can_change_accels = checkbtn_gtk_can_change_accels;
        prefs_other->checkbtn_askonfilter = checkbtn_askonfilter;
        prefs_other->checkbtn_use_shred = checkbtn_use_shred;
        prefs_other->checkbtn_real_time_sync = checkbtn_real_time_sync;
        prefs_other->flush_metadata_safer_radiobtn = flush_metadata_safer_radiobtn;
        prefs_other->flush_metadata_faster_radiobtn = flush_metadata_faster_radiobtn;
+#ifndef PASSWORD_CRYPTO_OLD
+       prefs_other->checkbtn_use_passphrase = checkbtn_use_passphrase;
+#endif
        prefs_other->page.widget = vbox1;
 }
 
 static void prefs_other_save(PrefsPage *_page)
 {
        OtherPage *page = (OtherPage *) _page;
+       gboolean gtk_enable_accels;
        gboolean gtk_can_change_accels;
 
        prefs_common.add_address_by_click = gtk_toggle_button_get_active(
@@ -642,6 +716,8 @@ static void prefs_other_save(PrefsPage *_page)
 #ifdef HAVE_LIBETPAN
        imap_main_set_timeout(prefs_common.io_timeout_secs);
 #endif
+       prefs_common.trans_hdr = gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON(page->checkbtn_transhdr));
        prefs_common.ask_apply_per_account_filtering_rules = 
                gtk_toggle_button_get_active(
                        GTK_TOGGLE_BUTTON(page->checkbtn_askonfilter)); 
@@ -650,7 +726,43 @@ static void prefs_other_save(PrefsPage *_page)
                        GTK_TOGGLE_BUTTON(page->checkbtn_use_shred)); 
        prefs_common.real_time_sync = 
                gtk_toggle_button_get_active(
-                       GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync)); 
+                       GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync));
+
+#ifndef PASSWORD_CRYPTO_OLD
+       /* If we're disabling use of master passphrase, we need to reencrypt
+        * all account passwords with hardcoded key. */
+       if (!gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase))
+                       && master_passphrase_is_set()) {
+               master_passphrase_change(NULL, NULL);
+
+               /* In case user did not finish the passphrase change process
+                * (e.g. did not enter a correct current master passphrase),
+                * we need to enable the "use master passphrase" checkbox again,
+                * since the old master passphrase is still valid. */
+               if (master_passphrase_is_set()) {
+                       gtk_toggle_button_set_active(
+                               GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase), TRUE);
+               }
+       }
+
+       if (gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase))
+                       && !master_passphrase_is_set()) {
+               master_passphrase_change_dialog();
+
+               /* In case user cancelled the passphrase change dialog, we need
+                * to disable the "use master passphrase" checkbox. */
+               if (!master_passphrase_is_set()) {
+                       gtk_toggle_button_set_active(
+                               GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase), FALSE);
+               }
+       }
+
+       prefs_common.use_master_passphrase =
+               gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase));
+#endif
 
        gtk_can_change_accels = gtk_toggle_button_get_active(
                GTK_TOGGLE_BUTTON(page->checkbtn_gtk_can_change_accels));
@@ -663,7 +775,26 @@ static void prefs_other_save(PrefsPage *_page)
                                "gtk-can-change-accels",
                                (glong)prefs_common.gtk_can_change_accels,
                                "XProperty");
+       }
+       gtk_enable_accels = gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON(page->checkbtn_gtk_enable_accels));
+
+       if (prefs_common.gtk_enable_accels != gtk_enable_accels) {
+               prefs_common.gtk_enable_accels = gtk_enable_accels;
 
+               gtk_settings_set_long_property(gtk_settings_get_default(),
+                               "gtk-enable-accels",
+                               (glong)prefs_common.gtk_enable_accels,
+                               "XProperty");
+               
+               gtk_settings_set_long_property(gtk_settings_get_default(),
+                               "gtk-enable-mnemonics",
+                               (glong)prefs_common.gtk_enable_accels,
+                               "XProperty");
+       }
+       
+       if (prefs_common.gtk_enable_accels != gtk_enable_accels ||
+           prefs_common.gtk_can_change_accels != gtk_can_change_accels) {              
                /* gtk_can_change_accels value changed : we have (only if changed)
                 * to apply the gtk property to all widgets : */
                gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE);
@@ -698,6 +829,14 @@ void prefs_other_init(void)
                        "gtk-can-change-accels",
                        (glong)prefs_common.gtk_can_change_accels,
                        "XProperty");
+       gtk_settings_set_long_property(gtk_settings_get_default(),
+                       "gtk-enable-accels",
+                       (glong)prefs_common.gtk_enable_accels,
+                       "XProperty");
+       gtk_settings_set_long_property(gtk_settings_get_default(),
+                       "gtk-enable-mnemonics",
+                       (glong)prefs_common.gtk_enable_accels,
+                       "XProperty");
 }
 
 void prefs_other_done(void)
@@ -705,3 +844,20 @@ void prefs_other_done(void)
        prefs_gtk_unregister_page((PrefsPage *) prefs_other);
        g_free(prefs_other);
 }
+
+#ifndef PASSWORD_CRYPTO_OLD
+void prefs_change_master_passphrase(GtkButton *button, gpointer data)
+{
+       /* Call the passphrase change dialog */
+       master_passphrase_change_dialog();
+}
+
+void prefs_use_passphrase_toggled(GtkToggleButton *chkbtn, gpointer data)
+{
+       GtkWidget *button = GTK_WIDGET(data);
+       gboolean active = gtk_toggle_button_get_active(chkbtn);
+
+       if (!active)
+               gtk_widget_set_sensitive(button, active);
+}
+#endif