2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 2005-2024 the Claws Mail team and Colin Leroy
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "claws-features.h"
30 #include <glib/gi18n.h>
32 #include <gdk/gdkkeysyms.h>
34 #include "prefs_common.h"
35 #include "prefs_gtk.h"
37 #include "gtk/gtkutils.h"
38 #include "gtk/prefswindow.h"
40 #ifndef PASSWORD_CRYPTO_OLD
42 #include "password_gtk.h"
45 #include "manage_window.h"
47 #include "imap-thread.h"
50 typedef struct _OtherPage
56 GtkWidget
*keys_preset_combo
;
57 GtkWidget
*keys_preset_hbox
;
58 GtkWidget
*checkbtn_addaddrbyclick
;
59 GtkWidget
*checkbtn_confonexit
;
60 GtkWidget
*checkbtn_cleanonexit
;
61 GtkWidget
*checkbtn_askonclean
;
62 GtkWidget
*checkbtn_warnqueued
;
63 GtkWidget
*spinbtn_iotimeout
;
64 GtkWidget
*checkbtn_gtk_enable_accels
;
65 GtkWidget
*checkbtn_askonfilter
;
66 GtkWidget
*checkbtn_use_shred
;
67 GtkWidget
*checkbtn_real_time_sync
;
68 GtkWidget
*flush_metadata_faster_radiobtn
;
69 GtkWidget
*flush_metadata_safer_radiobtn
;
70 GtkWidget
*checkbtn_transhdr
;
71 #ifndef PASSWORD_CRYPTO_OLD
72 GtkWidget
*checkbtn_use_passphrase
;
76 #ifndef PASSWORD_CRYPTO_OLD
77 static void prefs_change_primary_passphrase(GtkButton
*button
, gpointer data
);
81 const gchar
*accel_path
;
82 const gchar
*accel_key
;
85 static void prefs_keybind_apply(struct KeyBind keybind
[], gint num
)
91 for (i
= 0; i
< num
; i
++) {
92 const gchar
*accel_key
93 = keybind
[i
].accel_key
? keybind
[i
].accel_key
: "";
94 gtk_accelerator_parse(accel_key
, &key
, &mods
);
95 if (key
== 0 && mods
== 0) {
96 g_message("Failed parsing accelerator '%s' for path '%s'\n",
97 accel_key
, keybind
[i
].accel_path
);
99 gtk_accel_map_change_entry(keybind
[i
].accel_path
,
104 static void prefs_keybind_preset_changed(GtkComboBox
*widget
)
107 struct KeyBind
*menurc
;
110 /* make sure to keep the table below in sync with the ones in mainwindow.c, messageview.c */
111 static struct KeyBind default_menurc
[] = {
113 {"<Actions>/Menu/File/EmptyTrashes", "<shift>D"},
114 {"<Actions>/Menu/File/SaveAs", "<control>S"},
115 {"<Actions>/Menu/File/SavePartAs", "Y"},
116 {"<Actions>/Menu/File/Print", "<control>P"},
117 {"<Actions>/Menu/File/SynchroniseFolders", "<shift><control>S"},
118 {"<Actions>/Menu/File/Exit", "<control>Q"},
119 {"<Actions>/Menu/File/OfflineMode", "<control>W"},
121 {"<Actions>/Menu/Edit/Copy", "<control>C"},
122 {"<Actions>/Menu/Edit/SelectAll", "<control>A"},
123 {"<Actions>/Menu/Edit/Find", "<control>F"},
124 {"<Actions>/Menu/Edit/SearchFolder", "<shift><control>F"},
125 {"<Actions>/Menu/Edit/QuickSearch", "slash"},
127 {"<Actions>/Menu/View/ShowHide/MenuBar", "<control>F12"},
128 {"<Actions>/Menu/View/ShowHide/MessageView", "V"},
129 {"<Actions>/Menu/View/ThreadView", "<control>T"},
130 {"<Actions>/Menu/View/FullScreen", "F11"},
131 {"<Actions>/Menu/View/AllHeaders", "<control>H"},
132 {"<Actions>/Menu/View/Quotes/CollapseAll", "<shift><control>Q"},
134 {"<Actions>/Menu/View/Goto/Prev", "P"},
135 {"<Actions>/Menu/View/Goto/Next", "N"},
136 {"<Actions>/Menu/View/Goto/PrevUnread", "<shift>P"},
137 {"<Actions>/Menu/View/Goto/NextUnread", "<shift>N"},
138 {"<Actions>/Menu/View/Goto/PrevHistory", "<alt>Left"},
139 {"<Actions>/Menu/View/Goto/NextHistory", "<alt>Right"},
140 {"<Actions>/Menu/View/Goto/ParentMessage", "<control>Up"},
141 {"<Actions>/Menu/View/Goto/NextUnreadFolder", "<shift>G"},
142 {"<Actions>/Menu/View/Goto/Folder", "G"},
143 {"<Actions>/Menu/View/Goto/NextPart", "A"},
144 {"<Actions>/Menu/View/Goto/PrevPart", "Z"},
145 {"<Actions>/Menu/View/OpenNewWindow", "<control><alt>N"},
146 {"<Actions>/Menu/View/MessageSource", "<control>U"},
147 {"<Actions>/Menu/View/Part/AsText", "T"},
148 {"<Actions>/Menu/View/Part/Open", "L"},
149 {"<Actions>/Menu/View/Part/OpenWith", "O"},
150 {"<Actions>/Menu/View/UpdateSummary", "<control><alt>U"},
152 {"<Actions>/Menu/Message/Receive/CurrentAccount", "<control>I"},
153 {"<Actions>/Menu/Message/Receive/AllAccounts", "<shift><control>I"},
154 {"<Actions>/Menu/Message/ComposeEmail", "<control>M"},
155 {"<Actions>/Menu/Message/Reply", "<control>R"},
156 {"<Actions>/Menu/Message/ReplyTo/All", "<shift><control>R"},
157 {"<Actions>/Menu/Message/ReplyTo/Sender", ""},
158 {"<Actions>/Menu/Message/ReplyTo/List", "<control>L"},
159 {"<Actions>/Menu/Message/Forward", "<control><alt>F"},
160 {"<Actions>/Menu/Message/Move", "<control>O"},
161 {"<Actions>/Menu/Message/Copy", "<shift><control>O"},
162 {"<Actions>/Menu/Message/Trash", "<control>D"},
163 {"<Actions>/Menu/Message/Mark/Mark", "<shift>asterisk"},
164 {"<Actions>/Menu/Message/Mark/Unmark", "U"},
165 {"<Actions>/Menu/Message/Mark/MarkUnread", "<shift>exclam"},
166 {"<Actions>/Menu/Message/Mark/MarkRead", ""},
168 {"<Actions>/Menu/Tools/AddressBook", "<shift><control>A"},
169 {"<Actions>/Menu/Tools/ListUrls", "<shift><control>U"},
170 {"<Actions>/Menu/Tools/Execute", "X"},
171 {"<Actions>/Menu/Tools/Expunge", "<control>E"},
172 {"<Actions>/Menu/Tools/NetworkLog", "<shift><control>L"},
175 {"<Actions>/Menu/Message/Send", "<control>Return"},
176 {"<Actions>/Menu/Message/SendLater", "<shift><control>S"},
177 {"<Actions>/Menu/Message/AttachFile", "<control>M"},
178 {"<Actions>/Menu/Message/InsertFile", "<control>I"},
179 {"<Actions>/Menu/Message/InsertSig", "<control>G"},
180 {"<Actions>/Menu/Message/Save", "<control>S"},
181 {"<Actions>/Menu/Message/Close", "<control>W"},
182 {"<Actions>/Menu/Edit/Undo", "<control>Z"},
183 {"<Actions>/Menu/Edit/Redo", "<control>Y"},
184 {"<Actions>/Menu/Edit/Cut", "<control>X"},
185 {"<Actions>/Menu/Edit/Copy", "<control>C"},
186 {"<Actions>/Menu/Edit/Paste", "<control>V"},
187 {"<Actions>/Menu/Edit/SelectAll", "<control>A"},
188 {"<Actions>/Menu/Edit/Advanced/BackChar", "<control>B"},
189 {"<Actions>/Menu/Edit/Advanced/ForwChar", "<control>F"},
190 {"<Actions>/Menu/Edit/Advanced/BackWord", ""},
191 {"<Actions>/Menu/Edit/Advanced/ForwWord", ""},
192 {"<Actions>/Menu/Edit/Advanced/BegLine", ""},
193 {"<Actions>/Menu/Edit/Advanced/EndLine", "<control>E"},
194 {"<Actions>/Menu/Edit/Advanced/PrevLine", "<control>P"},
195 {"<Actions>/Menu/Edit/Advanced/NextLine", "<control>N"},
196 {"<Actions>/Menu/Edit/Advanced/DelBackChar", "<control>H"},
197 {"<Actions>/Menu/Edit/Advanced/DelForwChar", "<control>D"},
198 {"<Actions>/Menu/Edit/Advanced/DelBackWord", ""},
199 {"<Actions>/Menu/Edit/Advanced/DelForwWord", ""},
200 {"<Actions>/Menu/Edit/Advanced/DelLine", "<control>U"},
201 {"<Actions>/Menu/Edit/Advanced/DelEndLine", "<control>K"},
202 {"<Actions>/Menu/Edit/WrapPara", "<control>L"},
203 {"<Actions>/Menu/Edit/WrapAllLines", "<control><alt>L"},
204 {"<Actions>/Menu/Edit/AutoWrap", "<shift><control>L"},
205 {"<Actions>/Menu/Edit/ExtEditor", "<shift><control>X"},
208 static struct KeyBind mew_wl_menurc
[] = {
210 {"<Actions>/Menu/File/EmptyTrashes", "<shift>D"},
211 {"<Actions>/Menu/File/SaveAs", "Y"},
212 {"<Actions>/Menu/File/Print", "<control>numbersign"},
213 {"<Actions>/Menu/File/Exit", "<shift>Q"},
215 {"<Actions>/Menu/Edit/Copy", "<control>C"},
216 {"<Actions>/Menu/Edit/SelectAll", "<control>A"},
217 {"<Actions>/Menu/Edit/Find", "<control>F"},
218 {"<Actions>/Menu/Edit/SearchFolder", "<control>S"},
219 {"<Actions>/Menu/Edit/QuickSearch", "slash"},
221 {"<Actions>/Menu/View/ShowHide/MessageView", ""},
222 {"<Actions>/Menu/View/ThreadView", "<shift>T"},
223 {"<Actions>/Menu/View/Goto/Prev", "P"},
224 {"<Actions>/Menu/View/Goto/Next", "N"},
225 {"<Actions>/Menu/View/Goto/PrevUnread", "<shift>P"},
226 {"<Actions>/Menu/View/Goto/NextUnread", "<shift>N"},
227 {"<Actions>/Menu/View/Goto/Folder", "G"},
228 {"<Actions>/Menu/View/OpenNewWindow", "<control><alt>N"},
229 {"<Actions>/Menu/View/MessageSource", "<control>U"},
230 {"<Actions>/Menu/View/AllHeaders", "<shift>H"},
231 {"<Actions>/Menu/View/UpdateSummary", "<shift>S"},
233 {"<Actions>/Menu/Message/Receive/CurrentAccount",
235 {"<Actions>/Menu/Message/Receive/AllAccounts", "<shift><control>I"},
236 {"<Actions>/Menu/Message/ComposeEmail", "W"},
237 {"<Actions>/Menu/Message/Reply", "<control>R"},
238 {"<Actions>/Menu/Message/ReplyTo/All", "<shift>A"},
239 {"<Actions>/Menu/Message/ReplyTo/Sender", ""},
240 {"<Actions>/Menu/Message/ReplyTo/List", "<control>L"},
241 {"<Actions>/Menu/Message/Forward", "F"},
242 {"<Actions>/Menu/Message/Move", "O"},
243 {"<Actions>/Menu/Message/Copy", "<shift>O"},
244 {"<Actions>/Menu/Message/Trash", "D"},
245 {"<Actions>/Menu/Message/Mark/Mark", "<shift>asterisk"},
246 {"<Actions>/Menu/Message/Mark/Unmark", "U"},
247 {"<Actions>/Menu/Message/Mark/MarkUnread", "<shift>exclam"},
248 {"<Actions>/Menu/Message/Mark/MarkRead", "<shift>R"},
250 {"<Actions>/Menu/Tools/AddressBook", "<shift><control>A"},
251 {"<Actions>/Menu/Tools/Execute", "X"},
252 {"<Actions>/Menu/Tools/NetworkLog", "<shift><control>L"},
255 {"<Actions>/Menu/Message/Close", "<alt>W"},
256 {"<Actions>/Menu/Edit/SelectAll", ""},
257 {"<Actions>/Menu/Edit/Advanced/BackChar", "<alt>B"},
258 {"<Actions>/Menu/Edit/Advanced/ForwChar", "<alt>F"},
259 {"<Actions>/Menu/Edit/Advanced/BackWord", ""},
260 {"<Actions>/Menu/Edit/Advanced/ForwWord", ""},
261 {"<Actions>/Menu/Edit/Advanced/BegLine", "<control>A"},
262 {"<Actions>/Menu/Edit/Advanced/DelBackWord", "<control>W"},
263 {"<Actions>/Menu/Edit/Advanced/DelForwWord", "<alt>D"},
266 static struct KeyBind mutt_menurc
[] = {
268 {"<Actions>/Menu/File/SaveAs", "S"}, /* save-message */
269 {"<Actions>/Menu/File/Print", "P"}, /* print-message */
270 {"<Actions>/Menu/File/Exit", "Q"}, /* quit */
272 {"<Actions>/Menu/Edit/Copy", "<control>C"}, /* - */
273 {"<Actions>/Menu/Edit/SelectAll", "<control>A"}, /* - */
274 {"<Actions>/Menu/Edit/Find", "<alt>B"}, /* <esc>B: search in message bodies */
275 {"<Actions>/Menu/Edit/SearchFolder", "slash"}, /* search */
276 {"<Actions>/Menu/Edit/QuickSearch", "L"}, /* limit */
278 {"<Actions>/Menu/View/ShowHide/MessageView", "V"}, /* - */
279 {"<Actions>/Menu/View/ThreadView", "<control>T"}, /* - */
280 {"<Actions>/Menu/View/Goto/Prev", "K"}, /* previous-entry */
281 {"<Actions>/Menu/View/Goto/Next", "J"}, /* next-entry */
282 {"<Actions>/Menu/View/Goto/PrevUnread", "<alt>U"}, /* <esc>Tab: previous-new-then-unread */
283 {"<Actions>/Menu/View/Goto/NextUnread", "U"}, /* Tab: next-new-then-unread */
284 {"<Actions>/Menu/View/Goto/Folder", "C"}, /* change-folder */
285 {"<Actions>/Menu/View/OpenNewWindow", "<control><alt>N"}, /* - */
286 {"<Actions>/Menu/View/MessageSource", "E"}, /* edit the raw message */
287 {"<Actions>/Menu/View/AllHeaders", "H"}, /* display-toggle-weed */
288 {"<Actions>/Menu/View/UpdateSummary", "<control><alt>U"}, /* - */
290 {"<Actions>/Menu/Message/Receive/CurrentAccount", "<control>I"}, /* - */
291 {"<Actions>/Menu/Message/Receive/AllAccounts", "<shift>G"}, /* fetch-mail */
292 {"<Actions>/Menu/Message/ComposeEmail", "M"}, /* mail */
293 {"<Actions>/Menu/Message/Reply", "R"}, /* reply */
294 {"<Actions>/Menu/Message/ReplyTo/All", "G"}, /* group-reply */
295 {"<Actions>/Menu/Message/ReplyTo/List", "<shift>L"}, /* list-reply */
296 {"<Actions>/Menu/Message/Forward", "F"}, /* forward-message */
297 {"<Actions>/Menu/Message/Move", "<control>O"}, /* - */
298 {"<Actions>/Menu/Message/Copy", "<shift>C"}, /* copy-message */
299 {"<Actions>/Menu/Message/Trash", "D"}, /* delete-message */
300 {"<Actions>/Menu/Message/Mark/Mark", "<shift>F"}, /* flag-message */
301 {"<Actions>/Menu/Message/Mark/Unmark", "<shift><control>F"}, /* - */
302 {"<Actions>/Menu/Message/Mark/MarkUnread", "<shift>N"}, /* toggle-new */
303 {"<Actions>/Menu/Message/Mark/MarkRead", "<control>R"}, /* read-thread */
305 {"<Actions>/Menu/Tools/AddressBook", "<shift><control>A"}, /* - */
306 {"<Actions>/Menu/Tools/Execute", "dollar"}, /* sync-mailbox */
307 {"<Actions>/Menu/Tools/NetworkLog", "<shift><control>L"}, /* - */
310 {"<Actions>/Menu/Message/Close", "<alt>W"}, /* - */
311 {"<Actions>/Menu/Edit/Advanced/BackWord", "<alt>B"}, /* - */
312 {"<Actions>/Menu/Edit/Advanced/ForwWord", "<alt>F"}, /* - */
313 {"<Actions>/Menu/Edit/Advanced/BegLine", "<control>A"}, /* - */
314 {"<Actions>/Menu/Edit/Advanced/DelBackWord", "<control>W"}, /* - */
315 {"<Actions>/Menu/Edit/Advanced/DelForwWord", "<alt>D"}, /* - */
318 text
= gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widget
));
320 if (!strcmp(text
, _("Default"))) {
321 menurc
= default_menurc
;
322 n_menurc
= G_N_ELEMENTS(default_menurc
);
323 } else if (!strcmp(text
, "Mew / Wanderlust")) {
324 menurc
= mew_wl_menurc
;
325 n_menurc
= G_N_ELEMENTS(mew_wl_menurc
);
326 } else if (!strcmp(text
, "Mutt")) {
327 menurc
= mutt_menurc
;
328 n_menurc
= G_N_ELEMENTS(mutt_menurc
);
335 prefs_keybind_apply(menurc
, n_menurc
);
338 static void prefs_other_create_widget(PrefsPage
*_page
, GtkWindow
*window
,
341 OtherPage
*prefs_other
= (OtherPage
*) _page
;
346 GtkWidget
*frame_addr
;
347 GtkWidget
*vbox_addr
;
348 GtkWidget
*checkbtn_addaddrbyclick
;
350 GtkWidget
*frame_exit
;
351 GtkWidget
*vbox_exit
;
352 GtkWidget
*checkbtn_confonexit
;
353 GtkWidget
*checkbtn_cleanonexit
;
354 GtkWidget
*checkbtn_warnqueued
;
356 GtkWidget
*frame_keys
;
357 GtkWidget
*vbox_keys
;
358 GtkWidget
*checkbtn_gtk_enable_accels
;
359 GtkWidget
*keys_preset_hbox
;
360 GtkWidget
*keys_preset_label
;
361 GtkWidget
*keys_preset_combo
;
363 GtkWidget
*label_iotimeout
;
364 GtkWidget
*spinbtn_iotimeout
;
365 GtkAdjustment
*spinbtn_iotimeout_adj
;
368 GtkWidget
*checkbtn_transhdr
;
369 GtkWidget
*checkbtn_askonclean
;
370 GtkWidget
*checkbtn_askonfilter
;
371 GtkWidget
*checkbtn_use_shred
;
372 GtkWidget
*checkbtn_real_time_sync
;
374 GtkWidget
*frame_metadata
;
375 GtkWidget
*vbox_metadata
;
376 GtkWidget
*metadata_label
;
377 GtkWidget
*flush_metadata_faster_radiobtn
;
378 GtkWidget
*flush_metadata_safer_radiobtn
;
380 #ifndef PASSWORD_CRYPTO_OLD
381 GtkWidget
*vbox_passphrase
;
382 GtkWidget
*frame_passphrase
;
383 GtkWidget
*checkbtn_use_passphrase
;
384 GtkWidget
*button_change_passphrase
;
387 gchar
*shred_binary
= NULL
;
389 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
390 gtk_widget_show (vbox1
);
391 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
393 vbox_addr
= gtkut_get_options_frame(vbox1
, &frame_addr
, _("Address book"));
396 (vbox_addr
, checkbtn_addaddrbyclick
,
397 _("Add address to destination when double-clicked"));
400 vbox_exit
= gtkut_get_options_frame(vbox1
, &frame_exit
, _("On exit"));
402 PACK_CHECK_BUTTON (vbox_exit
, checkbtn_confonexit
,
403 _("Confirm on exit"));
405 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 32);
406 gtk_widget_show (hbox1
);
407 gtk_box_pack_start (GTK_BOX (vbox_exit
), hbox1
, FALSE
, FALSE
, 0);
409 PACK_CHECK_BUTTON (hbox1
, checkbtn_cleanonexit
,
410 _("Empty trash on exit"));
412 PACK_CHECK_BUTTON (vbox_exit
, checkbtn_warnqueued
,
413 _("Warn if there are queued messages"));
415 vbox_keys
= gtkut_get_options_frame(vbox1
, &frame_keys
, _("Keyboard shortcuts"));
417 PACK_CHECK_BUTTON(vbox_keys
, checkbtn_gtk_enable_accels
,
418 _("Enable keyboard shortcuts"));
420 keys_preset_hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
421 gtk_widget_show (keys_preset_hbox
);
422 gtk_box_pack_start (GTK_BOX (vbox_keys
), keys_preset_hbox
, FALSE
, FALSE
, 0);
424 keys_preset_label
= gtk_label_new
425 (_("Select preset keyboard shortcuts:"));
426 gtk_box_pack_start (GTK_BOX (keys_preset_hbox
), keys_preset_label
, FALSE
, FALSE
, 0);
427 gtk_label_set_justify (GTK_LABEL (keys_preset_label
), GTK_JUSTIFY_LEFT
);
429 keys_preset_combo
= combobox_text_new(FALSE
,
435 gtk_box_pack_start (GTK_BOX (keys_preset_hbox
), keys_preset_combo
, FALSE
, FALSE
, 0);
436 gtk_widget_show_all(frame_keys
);
437 SET_TOGGLE_SENSITIVITY (checkbtn_gtk_enable_accels
, keys_preset_hbox
);
439 vbox_metadata
= gtkut_get_options_frame(vbox1
, &frame_metadata
, _("Metadata handling"));
440 metadata_label
= gtk_label_new(_("Safer mode asks the OS to write metadata to disk directly;\n"
441 "it avoids data loss after crashes but can take some time."));
442 gtk_label_set_xalign(GTK_LABEL(metadata_label
), 0.0);
443 gtk_label_set_yalign(GTK_LABEL(metadata_label
), 0.0);
444 gtk_box_pack_start (GTK_BOX (vbox_metadata
), metadata_label
, FALSE
, FALSE
, 0);
445 flush_metadata_safer_radiobtn
= gtk_radio_button_new_with_label(NULL
, _("Safer"));
446 flush_metadata_faster_radiobtn
= gtk_radio_button_new_with_label_from_widget(
447 GTK_RADIO_BUTTON(flush_metadata_safer_radiobtn
), _("Faster"));
448 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
449 gtk_widget_show (hbox1
);
450 gtk_box_pack_start (GTK_BOX (vbox_metadata
), hbox1
, FALSE
, FALSE
, 0);
451 gtk_box_pack_start (GTK_BOX (hbox1
), flush_metadata_safer_radiobtn
, FALSE
, FALSE
, 0);
452 gtk_box_pack_start (GTK_BOX (hbox1
), flush_metadata_faster_radiobtn
, FALSE
, FALSE
, 0);
454 if (prefs_common
.flush_metadata
)
455 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(flush_metadata_safer_radiobtn
), TRUE
);
457 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(flush_metadata_faster_radiobtn
), TRUE
);
459 gtk_widget_show_all(frame_metadata
);
461 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
462 gtk_widget_show (hbox1
);
463 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
465 label_iotimeout
= gtk_label_new (_("Socket I/O timeout"));
466 gtk_widget_show (label_iotimeout
);
467 gtk_box_pack_start (GTK_BOX (hbox1
), label_iotimeout
, FALSE
, FALSE
, 0);
469 spinbtn_iotimeout_adj
= GTK_ADJUSTMENT(gtk_adjustment_new (60, 0, 1000, 1, 10, 0));
470 spinbtn_iotimeout
= gtk_spin_button_new
471 (GTK_ADJUSTMENT (spinbtn_iotimeout_adj
), 1, 0);
472 gtk_widget_show (spinbtn_iotimeout
);
473 gtk_box_pack_start (GTK_BOX (hbox1
), spinbtn_iotimeout
,
475 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout
), TRUE
);
477 label_iotimeout
= gtk_label_new (_("seconds"));
478 gtk_widget_show (label_iotimeout
);
479 gtk_box_pack_start (GTK_BOX (hbox1
), label_iotimeout
, FALSE
, FALSE
, 0);
481 vbox2
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, 8);
482 gtk_widget_show (vbox2
);
483 gtk_box_pack_start (GTK_BOX (vbox1
), vbox2
, FALSE
, FALSE
, 0);
485 PACK_CHECK_BUTTON(vbox2
, checkbtn_transhdr
,
486 _("Translate header names"));
487 CLAWS_SET_TIP(checkbtn_transhdr
,
488 _("The display of standard headers (such as 'From:', 'Subject:') "
489 "will be translated into your language."));
490 PACK_CHECK_BUTTON (vbox2
, checkbtn_askonclean
,
491 _("Ask before emptying trash"));
492 PACK_CHECK_BUTTON (vbox2
, checkbtn_askonfilter
,
493 _("Ask about account specific filtering rules when "
494 "filtering manually"));
495 shred_binary
= g_find_program_in_path("shred");
497 PACK_CHECK_BUTTON (vbox2
, checkbtn_use_shred
,
498 _("Use secure file deletion if possible"));
499 g_free(shred_binary
);
501 PACK_CHECK_BUTTON (vbox2
, checkbtn_use_shred
,
502 _("Use secure file deletion if possible\n"
503 "(the 'shred' program is not available)"));
504 gtk_widget_set_sensitive(checkbtn_use_shred
, FALSE
);
506 CLAWS_SET_TIP(checkbtn_use_shred
,
507 _("Use the 'shred' program to overwrite files with random data before "
508 "deleting them. This slows down deletion. Be sure to "
509 "read shred's man page for caveats."));
510 PACK_CHECK_BUTTON (vbox2
, checkbtn_real_time_sync
,
511 _("Synchronise offline folders as soon as possible"));
513 #ifndef PASSWORD_CRYPTO_OLD
514 vbox_passphrase
= gtkut_get_options_frame(vbox1
, &frame_passphrase
, _("Primary passphrase"));
516 PACK_CHECK_BUTTON(vbox_passphrase
, checkbtn_use_passphrase
,
517 _("Use a primary passphrase"));
519 CLAWS_SET_TIP(checkbtn_use_passphrase
,
520 _("If checked, your saved account passwords will be protected "
521 "by a primary passphrase. If no primary passphrase is set, "
522 "you will be prompted to set one."));
524 button_change_passphrase
= gtk_button_new_with_label(
525 _("Change primary passphrase"));
526 gtk_widget_show (button_change_passphrase
);
527 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
528 gtk_widget_show (hbox1
);
529 gtk_box_pack_start (GTK_BOX (vbox_passphrase
), hbox1
, FALSE
, FALSE
, 0);
530 gtk_box_pack_start (GTK_BOX (hbox1
), button_change_passphrase
,
532 SET_TOGGLE_SENSITIVITY (checkbtn_use_passphrase
, button_change_passphrase
);
533 g_signal_connect (G_OBJECT (button_change_passphrase
), "clicked",
534 G_CALLBACK (prefs_change_primary_passphrase
), NULL
);
537 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_addaddrbyclick
),
538 prefs_common
.add_address_by_click
);
539 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_confonexit
),
540 prefs_common
.confirm_on_exit
);
541 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_cleanonexit
),
542 prefs_common
.clean_on_exit
);
543 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonclean
),
544 prefs_common
.ask_on_clean
);
545 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_warnqueued
),
546 prefs_common
.warn_queued_on_exit
);
547 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_enable_accels
),
548 prefs_common
.gtk_enable_accels
);
549 gtk_widget_set_sensitive(keys_preset_hbox
, prefs_common
.gtk_enable_accels
);
551 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_iotimeout
),
552 prefs_common
.io_timeout_secs
);
554 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_transhdr
),
555 prefs_common
.trans_hdr
);
556 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonfilter
),
557 prefs_common
.ask_apply_per_account_filtering_rules
);
558 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_shred
),
559 prefs_common
.use_shred
);
560 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync
),
561 prefs_common
.real_time_sync
);
563 #ifndef PASSWORD_CRYPTO_OLD
564 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_passphrase
),
565 prefs_common
.use_primary_passphrase
);
566 gtk_widget_set_sensitive(button_change_passphrase
,
567 prefs_common
.use_primary_passphrase
);
570 prefs_other
->keys_preset_hbox
= keys_preset_hbox
;
571 prefs_other
->keys_preset_combo
= keys_preset_combo
;
572 prefs_other
->checkbtn_addaddrbyclick
= checkbtn_addaddrbyclick
;
573 prefs_other
->checkbtn_confonexit
= checkbtn_confonexit
;
574 prefs_other
->checkbtn_cleanonexit
= checkbtn_cleanonexit
;
575 prefs_other
->checkbtn_askonclean
= checkbtn_askonclean
;
576 prefs_other
->checkbtn_warnqueued
= checkbtn_warnqueued
;
577 prefs_other
->spinbtn_iotimeout
= spinbtn_iotimeout
;
578 prefs_other
->checkbtn_transhdr
= checkbtn_transhdr
;
579 prefs_other
->checkbtn_gtk_enable_accels
= checkbtn_gtk_enable_accels
;
580 prefs_other
->checkbtn_askonfilter
= checkbtn_askonfilter
;
581 prefs_other
->checkbtn_use_shred
= checkbtn_use_shred
;
582 prefs_other
->checkbtn_real_time_sync
= checkbtn_real_time_sync
;
583 prefs_other
->flush_metadata_safer_radiobtn
= flush_metadata_safer_radiobtn
;
584 prefs_other
->flush_metadata_faster_radiobtn
= flush_metadata_faster_radiobtn
;
585 #ifndef PASSWORD_CRYPTO_OLD
586 prefs_other
->checkbtn_use_passphrase
= checkbtn_use_passphrase
;
588 prefs_other
->page
.widget
= vbox1
;
591 static void prefs_other_save(PrefsPage
*_page
)
593 OtherPage
*page
= (OtherPage
*) _page
;
594 GtkSettings
*settings
= gtk_settings_get_default();
595 gboolean gtk_enable_accels
;
597 prefs_common
.add_address_by_click
= gtk_toggle_button_get_active(
598 GTK_TOGGLE_BUTTON(page
->checkbtn_addaddrbyclick
));
599 prefs_common
.confirm_on_exit
= gtk_toggle_button_get_active(
600 GTK_TOGGLE_BUTTON(page
->checkbtn_confonexit
));
601 prefs_common
.clean_on_exit
= gtk_toggle_button_get_active(
602 GTK_TOGGLE_BUTTON(page
->checkbtn_cleanonexit
));
603 prefs_common
.ask_on_clean
= gtk_toggle_button_get_active(
604 GTK_TOGGLE_BUTTON(page
->checkbtn_askonclean
));
605 prefs_common
.warn_queued_on_exit
= gtk_toggle_button_get_active(
606 GTK_TOGGLE_BUTTON(page
->checkbtn_warnqueued
));
607 prefs_common
.io_timeout_secs
= gtk_spin_button_get_value_as_int(
608 GTK_SPIN_BUTTON(page
->spinbtn_iotimeout
));
609 prefs_common
.flush_metadata
= gtk_toggle_button_get_active(
610 GTK_TOGGLE_BUTTON(page
->flush_metadata_safer_radiobtn
));
611 sock_set_io_timeout(prefs_common
.io_timeout_secs
);
613 imap_main_set_timeout(prefs_common
.io_timeout_secs
);
615 prefs_common
.trans_hdr
= gtk_toggle_button_get_active(
616 GTK_TOGGLE_BUTTON(page
->checkbtn_transhdr
));
617 prefs_common
.ask_apply_per_account_filtering_rules
=
618 gtk_toggle_button_get_active(
619 GTK_TOGGLE_BUTTON(page
->checkbtn_askonfilter
));
620 prefs_common
.use_shred
=
621 gtk_toggle_button_get_active(
622 GTK_TOGGLE_BUTTON(page
->checkbtn_use_shred
));
623 prefs_common
.real_time_sync
=
624 gtk_toggle_button_get_active(
625 GTK_TOGGLE_BUTTON(page
->checkbtn_real_time_sync
));
627 prefs_keybind_preset_changed(GTK_COMBO_BOX(page
->keys_preset_combo
));
629 #ifndef PASSWORD_CRYPTO_OLD
630 /* If we're disabling use of primary passphrase, we need to reencrypt
631 * all account passwords with hardcoded key. */
632 if (!gtk_toggle_button_get_active(
633 GTK_TOGGLE_BUTTON(page
->checkbtn_use_passphrase
))
634 && primary_passphrase_is_set()) {
635 primary_passphrase_change(NULL
, NULL
);
637 /* In case user did not finish the passphrase change process
638 * (e.g. did not enter a correct current primary passphrase),
639 * we need to enable the "use primary passphrase" checkbox again,
640 * since the old primary passphrase is still valid. */
641 if (primary_passphrase_is_set()) {
642 gtk_toggle_button_set_active(
643 GTK_TOGGLE_BUTTON(page
->checkbtn_use_passphrase
), TRUE
);
647 if (gtk_toggle_button_get_active(
648 GTK_TOGGLE_BUTTON(page
->checkbtn_use_passphrase
))
649 && !primary_passphrase_is_set()) {
650 primary_passphrase_change_dialog();
652 /* In case user cancelled the passphrase change dialog, we need
653 * to disable the "use primary passphrase" checkbox. */
654 if (!primary_passphrase_is_set()) {
655 gtk_toggle_button_set_active(
656 GTK_TOGGLE_BUTTON(page
->checkbtn_use_passphrase
), FALSE
);
660 prefs_common
.use_primary_passphrase
=
661 gtk_toggle_button_get_active(
662 GTK_TOGGLE_BUTTON(page
->checkbtn_use_passphrase
));
665 gtk_enable_accels
= gtk_toggle_button_get_active(
666 GTK_TOGGLE_BUTTON(page
->checkbtn_gtk_enable_accels
));
668 if (prefs_common
.gtk_enable_accels
!= gtk_enable_accels
) {
669 prefs_common
.gtk_enable_accels
= gtk_enable_accels
;
671 g_object_set(G_OBJECT(settings
), "gtk-enable-accels",
672 (glong
)prefs_common
.gtk_enable_accels
,
674 g_object_set(G_OBJECT(settings
), "gtk-enable-mnemonics",
675 (glong
)prefs_common
.gtk_enable_accels
,
679 if (prefs_common
.gtk_enable_accels
!= gtk_enable_accels
) {
680 /* gtk_can_change_accels value changed : we have (only if changed)
681 * to apply the gtk property to all widgets : */
682 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE
);
686 static void prefs_other_destroy_widget(PrefsPage
*_page
)
690 OtherPage
*prefs_other
;
692 void prefs_other_init(void)
695 GtkSettings
*settings
= gtk_settings_get_default();
696 static gchar
*path
[3];
698 path
[0] = _("Other");
699 path
[1] = _("Miscellaneous");
702 page
= g_new0(OtherPage
, 1);
703 page
->page
.path
= path
;
704 page
->page
.create_widget
= prefs_other_create_widget
;
705 page
->page
.destroy_widget
= prefs_other_destroy_widget
;
706 page
->page
.save_page
= prefs_other_save
;
707 page
->page
.weight
= 5.0;
708 prefs_gtk_register_page((PrefsPage
*) page
);
711 g_object_set(G_OBJECT(settings
), "gtk-enable-accels",
712 (glong
)prefs_common
.gtk_enable_accels
,
714 g_object_set(G_OBJECT(settings
), "gtk-enable-mnemonics",
715 (glong
)prefs_common
.gtk_enable_accels
,
719 void prefs_other_done(void)
721 prefs_gtk_unregister_page((PrefsPage
*) prefs_other
);
725 #ifndef PASSWORD_CRYPTO_OLD
726 void prefs_change_primary_passphrase(GtkButton
*button
, gpointer data
)
728 /* Call the passphrase change dialog */
729 primary_passphrase_change_dialog();