2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2005-2009 Colin Leroy <colin@colino.net> & The Claws Mail Team
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/>.
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"
41 #include "manage_window.h"
43 #include "imap-thread.h"
46 typedef struct _OtherPage
52 GtkWidget *checkbtn_addaddrbyclick;
53 GtkWidget *checkbtn_confonexit;
54 GtkWidget *checkbtn_cleanonexit;
55 GtkWidget *checkbtn_askonclean;
56 GtkWidget *checkbtn_warnqueued;
57 GtkWidget *spinbtn_iotimeout;
58 GtkWidget *checkbtn_gtk_can_change_accels;
59 GtkWidget *checkbtn_askonfilter;
60 GtkWidget *checkbtn_use_shred;
61 GtkWidget *checkbtn_real_time_sync;
64 static struct KeybindDialog {
69 static void prefs_keybind_select (void);
70 static gint prefs_keybind_deleted (GtkWidget *widget,
73 static gboolean prefs_keybind_key_pressed (GtkWidget *widget,
76 static void prefs_keybind_cancel (void);
77 static void prefs_keybind_apply_clicked (GtkWidget *widget);
80 static void prefs_keybind_select(void)
87 GtkWidget *confirm_area;
89 GtkWidget *cancel_btn;
91 window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_other");
92 gtk_container_set_border_width (GTK_CONTAINER (window), 8);
93 gtk_window_set_title (GTK_WINDOW (window),
94 _("Choose preset keyboard shortcuts"));
95 gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
96 gtk_window_set_modal (GTK_WINDOW (window), TRUE);
97 gtk_window_set_resizable(GTK_WINDOW (window), FALSE);
98 manage_window_set_transient (GTK_WINDOW (window));
100 vbox1 = gtk_vbox_new (FALSE, VSPACING);
101 gtk_container_add (GTK_CONTAINER (window), vbox1);
102 gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
104 hbox1 = gtk_hbox_new (FALSE, 8);
105 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
107 label = gtk_label_new
108 (_("Select preset:"));
109 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
110 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
112 combo = combobox_text_new(FALSE,
117 gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
119 hbox1 = gtk_hbox_new (FALSE, 8);
120 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
122 label = gtk_label_new
123 (_("You can also modify each menu shortcut by pressing\n"
124 "any key(s) when focusing the mouse pointer on the item."));
125 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
126 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
127 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
128 gtkut_widget_set_small_font_size (label);
130 hbox1 = gtk_hbox_new (FALSE, 8);
131 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
133 gtkut_stock_button_set_create (&confirm_area, &cancel_btn, GTK_STOCK_CANCEL,
134 &ok_btn, GTK_STOCK_OK,
136 gtk_box_pack_end (GTK_BOX (hbox1), confirm_area, FALSE, FALSE, 0);
137 gtk_widget_grab_focus (ok_btn);
139 MANAGE_WINDOW_SIGNALS_CONNECT(window);
140 g_signal_connect (G_OBJECT (window), "delete_event",
141 G_CALLBACK (prefs_keybind_deleted), NULL);
142 g_signal_connect (G_OBJECT (window), "key_press_event",
143 G_CALLBACK (prefs_keybind_key_pressed), NULL);
144 g_signal_connect (G_OBJECT (ok_btn), "clicked",
145 G_CALLBACK (prefs_keybind_apply_clicked),
147 g_signal_connect (G_OBJECT (cancel_btn), "clicked",
148 G_CALLBACK (prefs_keybind_cancel),
151 gtk_widget_show_all(window);
153 keybind.window = window;
154 keybind.combo = combo;
157 static gboolean prefs_keybind_key_pressed(GtkWidget *widget, GdkEventKey *event,
160 if (event && event->keyval == GDK_Escape)
161 prefs_keybind_cancel();
165 static gint prefs_keybind_deleted(GtkWidget *widget, GdkEventAny *event,
168 prefs_keybind_cancel();
172 static void prefs_keybind_cancel(void)
174 gtk_widget_destroy(keybind.window);
175 keybind.window = NULL;
176 keybind.combo = NULL;
180 const gchar *accel_path;
181 const gchar *accel_key;
184 static void prefs_keybind_apply(struct KeyBind keybind[], gint num)
188 GdkModifierType mods;
190 for (i = 0; i < num; i++) {
191 const gchar *accel_key
192 = keybind[i].accel_key ? keybind[i].accel_key : "";
193 gtk_accelerator_parse(accel_key, &key, &mods);
194 gtk_accel_map_change_entry(keybind[i].accel_path,
199 static void prefs_keybind_apply_clicked(GtkWidget *widget)
202 struct KeyBind *menurc;
205 static struct KeyBind default_menurc[] = {
207 {"<Actions>/Menu/File/EmptyTrashes", "<shift>D"},
208 {"<Actions>/Menu/File/SaveAs", "<control>S"},
209 {"<Actions>/Menu/File/Print", "<control>P"},
210 {"<Actions>/Menu/File/OfflineMode", "<control>W"},
211 {"<Actions>/Menu/File/SynchroniseFolders", "<control><shift>S"},
212 {"<Actions>/Menu/File/Exit", "<control>Q"},
214 {"<Actions>/Menu/Edit/Copy", "<control>C"},
215 {"<Actions>/Menu/Edit/SelectAll", "<control>A"},
216 {"<Actions>/Menu/Edit/Find", "<control>F"},
217 {"<Actions>/Menu/Edit/SearchFolder", "<shift><control>F"},
218 {"<Actions>/Menu/Edit/QuickSearch", "slash"},
220 {"<Actions>/Menu/View/ShowHide/MessageView", "V"},
221 {"<Actions>/Menu/View/ThreadView", "<control>T"},
222 {"<Actions>/Menu/View/GoTo/Prev", "P"},
223 {"<Actions>/Menu/View/GoTo/Next", "N"},
224 {"<Actions>/Menu/View/GoTo/PrevUnread", "<shift>P"},
225 {"<Actions>/Menu/View/GoTo/NextUnread", "<shift>N"},
226 {"<Actions>/Menu/View/GoTo/OtherFolder", "G"},
227 {"<Actions>/Menu/View/OpenNewWindow", "<control><alt>N"},
228 {"<Actions>/Menu/View/MessageSource", "<control>U"},
229 {"<Actions>/Menu/View/AllHeaders", "<control>H"},
230 {"<Actions>/Menu/View/UpdateSummary", "<control><alt>U"},
232 {"<Actions>/Menu/Message/Receive/CurrentAccount",
234 {"<Actions>/Menu/Message/Receive/AllAccounts", "<shift><control>I"},
235 {"<Actions>/Menu/Message/ComposeEmail", "<control>M"},
236 {"<Actions>/Menu/Message/Reply", "<control>R"},
237 {"<Actions>/Menu/Message/ReplyTo/All", "<shift><control>R"},
238 {"<Actions>/Menu/Message/ReplyTo/Sender", ""},
239 {"<Actions>/Menu/Message/ReplyTo/List", "<control>L"},
240 {"<Actions>/Menu/Message/Forward", "<control><alt>F"},
241 {"<Actions>/Menu/Message/Move", "<control>O"},
242 {"<Actions>/Menu/Message/Copy", "<shift><control>O"},
243 {"<Actions>/Menu/Message/Trash", "<control>D"},
244 {"<Actions>/Menu/Message/Mark/Mark", "<shift>asterisk"},
245 {"<Actions>/Menu/Message/Mark/Unmark", "U"},
246 {"<Actions>/Menu/Message/Mark/MarkUnread", "<shift>exclam"},
247 {"<Actions>/Menu/Message/Mark/MarkRead", ""},
249 {"<Actions>/Menu/Tools/AddressBook", "<shift><control>A"},
250 {"<Actions>/Menu/Tools/Execute", "X"},
251 {"<Actions>/Menu/Tools/NetworkLog", "<shift><control>L"},
253 {"<Actions>/Menu/Message/Send", "<control>Return"},
254 {"<Actions>/Menu/Message/SendLater", "<shift><control>S"},
255 {"<Actions>/Menu/Message/AttachFile", "<control>M"},
256 {"<Actions>/Menu/Message/InsertFile", "<control>I"},
257 {"<Actions>/Menu/Message/InsertSig", "<control>G"},
258 {"<Actions>/Menu/Message/Save", "<control>S"},
259 {"<Actions>/Menu/Message/Close", "<control>W"},
260 {"<Actions>/Menu/Edit/Undo", "<control>Z"},
261 {"<Actions>/Menu/Edit/Redo", "<control>Y"},
262 {"<Actions>/Menu/Edit/Cut", "<control>X"},
263 {"<Actions>/Menu/Edit/Copy", "<control>C"},
264 {"<Actions>/Menu/Edit/Paste", "<control>V"},
265 {"<Actions>/Menu/Edit/SelectAll", "<control>A"},
266 {"<Actions>/Menu/Edit/Advanced/BackChar", "<control>B"},
267 {"<Actions>/Menu/Edit/Advanced/ForwChar", "<control>F"},
268 {"<Actions>/Menu/Edit/Advanced/BackWord", ""},
269 {"<Actions>/Menu/Edit/Advanced/ForwWord", ""},
270 {"<Actions>/Menu/Edit/Advanced/BegLine", ""},
271 {"<Actions>/Menu/Edit/Advanced/EndLine", "<control>E"},
272 {"<Actions>/Menu/Edit/Advanced/PrevLine", "<control>P"},
273 {"<Actions>/Menu/Edit/Advanced/NextLine", "<control>N"},
274 {"<Actions>/Menu/Edit/Advanced/DelBackChar", "<control>H"},
275 {"<Actions>/Menu/Edit/Advanced/DelForwChar", "<control>D"},
276 {"<Actions>/Menu/Edit/Advanced/DelBackWord", ""},
277 {"<Actions>/Menu/Edit/Advanced/DelForwWord", ""},
278 {"<Actions>/Menu/Edit/Advanced/DelLine", "<control>U"},
279 {"<Actions>/Menu/Edit/Advanced/DelEndLine", "<control>K"},
280 {"<Actions>/Menu/Edit/WrapPara", "<control>L"},
281 {"<Actions>/Menu/Edit/WrapAllLines", "<control><alt>L"},
282 {"<Actions>/Menu/Edit/AutoWrap", "<shift><control>L"},
283 {"<Actions>/Menu/Edit/ExtEditor", "<shift><control>X"},
284 {"<Actions>/Menu/Tools/AddressBook", "<shift><control>A"},
287 static struct KeyBind mew_wl_menurc[] = {
289 {"<Actions>/Menu/File/EmptyTrashes", "<shift>D"},
290 {"<Actions>/Menu/File/SaveAs", "Y"},
291 {"<Actions>/Menu/File/Print", "<control>numbersign"},
292 {"<Actions>/Menu/File/Exit", "<shift>Q"},
294 {"<Actions>/Menu/Edit/Copy", "<control>C"},
295 {"<Actions>/Menu/Edit/SelectAll", "<control>A"},
296 {"<Actions>/Menu/Edit/Find", "<control>F"},
297 {"<Actions>/Menu/Edit/SearchFolder", "<control>S"},
298 {"<Actions>/Menu/Edit/QuickSearch", "slash"},
300 {"<Actions>/Menu/View/ShowHide/MessageView", ""},
301 {"<Actions>/Menu/View/ThreadView", "<shift>T"},
302 {"<Actions>/Menu/View/GoTo/Prev", "P"},
303 {"<Actions>/Menu/View/GoTo/Next", "N"},
304 {"<Actions>/Menu/View/GoTo/PrevUnread", "<shift>P"},
305 {"<Actions>/Menu/View/GoTo/NextUnread", "<shift>N"},
306 {"<Actions>/Menu/View/GoTo/OtherFolder", "G"},
307 {"<Actions>/Menu/View/OpenNewWindow", "<control><alt>N"},
308 {"<Actions>/Menu/View/MessageSource", "<control>U"},
309 {"<Actions>/Menu/View/AllHeaders", "<shift>H"},
310 {"<Actions>/Menu/View/UpdateSummary", "<shift>S"},
312 {"<Actions>/Menu/Message/Receive/CurrentAccount",
314 {"<Actions>/Menu/Message/Receive/AllAccounts", "<shift><control>I"},
315 {"<Actions>/Menu/Message/ComposeEmail", "W"},
316 {"<Actions>/Menu/Message/Reply", "<control>R"},
317 {"<Actions>/Menu/Message/ReplyTo/All", "<shift>A"},
318 {"<Actions>/Menu/Message/ReplyTo/Sender", ""},
319 {"<Actions>/Menu/Message/ReplyTo/List", "<control>L"},
320 {"<Actions>/Menu/Message/Forward", "F"},
321 {"<Actions>/Menu/Message/Move", "O"},
322 {"<Actions>/Menu/Message/Copy", "<shift>O"},
323 {"<Actions>/Menu/Message/Trash", "D"},
324 {"<Actions>/Menu/Message/Mark/Mark", "<shift>asterisk"},
325 {"<Actions>/Menu/Message/Mark/Unmark", "U"},
326 {"<Actions>/Menu/Message/Mark/MarkUnread", "<shift>exclam"},
327 {"<Actions>/Menu/Message/Mark/MarkRead", "<shift>R"},
329 {"<Actions>/Menu/Tools/AddressBook", "<shift><control>A"},
330 {"<Actions>/Menu/Tools/Execute", "X"},
331 {"<Actions>/Menu/Tools/NetworkLog", "<shift><control>L"},
333 {"<Actions>/Menu/Message/Close", "<alt>W"},
334 {"<Actions>/Menu/Edit/SelectAll", ""},
335 {"<Actions>/Menu/Edit/Advanced/BackChar", "<alt>B"},
336 {"<Actions>/Menu/Edit/Advanced/ForwChar", "<alt>F"},
337 {"<Actions>/Menu/Edit/Advanced/BackWord", ""},
338 {"<Actions>/Menu/Edit/Advanced/ForwWord", ""},
339 {"<Actions>/Menu/Edit/Advanced/BegLine", "<control>A"},
340 {"<Actions>/Menu/Edit/Advanced/DelBackWord", "<control>W"},
341 {"<Actions>/Menu/Edit/Advanced/DelForwWord", "<alt>D"},
344 static struct KeyBind mutt_menurc[] = {
346 {"<Actions>/Menu/File/EmptyTrashes", ""},
347 {"<Actions>/Menu/File/SaveAs", "S"},
348 {"<Actions>/Menu/File/Print", "P"},
349 {"<Actions>/Menu/File/Exit", "Q"},
351 {"<Actions>/Menu/Edit/Copy", "<control>C"},
352 {"<Actions>/Menu/Edit/SelectAll", "<control>A"},
353 {"<Actions>/Menu/Edit/Find", "<control>F"},
354 {"<Actions>/Menu/Edit/SearchFolder", "/"},
356 {"<Actions>/Menu/View/ShowHide/MessageView", "V"},
357 {"<Actions>/Menu/View/ThreadView", "<control>T"},
358 {"<Actions>/Menu/View/GoTo/Prev", ""},
359 {"<Actions>/Menu/View/GoTo/Next", ""},
360 {"<Actions>/Menu/View/GoTo/PrevUnread", ""},
361 {"<Actions>/Menu/View/GoTo/NextUnread", ""},
362 {"<Actions>/Menu/View/GoTo/OtherFolder", "C"},
363 {"<Actions>/Menu/View/OpenNewWindow", "<control><alt>N"},
364 {"<Actions>/Menu/View/MessageSource", "<control>U"},
365 {"<Actions>/Menu/View/AllHeaders", "<control>H"},
366 {"<Actions>/Menu/View/UpdateSummary", "<control><alt>U"},
368 {"<Actions>/Menu/Message/Receive/CurrentAccount",
370 {"<Actions>/Menu/Message/Receive/AllAccounts", "<shift><control>I"},
371 {"<Actions>/Menu/Message/ComposeEmail", "M"},
372 {"<Actions>/Menu/Message/Reply", "R"},
373 {"<Actions>/Menu/Message/ReplyTo/All", "G"},
374 {"<Actions>/Menu/Message/ReplyTo/Sender", ""},
375 {"<Actions>/Menu/Message/ReplyTo/List", "<control>L"},
376 {"<Actions>/Menu/Message/Forward", "F"},
377 {"<Actions>/Menu/Message/Move", "<control>O"},
378 {"<Actions>/Menu/Message/Copy", "<shift>C"},
379 {"<Actions>/Menu/Message/Trash", "D"},
380 {"<Actions>/Menu/Message/Mark/Mark", "<shift>F"},
381 {"<Actions>/Menu/Message/Mark/Unmark", "U"},
382 {"<Actions>/Menu/Message/Mark/MarkUnread", "<shift>N"},
383 {"<Actions>/Menu/Message/Mark/MarkRead", ""},
385 {"<Actions>/Menu/Tools/AddressBook", "<shift><control>A"},
386 {"<Actions>/Menu/Tools/Execute", "X"},
387 {"<Actions>/Menu/Tools/NetworkLog", "<shift><control>L"},
389 {"<Actions>/Menu/Message/Close", "<alt>W"},
390 {"<Actions>/Menu/Edit/SelectAll", ""},
391 {"<Actions>/Menu/Edit/Advanced/BackWord", "<alt>B"},
392 {"<Actions>/Menu/Edit/Advanced/ForwWord", "<alt>F"},
393 {"<Actions>/Menu/Edit/Advanced/BegLine", "<control>A"},
394 {"<Actions>/Menu/Edit/Advanced/DelBackWord", "<control>W"},
395 {"<Actions>/Menu/Edit/Advanced/DelForwWord", "<alt>D"},
398 text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(keybind.combo));
400 if (!strcmp(text, _("Default"))) {
401 menurc = default_menurc;
402 n_menurc = G_N_ELEMENTS(default_menurc);
403 } else if (!strcmp(text, "Mew / Wanderlust")) {
404 menurc = mew_wl_menurc;
405 n_menurc = G_N_ELEMENTS(mew_wl_menurc);
406 } else if (!strcmp(text, "Mutt")) {
407 menurc = mutt_menurc;
408 n_menurc = G_N_ELEMENTS(mutt_menurc);
415 prefs_keybind_apply(menurc, n_menurc);
417 gtk_widget_destroy(keybind.window);
418 keybind.window = NULL;
419 keybind.combo = NULL;
422 static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
425 OtherPage *prefs_other = (OtherPage *) _page;
430 GtkWidget *frame_addr;
431 GtkWidget *vbox_addr;
432 GtkWidget *checkbtn_addaddrbyclick;
434 GtkWidget *frame_exit;
435 GtkWidget *vbox_exit;
436 GtkWidget *checkbtn_confonexit;
437 GtkWidget *checkbtn_cleanonexit;
438 GtkWidget *checkbtn_warnqueued;
440 GtkWidget *frame_keys;
441 GtkWidget *vbox_keys;
442 GtkWidget *checkbtn_gtk_can_change_accels;
443 GtkWidget *button_keybind;
445 GtkWidget *label_iotimeout;
446 GtkWidget *spinbtn_iotimeout;
447 GtkObject *spinbtn_iotimeout_adj;
450 GtkWidget *checkbtn_askonclean;
451 GtkWidget *checkbtn_askonfilter;
452 GtkWidget *checkbtn_use_shred;
453 GtkWidget *checkbtn_real_time_sync;
455 gchar *shred_binary = NULL;
458 vbox1 = gtk_vbox_new (FALSE, VSPACING);
459 gtk_widget_show (vbox1);
460 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
462 vbox_addr = gtkut_get_options_frame(vbox1, &frame_addr, _("Address book"));
465 (vbox_addr, checkbtn_addaddrbyclick,
466 _("Add address to destination when double-clicked"));
469 vbox_exit = gtkut_get_options_frame(vbox1, &frame_exit, _("On exit"));
471 PACK_CHECK_BUTTON (vbox_exit, checkbtn_confonexit,
472 _("Confirm on exit"));
474 hbox1 = gtk_hbox_new (FALSE, 32);
475 gtk_widget_show (hbox1);
476 gtk_box_pack_start (GTK_BOX (vbox_exit), hbox1, FALSE, FALSE, 0);
478 PACK_CHECK_BUTTON (hbox1, checkbtn_cleanonexit,
479 _("Empty trash on exit"));
481 PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
482 _("Warn if there are queued messages"));
484 vbox_keys = gtkut_get_options_frame(vbox1, &frame_keys, _("Keyboard shortcuts"));
486 PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_can_change_accels,
487 _("Enable customisable keyboard shortcuts"));
489 CLAWS_SET_TIP(checkbtn_gtk_can_change_accels,
490 _("If checked, you can change the keyboard shortcuts of "
491 "most of the menu items by focusing on the menu "
492 "item and pressing a key combination.\n"
493 "Uncheck this option if you want to lock all "
494 "existing keyboard shortcuts."));
496 button_keybind = gtk_button_new_with_label(
497 _(" Choose preset keyboard shortcuts... "));
498 gtk_widget_show (button_keybind);
499 hbox1 = gtk_hbox_new (FALSE, 8);
500 gtk_widget_show (hbox1);
501 gtk_box_pack_start (GTK_BOX (vbox_keys), hbox1, FALSE, FALSE, 0);
502 gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0);
503 g_signal_connect (G_OBJECT (button_keybind), "clicked",
504 G_CALLBACK (prefs_keybind_select), NULL);
506 hbox1 = gtk_hbox_new (FALSE, 8);
507 gtk_widget_show (hbox1);
508 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
510 label_iotimeout = gtk_label_new (_("Socket I/O timeout"));
511 gtk_widget_show (label_iotimeout);
512 gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
514 spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 0);
515 spinbtn_iotimeout = gtk_spin_button_new
516 (GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0);
517 gtk_widget_show (spinbtn_iotimeout);
518 gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout,
520 gtk_widget_set_size_request (spinbtn_iotimeout, 64, -1);
521 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE);
523 label_iotimeout = gtk_label_new (_("seconds"));
524 gtk_widget_show (label_iotimeout);
525 gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
527 vbox2 = gtk_vbox_new (FALSE, 8);
528 gtk_widget_show (vbox2);
529 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
531 PACK_CHECK_BUTTON (vbox2, checkbtn_askonclean,
532 _("Ask before emptying trash"));
533 PACK_CHECK_BUTTON (vbox2, checkbtn_askonfilter,
534 _("Ask about account specific filtering rules when "
535 "filtering manually"));
536 shred_binary = g_find_program_in_path("shred");
538 PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
539 _("Use secure file deletion if possible"));
540 g_free(shred_binary);
542 PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
543 _("Use secure file deletion if possible\n"
544 "(the 'shred' program is not available)"));
545 gtk_widget_set_sensitive(checkbtn_use_shred, FALSE);
547 CLAWS_SET_TIP(checkbtn_use_shred,
548 _("Use the 'shred' program to overwrite files with random data before "
549 "deleting them. This slows down deletion. Be sure to "
550 "read shred's man page for caveats."));
551 PACK_CHECK_BUTTON (vbox2, checkbtn_real_time_sync,
552 _("Synchronise offline folders as soon as possible"));
554 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_addaddrbyclick),
555 prefs_common.add_address_by_click);
556 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_confonexit),
557 prefs_common.confirm_on_exit);
558 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_cleanonexit),
559 prefs_common.clean_on_exit);
560 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonclean),
561 prefs_common.ask_on_clean);
562 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_warnqueued),
563 prefs_common.warn_queued_on_exit);
564 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_can_change_accels),
565 prefs_common.gtk_can_change_accels);
567 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_iotimeout),
568 prefs_common.io_timeout_secs);
570 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonfilter),
571 prefs_common.ask_apply_per_account_filtering_rules);
572 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_shred),
573 prefs_common.use_shred);
574 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync),
575 prefs_common.real_time_sync);
577 prefs_other->checkbtn_addaddrbyclick = checkbtn_addaddrbyclick;
578 prefs_other->checkbtn_confonexit = checkbtn_confonexit;
579 prefs_other->checkbtn_cleanonexit = checkbtn_cleanonexit;
580 prefs_other->checkbtn_askonclean = checkbtn_askonclean;
581 prefs_other->checkbtn_warnqueued = checkbtn_warnqueued;
582 prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
583 prefs_other->checkbtn_gtk_can_change_accels = checkbtn_gtk_can_change_accels;
584 prefs_other->checkbtn_askonfilter = checkbtn_askonfilter;
585 prefs_other->checkbtn_use_shred = checkbtn_use_shred;
586 prefs_other->checkbtn_real_time_sync = checkbtn_real_time_sync;
588 prefs_other->page.widget = vbox1;
591 static void prefs_other_save(PrefsPage *_page)
593 OtherPage *page = (OtherPage *) _page;
594 gboolean gtk_can_change_accels;
596 prefs_common.add_address_by_click = gtk_toggle_button_get_active(
597 GTK_TOGGLE_BUTTON(page->checkbtn_addaddrbyclick));
598 prefs_common.confirm_on_exit = gtk_toggle_button_get_active(
599 GTK_TOGGLE_BUTTON(page->checkbtn_confonexit));
600 prefs_common.clean_on_exit = gtk_toggle_button_get_active(
601 GTK_TOGGLE_BUTTON(page->checkbtn_cleanonexit));
602 prefs_common.ask_on_clean = gtk_toggle_button_get_active(
603 GTK_TOGGLE_BUTTON(page->checkbtn_askonclean));
604 prefs_common.warn_queued_on_exit = gtk_toggle_button_get_active(
605 GTK_TOGGLE_BUTTON(page->checkbtn_warnqueued));
606 prefs_common.io_timeout_secs = gtk_spin_button_get_value_as_int(
607 GTK_SPIN_BUTTON(page->spinbtn_iotimeout));
608 sock_set_io_timeout(prefs_common.io_timeout_secs);
610 imap_main_set_timeout(prefs_common.io_timeout_secs);
612 prefs_common.ask_apply_per_account_filtering_rules =
613 gtk_toggle_button_get_active(
614 GTK_TOGGLE_BUTTON(page->checkbtn_askonfilter));
615 prefs_common.use_shred =
616 gtk_toggle_button_get_active(
617 GTK_TOGGLE_BUTTON(page->checkbtn_use_shred));
618 prefs_common.real_time_sync =
619 gtk_toggle_button_get_active(
620 GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync));
622 gtk_can_change_accels = gtk_toggle_button_get_active(
623 GTK_TOGGLE_BUTTON(page->checkbtn_gtk_can_change_accels));
625 if (prefs_common.gtk_can_change_accels != gtk_can_change_accels) {
627 prefs_common.gtk_can_change_accels = gtk_can_change_accels;
629 gtk_settings_set_long_property(gtk_settings_get_default(),
630 "gtk-can-change-accels",
631 (glong)prefs_common.gtk_can_change_accels,
634 /* gtk_can_change_accels value changed : we have (only if changed)
635 * to apply the gtk property to all widgets : */
636 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE);
640 static void prefs_other_destroy_widget(PrefsPage *_page)
644 OtherPage *prefs_other;
646 void prefs_other_init(void)
649 static gchar *path[3];
651 path[0] = _("Other");
652 path[1] = _("Miscellaneous");
655 page = g_new0(OtherPage, 1);
656 page->page.path = path;
657 page->page.create_widget = prefs_other_create_widget;
658 page->page.destroy_widget = prefs_other_destroy_widget;
659 page->page.save_page = prefs_other_save;
660 page->page.weight = 5.0;
661 prefs_gtk_register_page((PrefsPage *) page);
664 gtk_settings_set_long_property(gtk_settings_get_default(),
665 "gtk-can-change-accels",
666 (glong)prefs_common.gtk_can_change_accels,
670 void prefs_other_done(void)
672 prefs_gtk_unregister_page((PrefsPage *) prefs_other);