2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2005-2007 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,
118 gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
120 hbox1 = gtk_hbox_new (FALSE, 8);
121 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
123 label = gtk_label_new
124 (_("You can also modify each menu shortcut by pressing\n"
125 "any key(s) when focusing the mouse pointer on the item."));
126 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
127 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
128 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
129 gtkut_widget_set_small_font_size (label);
131 hbox1 = gtk_hbox_new (FALSE, 8);
132 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
134 gtkut_stock_button_set_create (&confirm_area, &cancel_btn, GTK_STOCK_CANCEL,
135 &ok_btn, GTK_STOCK_OK,
137 gtk_box_pack_end (GTK_BOX (hbox1), confirm_area, FALSE, FALSE, 0);
138 gtk_widget_grab_focus (ok_btn);
140 MANAGE_WINDOW_SIGNALS_CONNECT(window);
141 g_signal_connect (G_OBJECT (window), "delete_event",
142 G_CALLBACK (prefs_keybind_deleted), NULL);
143 g_signal_connect (G_OBJECT (window), "key_press_event",
144 G_CALLBACK (prefs_keybind_key_pressed), NULL);
145 g_signal_connect (G_OBJECT (ok_btn), "clicked",
146 G_CALLBACK (prefs_keybind_apply_clicked),
148 g_signal_connect (G_OBJECT (cancel_btn), "clicked",
149 G_CALLBACK (prefs_keybind_cancel),
152 gtk_widget_show_all(window);
154 keybind.window = window;
155 keybind.combo = combo;
158 static gboolean prefs_keybind_key_pressed(GtkWidget *widget, GdkEventKey *event,
161 if (event && event->keyval == GDK_Escape)
162 prefs_keybind_cancel();
166 static gint prefs_keybind_deleted(GtkWidget *widget, GdkEventAny *event,
169 prefs_keybind_cancel();
173 static void prefs_keybind_cancel(void)
175 gtk_widget_destroy(keybind.window);
176 keybind.window = NULL;
177 keybind.combo = NULL;
181 const gchar *accel_path;
182 const gchar *accel_key;
185 static void prefs_keybind_apply(struct KeyBind keybind[], gint num)
189 GdkModifierType mods;
191 for (i = 0; i < num; i++) {
192 const gchar *accel_key
193 = keybind[i].accel_key ? keybind[i].accel_key : "";
194 gtk_accelerator_parse(accel_key, &key, &mods);
195 gtk_accel_map_change_entry(keybind[i].accel_path,
200 static void prefs_keybind_apply_clicked(GtkWidget *widget)
203 struct KeyBind *menurc;
206 static struct KeyBind default_menurc[] = {
207 {"<Main>/File/Empty all Trash folders", "<shift>D"},
208 {"<Main>/File/Save as...", "<control>S"},
209 {"<Main>/File/Print...", "<control>P"},
210 {"<Main>/File/Work offline", "<control>W"},
211 {"<Main>/File/Synchronise folders", "<control><shift>S"},
212 {"<Main>/File/Exit", "<control>Q"},
214 {"<Main>/Edit/Copy", "<control>C"},
215 {"<Main>/Edit/Select all", "<control>A"},
216 {"<Main>/Edit/Find in current message...", "<control>F"},
217 {"<Main>/Edit/Search folder...", "<shift><control>F"},
218 {"<Main>/Edit/Quick search", "slash"},
220 {"<Main>/View/Show or hide/Message View", "V"},
221 {"<Main>/View/Thread view", "<control>T"},
222 {"<Main>/View/Go to/Previous message", "P"},
223 {"<Main>/View/Go to/Next message", "N"},
224 {"<Main>/View/Go to/Previous unread message", "<shift>P"},
225 {"<Main>/View/Go to/Next unread message", "<shift>N"},
226 {"<Main>/View/Go to/Other folder...", "G"},
227 {"<Main>/View/Open in new window", "<control><alt>N"},
228 {"<Main>/View/Message source", "<control>U"},
229 {"<Main>/View/All headers", "<control>H"},
230 {"<Main>/View/Update summary", "<control><alt>U"},
232 {"<Main>/Message/Receive/Get from current account",
234 {"<Main>/Message/Receive/Get from all accounts","<shift><control>I"},
235 {"<Main>/Message/Compose an email message", "<control>M"},
236 {"<Main>/Message/Reply", "<control>R"},
237 {"<Main>/Message/Reply to/all", "<shift><control>R"},
238 {"<Main>/Message/Reply to/sender", ""},
239 {"<Main>/Message/Reply to/mailing list", "<control>L"},
240 {"<Main>/Message/Forward", "<control><alt>F"},
241 /* {"<Main>/Message/Forward as attachment", ""}, */
242 {"<Main>/Message/Move...", "<control>O"},
243 {"<Main>/Message/Copy...", "<shift><control>O"},
244 {"<Main>/Message/Move to trash", "<control>D"},
245 {"<Main>/Message/Mark/Mark", "<shift>asterisk"},
246 {"<Main>/Message/Mark/Unmark", "U"},
247 {"<Main>/Message/Mark/Mark as unread", "<shift>exclam"},
248 {"<Main>/Message/Mark/Mark as read", ""},
250 {"<Main>/Tools/Address book", "<shift><control>A"},
251 {"<Main>/Tools/Execute", "X"},
252 {"<Main>/Tools/Log window", "<shift><control>L"},
254 {"<Compose>/Message/Send", "<control>Return"},
255 {"<Compose>/Message/Send later", "<shift><control>S"},
256 {"<Compose>/Message/Attach file", "<control>M"},
257 {"<Compose>/Message/Insert file", "<control>I"},
258 {"<Compose>/Message/Insert signature", "<control>G"},
259 {"<Compose>/Message/Save", "<control>S"},
260 {"<Compose>/Message/Close", "<control>W"},
261 {"<Compose>/Edit/Undo", "<control>Z"},
262 {"<Compose>/Edit/Redo", "<control>Y"},
263 {"<Compose>/Edit/Cut", "<control>X"},
264 {"<Compose>/Edit/Copy", "<control>C"},
265 {"<Compose>/Edit/Paste", "<control>V"},
266 {"<Compose>/Edit/Select all", "<control>A"},
267 {"<Compose>/Edit/Advanced/Move a character backward", "<control>B"},
268 {"<Compose>/Edit/Advanced/Move a character forward", "<control>F"},
269 {"<Compose>/Edit/Advanced/Move a word backward," ""},
270 {"<Compose>/Edit/Advanced/Move a word forward", ""},
271 {"<Compose>/Edit/Advanced/Move to beginning of line", ""},
272 {"<Compose>/Edit/Advanced/Move to end of line", "<control>E"},
273 {"<Compose>/Edit/Advanced/Move to previous line", "<control>P"},
274 {"<Compose>/Edit/Advanced/Move to next line", "<control>N"},
275 {"<Compose>/Edit/Advanced/Delete a character backward", "<control>H"},
276 {"<Compose>/Edit/Advanced/Delete a character forward", "<control>D"},
277 {"<Compose>/Edit/Advanced/Delete a word backward", ""},
278 {"<Compose>/Edit/Advanced/Delete a word forward", ""},
279 {"<Compose>/Edit/Advanced/Delete line", "<control>U"},
280 {"<Compose>/Edit/Advanced/Delete entire line", ""},
281 {"<Compose>/Edit/Advanced/Delete to end of line", "<control>K"},
282 {"<Compose>/Edit/Wrap current paragraph", "<control>L"},
283 {"<Compose>/Edit/Wrap all long lines", "<control><alt>L"},
284 {"<Compose>/Edit/Auto wrapping", "<shift><control>L"},
285 {"<Compose>/Edit/Edit with external editor", "<shift><control>X"},
286 {"<Compose>/Tools/Address book", "<shift><control>A"},
289 static struct KeyBind mew_wl_menurc[] = {
290 {"<Main>/File/Empty all Trash folders", "<shift>D"},
291 {"<Main>/File/Save as...", "Y"},
292 {"<Main>/File/Print...", "<shift>numbersign"},
293 {"<Main>/File/Exit", "<shift>Q"},
295 {"<Main>/Edit/Copy", "<control>C"},
296 {"<Main>/Edit/Select all", "<control>A"},
297 {"<Main>/Edit/Find in current message...", "<control>F"},
298 {"<Main>/Edit/Search folder...", "<control>S"},
300 {"<Main>/View/Show or hide/Message View", ""},
301 {"<Main>/View/Thread view", "<shift>T"},
302 {"<Main>/View/Go to/Previous message", "P"},
303 {"<Main>/View/Go to/Next message", "N"},
304 {"<Main>/View/Go to/Previous unread message", "<shift>P"},
305 {"<Main>/View/Go to/Next unread message", "<shift>N"},
306 {"<Main>/View/Go to/Other folder...", "G"},
307 {"<Main>/View/Open in new window", "<control><alt>N"},
308 {"<Main>/View/Message source", "<control>U"},
309 {"<Main>/View/All headers", "<shift>H"},
310 {"<Main>/View/Update summary", "<shift>S"},
312 {"<Main>/Message/Receive/Get from current account",
314 {"<Main>/Message/Receive/Get from all accounts","<shift><control>I"},
315 {"<Main>/Message/Compose an email message", "W"},
316 {"<Main>/Message/Reply", "<control>R"},
317 {"<Main>/Message/Reply to/all", "<shift>A"},
318 {"<Main>/Message/Reply to/sender", ""},
319 {"<Main>/Message/Reply to/mailing list", "<control>L"},
320 {"<Main>/Message/Forward", "F"},
321 /* {"<Main>/Message/Forward as attachment", "<shift>F"}, */
322 {"<Main>/Message/Move...", "O"},
323 {"<Main>/Message/Copy...", "<shift>O"},
324 {"<Main>/Message/Delete", "D"},
325 {"<Main>/Message/Mark/Mark", "<shift>asterisk"},
326 {"<Main>/Message/Mark/Unmark", "U"},
327 {"<Main>/Message/Mark/Mark as unread", "<shift>exclam"},
328 {"<Main>/Message/Mark/Mark as read", "<shift>R"},
330 {"<Main>/Tools/Address book", "<shift><control>A"},
331 {"<Main>/Tools/Execute", "X"},
332 {"<Main>/Tools/Log window", "<shift><control>L"},
334 {"<Compose>/Message/Close", "<alt>W"},
335 {"<Compose>/Edit/Select all", ""},
336 {"<Compose>/Edit/Advanced/Move a word backward," "<alt>B"},
337 {"<Compose>/Edit/Advanced/Move a word forward", "<alt>F"},
338 {"<Compose>/Edit/Advanced/Move to beginning of line", "<control>A"},
339 {"<Compose>/Edit/Advanced/Delete a word backward", "<control>W"},
340 {"<Compose>/Edit/Advanced/Delete a word forward", "<alt>D"},
343 static struct KeyBind mutt_menurc[] = {
344 {"<Main>/File/Empty all Trash folders", ""},
345 {"<Main>/File/Save as...", "S"},
346 {"<Main>/File/Print...", "P"},
347 {"<Main>/File/Exit", "Q"},
349 {"<Main>/Edit/Copy", "<control>C"},
350 {"<Main>/Edit/Select all", "<control>A"},
351 {"<Main>/Edit/Find in current message...", "<control>F"},
352 {"<Main>/Edit/Search messages...", "slash"},
354 {"<Main>/View/Show or hide/Message view", "V"},
355 {"<Main>/View/Thread view", "<control>T"},
356 {"<Main>/View/Go to/Previous message", ""},
357 {"<Main>/View/Go to/Next message", ""},
358 {"<Main>/View/Go to/Previous unread message", ""},
359 {"<Main>/View/Go to/Next unread message", ""},
360 {"<Main>/View/Go to/Other folder...", "C"},
361 {"<Main>/View/Open in new window", "<control><alt>N"},
362 {"<Main>/View/Message source", "<control>U"},
363 {"<Main>/View/All headers", "<control>H"},
364 {"<Main>/View/Update summary", "<control><alt>U"},
366 {"<Main>/Message/Receive/Get from current account",
368 {"<Main>/Message/Receive/Get from all accounts","<shift><control>I"},
369 {"<Main>/Message/Compose an email message", "M"},
370 {"<Main>/Message/Reply", "R"},
371 {"<Main>/Message/Reply to/all", "G"},
372 {"<Main>/Message/Reply to/sender", ""},
373 {"<Main>/Message/Reply to/mailing list", "<control>L"},
374 {"<Main>/Message/Forward", "F"},
375 {"<Main>/Message/Forward as attachment", ""},
376 {"<Main>/Message/Move...", "<control>O"},
377 {"<Main>/Message/Copy...", "<shift>C"},
378 {"<Main>/Message/Delete", "D"},
379 {"<Main>/Message/Mark/Mark", "<shift>F"},
380 {"<Main>/Message/Mark/Unmark", "U"},
381 {"<Main>/Message/Mark/Mark as unread", "<shift>N"},
382 {"<Main>/Message/Mark/Mark as read", ""},
384 {"<Main>/Tools/Address book", "<shift><control>A"},
385 {"<Main>/Tools/Execute", "X"},
386 {"<Main>/Tools/Log window", "<shift><control>L"},
388 {"<Compose>/Message/Close", "<alt>W"},
389 {"<Compose>/Edit/Select all", ""},
390 {"<Compose>/Edit/Advanced/Move a word backward", "<alt>B"},
391 {"<Compose>/Edit/Advanced/Move a word forward", "<alt>F"},
392 {"<Compose>/Edit/Advanced/Move to beginning of line", "<control>A"},
393 {"<Compose>/Edit/Advanced/Delete a word backward", "<control>W"},
394 {"<Compose>/Edit/Advanced/Delete a word forward", "<alt>D"},
397 static struct KeyBind old_sylpheed_menurc[] = {
398 {"<Main>/File/Empty all Trash folders", ""},
399 {"<Main>/File/Save as...", ""},
400 {"<Main>/File/Print...", "<alt>P"},
401 {"<Main>/File/Exit", "<alt>Q"},
403 {"<Main>/Edit/Copy", "<control>C"},
404 {"<Main>/Edit/Select all", "<control>A"},
405 {"<Main>/Edit/Find in current message...", "<control>F"},
406 {"<Main>/Edit/Search folder...", "<control>S"},
408 {"<Main>/View/Show or hide/Message View", ""},
409 {"<Main>/View/Thread view", "<control>T"},
410 {"<Main>/View/Go to/Previous message", "P"},
411 {"<Main>/View/Go to/Next message", "N"},
412 {"<Main>/View/Go to/Previous unread message", "<shift>P"},
413 {"<Main>/View/Go to/Next unread message", "<shift>N"},
414 {"<Main>/View/Go to/Other folder...", "<alt>G"},
415 {"<Main>/View/Open in new window", "<shift><control>N"},
416 {"<Main>/View/Message source", "<control>U"},
417 {"<Main>/View/All headers", "<control>H"},
418 {"<Main>/View/Update summary", "<alt>U"},
420 {"<Main>/Message/Receive/Get from current account",
422 {"<Main>/Message/Receive/Get from all accounts","<shift><alt>I"},
423 {"<Main>/Message/Compose an email message", "<alt>N"},
424 {"<Main>/Message/Reply", "<alt>R"},
425 {"<Main>/Message/Reply to/all", "<shift><alt>R"},
426 {"<Main>/Message/Reply to/sender", "<control><alt>R"},
427 {"<Main>/Message/Reply to/mailing list", "<control>L"},
428 {"<Main>/Message/Forward", "<shift><alt>F"},
429 /* "(menu-path \"<Main>/Message/Forward as attachment", "<shift><control>F"}, */
430 {"<Main>/Message/Move...", "<alt>O"},
431 {"<Main>/Message/Copy...", ""},
432 {"<Main>/Message/Delete", "<alt>D"},
433 {"<Main>/Message/Mark/Mark", "<shift>asterisk"},
434 {"<Main>/Message/Mark/Unmark", "U"},
435 {"<Main>/Message/Mark/Mark as unread", "<shift>exclam"},
436 {"<Main>/Message/Mark/Mark as read", ""},
438 {"<Main>/Tools/Address book", "<alt>A"},
439 {"<Main>/Tools/Execute", "<alt>X"},
440 {"<Main>/Tools/Log window", "<alt>L"},
442 {"<Compose>/Message/Close", "<alt>W"},
443 {"<Compose>/Edit/Select all", ""},
444 {"<Compose>/Edit/Advanced/Move a word backward", "<alt>B"},
445 {"<Compose>/Edit/Advanced/Move a word forward", "<alt>F"},
446 {"<Compose>/Edit/Advanced/Move to beginning of line", "<control>A"},
447 {"<Compose>/Edit/Advanced/Delete a word backward", "<control>W"},
448 {"<Compose>/Edit/Advanced/Delete a word forward", "<alt>D"},
451 text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(keybind.combo));
453 if (!strcmp(text, _("Default"))) {
454 menurc = default_menurc;
455 n_menurc = G_N_ELEMENTS(default_menurc);
456 } else if (!strcmp(text, "Mew / Wanderlust")) {
457 menurc = mew_wl_menurc;
458 n_menurc = G_N_ELEMENTS(mew_wl_menurc);
459 } else if (!strcmp(text, "Mutt")) {
460 menurc = mutt_menurc;
461 n_menurc = G_N_ELEMENTS(mutt_menurc);
462 } else if (!strcmp(text, _("Old Sylpheed"))) {
463 menurc = old_sylpheed_menurc;
464 n_menurc = G_N_ELEMENTS(old_sylpheed_menurc);
471 /* prefs_keybind_apply(empty_menurc, G_N_ELEMENTS(empty_menurc)); */
472 prefs_keybind_apply(menurc, n_menurc);
474 gtk_widget_destroy(keybind.window);
475 keybind.window = NULL;
476 keybind.combo = NULL;
479 static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
482 OtherPage *prefs_other = (OtherPage *) _page;
487 GtkWidget *frame_addr;
488 GtkWidget *vbox_addr;
489 GtkWidget *checkbtn_addaddrbyclick;
491 GtkWidget *frame_exit;
492 GtkWidget *vbox_exit;
493 GtkWidget *checkbtn_confonexit;
494 GtkWidget *checkbtn_cleanonexit;
495 GtkWidget *checkbtn_warnqueued;
497 GtkWidget *frame_keys;
498 GtkWidget *vbox_keys;
499 GtkWidget *checkbtn_gtk_can_change_accels;
500 GtkWidget *button_keybind;
502 GtkWidget *label_iotimeout;
503 GtkWidget *spinbtn_iotimeout;
504 GtkObject *spinbtn_iotimeout_adj;
507 GtkWidget *checkbtn_askonclean;
508 GtkWidget *checkbtn_askonfilter;
509 GtkWidget *checkbtn_use_shred;
510 GtkWidget *checkbtn_real_time_sync;
512 gchar *shred_binary = NULL;
515 vbox1 = gtk_vbox_new (FALSE, VSPACING);
516 gtk_widget_show (vbox1);
517 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
519 vbox_addr = gtkut_get_options_frame(vbox1, &frame_addr, _("Address book"));
522 (vbox_addr, checkbtn_addaddrbyclick,
523 _("Add address to destination when double-clicked"));
526 vbox_exit = gtkut_get_options_frame(vbox1, &frame_exit, _("On exit"));
528 PACK_CHECK_BUTTON (vbox_exit, checkbtn_confonexit,
529 _("Confirm on exit"));
531 hbox1 = gtk_hbox_new (FALSE, 32);
532 gtk_widget_show (hbox1);
533 gtk_box_pack_start (GTK_BOX (vbox_exit), hbox1, FALSE, FALSE, 0);
535 PACK_CHECK_BUTTON (hbox1, checkbtn_cleanonexit,
536 _("Empty trash on exit"));
538 PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
539 _("Warn if there are queued messages"));
541 vbox_keys = gtkut_get_options_frame(vbox1, &frame_keys, _("Keyboard shortcuts"));
543 PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_can_change_accels,
544 _("Enable customisable keyboard shortcuts"));
546 CLAWS_SET_TIP(checkbtn_gtk_can_change_accels,
547 _("If checked, you can change the keyboard shortcuts of "
548 "most of the menu items by focusing on the menu "
549 "item and pressing a key combination.\n"
550 "Uncheck this option if you want to lock all "
551 "existing keyboard shortcuts."));
553 button_keybind = gtk_button_new_with_label(
554 _(" Choose preset keyboard shortcuts... "));
555 gtk_widget_show (button_keybind);
556 hbox1 = gtk_hbox_new (FALSE, 8);
557 gtk_widget_show (hbox1);
558 gtk_box_pack_start (GTK_BOX (vbox_keys), hbox1, FALSE, FALSE, 0);
559 gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0);
560 g_signal_connect (G_OBJECT (button_keybind), "clicked",
561 G_CALLBACK (prefs_keybind_select), NULL);
563 hbox1 = gtk_hbox_new (FALSE, 8);
564 gtk_widget_show (hbox1);
565 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
567 label_iotimeout = gtk_label_new (_("Socket I/O timeout"));
568 gtk_widget_show (label_iotimeout);
569 gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
571 spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 10);
572 spinbtn_iotimeout = gtk_spin_button_new
573 (GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0);
574 gtk_widget_show (spinbtn_iotimeout);
575 gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout,
577 gtk_widget_set_size_request (spinbtn_iotimeout, 64, -1);
578 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE);
580 label_iotimeout = gtk_label_new (_("seconds"));
581 gtk_widget_show (label_iotimeout);
582 gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
584 vbox2 = gtk_vbox_new (FALSE, 8);
585 gtk_widget_show (vbox2);
586 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
588 PACK_CHECK_BUTTON (vbox2, checkbtn_askonclean,
589 _("Ask before emptying trash"));
590 PACK_CHECK_BUTTON (vbox2, checkbtn_askonfilter,
591 _("Ask about account specific filtering rules when "
592 "filtering manually"));
593 shred_binary = g_find_program_in_path("shred");
595 PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
596 _("Use secure file deletion if possible"));
597 g_free(shred_binary);
599 PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
600 _("Use secure file deletion if possible\n"
601 "(the 'shred' program is not available)"));
602 gtk_widget_set_sensitive(checkbtn_use_shred, FALSE);
604 CLAWS_SET_TIP(checkbtn_use_shred,
605 _("Use the 'shred' program to overwrite files with random data before "
606 "deleting them. This slows down deletion. Be sure to "
607 "read shred's man page for caveats."));
608 PACK_CHECK_BUTTON (vbox2, checkbtn_real_time_sync,
609 _("Synchronise offline folders as soon as possible"));
611 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_addaddrbyclick),
612 prefs_common.add_address_by_click);
613 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_confonexit),
614 prefs_common.confirm_on_exit);
615 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_cleanonexit),
616 prefs_common.clean_on_exit);
617 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonclean),
618 prefs_common.ask_on_clean);
619 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_warnqueued),
620 prefs_common.warn_queued_on_exit);
621 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_can_change_accels),
622 prefs_common.gtk_can_change_accels);
624 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_iotimeout),
625 prefs_common.io_timeout_secs);
627 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonfilter),
628 prefs_common.ask_apply_per_account_filtering_rules);
629 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_shred),
630 prefs_common.use_shred);
631 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync),
632 prefs_common.real_time_sync);
634 prefs_other->checkbtn_addaddrbyclick = checkbtn_addaddrbyclick;
635 prefs_other->checkbtn_confonexit = checkbtn_confonexit;
636 prefs_other->checkbtn_cleanonexit = checkbtn_cleanonexit;
637 prefs_other->checkbtn_askonclean = checkbtn_askonclean;
638 prefs_other->checkbtn_warnqueued = checkbtn_warnqueued;
639 prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
640 prefs_other->checkbtn_gtk_can_change_accels = checkbtn_gtk_can_change_accels;
641 prefs_other->checkbtn_askonfilter = checkbtn_askonfilter;
642 prefs_other->checkbtn_use_shred = checkbtn_use_shred;
643 prefs_other->checkbtn_real_time_sync = checkbtn_real_time_sync;
645 prefs_other->page.widget = vbox1;
648 static void prefs_other_save(PrefsPage *_page)
650 OtherPage *page = (OtherPage *) _page;
651 gboolean gtk_can_change_accels;
654 prefs_common.add_address_by_click = gtk_toggle_button_get_active(
655 GTK_TOGGLE_BUTTON(page->checkbtn_addaddrbyclick));
656 prefs_common.confirm_on_exit = gtk_toggle_button_get_active(
657 GTK_TOGGLE_BUTTON(page->checkbtn_confonexit));
658 prefs_common.clean_on_exit = gtk_toggle_button_get_active(
659 GTK_TOGGLE_BUTTON(page->checkbtn_cleanonexit));
660 prefs_common.ask_on_clean = gtk_toggle_button_get_active(
661 GTK_TOGGLE_BUTTON(page->checkbtn_askonclean));
662 prefs_common.warn_queued_on_exit = gtk_toggle_button_get_active(
663 GTK_TOGGLE_BUTTON(page->checkbtn_warnqueued));
664 prefs_common.io_timeout_secs = gtk_spin_button_get_value_as_int(
665 GTK_SPIN_BUTTON(page->spinbtn_iotimeout));
666 sock_set_io_timeout(prefs_common.io_timeout_secs);
668 imap_main_set_timeout(prefs_common.io_timeout_secs);
670 prefs_common.ask_apply_per_account_filtering_rules =
671 gtk_toggle_button_get_active(
672 GTK_TOGGLE_BUTTON(page->checkbtn_askonfilter));
673 prefs_common.use_shred =
674 gtk_toggle_button_get_active(
675 GTK_TOGGLE_BUTTON(page->checkbtn_use_shred));
676 prefs_common.real_time_sync =
677 gtk_toggle_button_get_active(
678 GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync));
680 gtk_can_change_accels = gtk_toggle_button_get_active(
681 GTK_TOGGLE_BUTTON(page->checkbtn_gtk_can_change_accels));
683 if (prefs_common.gtk_can_change_accels != gtk_can_change_accels) {
685 prefs_common.gtk_can_change_accels = gtk_can_change_accels;
687 gtk_settings_set_long_property(gtk_settings_get_default(),
688 "gtk-can-change-accels",
689 (glong)prefs_common.gtk_can_change_accels,
692 /* gtk_can_change_accels value changed : we have (only if changed)
693 * to apply the gtk property to all widgets : */
694 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE);
698 static void prefs_other_destroy_widget(PrefsPage *_page)
702 OtherPage *prefs_other;
704 void prefs_other_init(void)
707 static gchar *path[2];
709 path[0] = _("Other");
712 page = g_new0(OtherPage, 1);
713 page->page.path = path;
714 page->page.create_widget = prefs_other_create_widget;
715 page->page.destroy_widget = prefs_other_destroy_widget;
716 page->page.save_page = prefs_other_save;
717 page->page.weight = 5.0;
718 prefs_gtk_register_page((PrefsPage *) page);
721 gtk_settings_set_long_property(gtk_settings_get_default(),
722 "gtk-can-change-accels",
723 (glong)prefs_common.gtk_can_change_accels,
727 void prefs_other_done(void)
729 prefs_gtk_unregister_page((PrefsPage *) prefs_other);