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"
40 #include "manage_window.h"
42 #include "imap-thread.h"
45 typedef struct _OtherPage
51 GtkWidget *checkbtn_addaddrbyclick;
52 GtkWidget *checkbtn_confonexit;
53 GtkWidget *checkbtn_cleanonexit;
54 GtkWidget *checkbtn_askonclean;
55 GtkWidget *checkbtn_warnqueued;
56 GtkWidget *spinbtn_iotimeout;
57 GtkWidget *checkbtn_gtk_can_change_accels;
58 GtkWidget *checkbtn_askonfilter;
59 GtkWidget *checkbtn_real_time_sync;
62 static struct KeybindDialog {
67 static void prefs_keybind_select (void);
68 static gint prefs_keybind_deleted (GtkWidget *widget,
71 static gboolean prefs_keybind_key_pressed (GtkWidget *widget,
74 static void prefs_keybind_cancel (void);
75 static void prefs_keybind_apply_clicked (GtkWidget *widget);
78 static void prefs_keybind_select(void)
85 GtkWidget *confirm_area;
87 GtkWidget *cancel_btn;
89 window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_other");
90 gtk_container_set_border_width (GTK_CONTAINER (window), 8);
91 gtk_window_set_title (GTK_WINDOW (window), _("Select key bindings"));
92 gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
93 gtk_window_set_modal (GTK_WINDOW (window), TRUE);
94 gtk_window_set_resizable(GTK_WINDOW (window), FALSE);
95 manage_window_set_transient (GTK_WINDOW (window));
97 vbox1 = gtk_vbox_new (FALSE, VSPACING);
98 gtk_container_add (GTK_CONTAINER (window), vbox1);
99 gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
101 hbox1 = gtk_hbox_new (FALSE, 8);
102 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
104 label = gtk_label_new
105 (_("Select preset:"));
106 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
107 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
109 combo = gtk_combo_new ();
110 gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
111 gtkut_combo_set_items (GTK_COMBO (combo),
117 gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO (combo)->entry), FALSE);
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)
201 GtkEntry *entry = GTK_ENTRY(GTK_COMBO(keybind.combo)->entry);
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_entry_get_text(entry);
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);
469 /* prefs_keybind_apply(empty_menurc, G_N_ELEMENTS(empty_menurc)); */
470 prefs_keybind_apply(menurc, n_menurc);
472 gtk_widget_destroy(keybind.window);
473 keybind.window = NULL;
474 keybind.combo = NULL;
477 static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
480 OtherPage *prefs_other = (OtherPage *) _page;
485 GtkWidget *frame_addr;
486 GtkWidget *vbox_addr;
487 GtkWidget *checkbtn_addaddrbyclick;
489 GtkWidget *frame_exit;
490 GtkWidget *vbox_exit;
491 GtkWidget *checkbtn_confonexit;
492 GtkWidget *checkbtn_cleanonexit;
493 GtkWidget *checkbtn_warnqueued;
495 GtkWidget *frame_keys;
496 GtkWidget *vbox_keys;
497 GtkWidget *checkbtn_gtk_can_change_accels;
498 GtkTooltips *gtk_can_change_accels_tooltip;
499 GtkWidget *button_keybind;
501 GtkWidget *label_iotimeout;
502 GtkWidget *spinbtn_iotimeout;
503 GtkObject *spinbtn_iotimeout_adj;
506 GtkWidget *checkbtn_askonclean;
507 GtkWidget *checkbtn_askonfilter;
508 GtkWidget *checkbtn_real_time_sync;
509 vbox1 = gtk_vbox_new (FALSE, VSPACING);
510 gtk_widget_show (vbox1);
511 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
513 vbox_addr = gtkut_get_options_frame(vbox1, &frame_addr, _("Address book"));
516 (vbox_addr, checkbtn_addaddrbyclick,
517 _("Add address to destination when double-clicked"));
520 vbox_exit = gtkut_get_options_frame(vbox1, &frame_exit, _("On exit"));
522 PACK_CHECK_BUTTON (vbox_exit, checkbtn_confonexit,
523 _("Confirm on exit"));
525 hbox1 = gtk_hbox_new (FALSE, 32);
526 gtk_widget_show (hbox1);
527 gtk_box_pack_start (GTK_BOX (vbox_exit), hbox1, FALSE, FALSE, 0);
529 PACK_CHECK_BUTTON (hbox1, checkbtn_cleanonexit,
530 _("Empty trash on exit"));
532 PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
533 _("Warn if there are queued messages"));
535 vbox_keys = gtkut_get_options_frame(vbox1, &frame_keys, _("Keyboard shortcuts"));
537 PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_can_change_accels,
538 _("Enable customisable menu shortcuts"));
539 gtk_can_change_accels_tooltip = gtk_tooltips_new();
540 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtk_can_change_accels_tooltip),
541 checkbtn_gtk_can_change_accels,
542 _("If checked, you can change the keyboard shortcuts of "
543 "most of the menu items by focusing on the menu "
544 "item and pressing a key combination.\n"
545 "Uncheck this option if you want to lock all "
546 "existing menu shortcuts."),
549 button_keybind = gtk_button_new_with_label (_(" Set key bindings... "));
550 gtk_widget_show (button_keybind);
551 hbox1 = gtk_hbox_new (FALSE, 8);
552 gtk_widget_show (hbox1);
553 gtk_box_pack_start (GTK_BOX (vbox_keys), hbox1, FALSE, FALSE, 0);
554 gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0);
555 g_signal_connect (G_OBJECT (button_keybind), "clicked",
556 G_CALLBACK (prefs_keybind_select), NULL);
558 hbox1 = gtk_hbox_new (FALSE, 8);
559 gtk_widget_show (hbox1);
560 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
562 label_iotimeout = gtk_label_new (_("Socket I/O timeout"));
563 gtk_widget_show (label_iotimeout);
564 gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
566 spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 10);
567 spinbtn_iotimeout = gtk_spin_button_new
568 (GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0);
569 gtk_widget_show (spinbtn_iotimeout);
570 gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout,
572 gtk_widget_set_size_request (spinbtn_iotimeout, 64, -1);
573 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE);
575 label_iotimeout = gtk_label_new (_("seconds"));
576 gtk_widget_show (label_iotimeout);
577 gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
579 vbox2 = gtk_vbox_new (FALSE, 8);
580 gtk_widget_show (vbox2);
581 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
583 PACK_CHECK_BUTTON (vbox2, checkbtn_askonclean,
584 _("Ask before emptying trash"));
585 PACK_CHECK_BUTTON (vbox2, checkbtn_askonfilter,
586 _("Ask about account specific filtering rules when "
587 "filtering manually"));
588 PACK_CHECK_BUTTON (vbox2, checkbtn_real_time_sync,
589 _("Synchronise offline folders as soon as possible"));
591 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_addaddrbyclick),
592 prefs_common.add_address_by_click);
593 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_confonexit),
594 prefs_common.confirm_on_exit);
595 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_cleanonexit),
596 prefs_common.clean_on_exit);
597 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonclean),
598 prefs_common.ask_on_clean);
599 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_warnqueued),
600 prefs_common.warn_queued_on_exit);
601 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_can_change_accels),
602 prefs_common.gtk_can_change_accels);
604 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_iotimeout),
605 prefs_common.io_timeout_secs);
607 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonfilter),
608 prefs_common.ask_apply_per_account_filtering_rules);
609 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync),
610 prefs_common.real_time_sync);
612 prefs_other->checkbtn_addaddrbyclick = checkbtn_addaddrbyclick;
613 prefs_other->checkbtn_confonexit = checkbtn_confonexit;
614 prefs_other->checkbtn_cleanonexit = checkbtn_cleanonexit;
615 prefs_other->checkbtn_askonclean = checkbtn_askonclean;
616 prefs_other->checkbtn_warnqueued = checkbtn_warnqueued;
617 prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
618 prefs_other->checkbtn_gtk_can_change_accels = checkbtn_gtk_can_change_accels;
619 prefs_other->checkbtn_askonfilter = checkbtn_askonfilter;
620 prefs_other->checkbtn_real_time_sync = checkbtn_real_time_sync;
622 prefs_other->page.widget = vbox1;
625 static void prefs_other_save(PrefsPage *_page)
627 OtherPage *page = (OtherPage *) _page;
628 gboolean gtk_can_change_accels;
630 prefs_common.add_address_by_click = gtk_toggle_button_get_active(
631 GTK_TOGGLE_BUTTON(page->checkbtn_addaddrbyclick));
632 prefs_common.confirm_on_exit = gtk_toggle_button_get_active(
633 GTK_TOGGLE_BUTTON(page->checkbtn_confonexit));
634 prefs_common.clean_on_exit = gtk_toggle_button_get_active(
635 GTK_TOGGLE_BUTTON(page->checkbtn_cleanonexit));
636 prefs_common.ask_on_clean = gtk_toggle_button_get_active(
637 GTK_TOGGLE_BUTTON(page->checkbtn_askonclean));
638 prefs_common.warn_queued_on_exit = gtk_toggle_button_get_active(
639 GTK_TOGGLE_BUTTON(page->checkbtn_warnqueued));
640 prefs_common.io_timeout_secs = gtk_spin_button_get_value_as_int(
641 GTK_SPIN_BUTTON(page->spinbtn_iotimeout));
642 sock_set_io_timeout(prefs_common.io_timeout_secs);
644 imap_main_set_timeout(prefs_common.io_timeout_secs);
646 prefs_common.ask_apply_per_account_filtering_rules =
647 gtk_toggle_button_get_active(
648 GTK_TOGGLE_BUTTON(page->checkbtn_askonfilter));
649 prefs_common.real_time_sync =
650 gtk_toggle_button_get_active(
651 GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync));
653 gtk_can_change_accels = gtk_toggle_button_get_active(
654 GTK_TOGGLE_BUTTON(page->checkbtn_gtk_can_change_accels));
656 if (prefs_common.gtk_can_change_accels != gtk_can_change_accels) {
658 prefs_common.gtk_can_change_accels = gtk_can_change_accels;
660 gtk_settings_set_long_property(gtk_settings_get_default(),
661 "gtk-can-change-accels",
662 (glong)prefs_common.gtk_can_change_accels,
665 /* gtk_can_change_accels value changed : we have (only if changed)
666 * to apply the gtk property to all widgets : */
667 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE);
671 static void prefs_other_destroy_widget(PrefsPage *_page)
675 OtherPage *prefs_other;
677 void prefs_other_init(void)
680 static gchar *path[2];
682 path[0] = _("Other");
685 page = g_new0(OtherPage, 1);
686 page->page.path = path;
687 page->page.create_widget = prefs_other_create_widget;
688 page->page.destroy_widget = prefs_other_destroy_widget;
689 page->page.save_page = prefs_other_save;
690 page->page.weight = 5.0;
691 prefs_gtk_register_page((PrefsPage *) page);
694 gtk_settings_set_long_property(gtk_settings_get_default(),
695 "gtk-can-change-accels",
696 (glong)prefs_common.gtk_can_change_accels,
700 void prefs_other_done(void)
702 prefs_gtk_unregister_page((PrefsPage *) prefs_other);