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 2 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, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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 *checkbtn_cliplog;
57 GtkWidget *spinbtn_loglength;
58 GtkWidget *spinbtn_iotimeout;
59 GtkWidget *chkbtn_never_send_retrcpt;
60 GtkWidget *chkbtn_gtk_can_change_accels;
63 static struct KeybindDialog {
68 static void prefs_keybind_select (void);
69 static gint prefs_keybind_deleted (GtkWidget *widget,
72 static gboolean prefs_keybind_key_pressed (GtkWidget *widget,
75 static void prefs_keybind_cancel (void);
76 static void prefs_keybind_apply_clicked (GtkWidget *widget);
79 static void prefs_keybind_select(void)
86 GtkWidget *confirm_area;
88 GtkWidget *cancel_btn;
90 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
91 gtk_container_set_border_width (GTK_CONTAINER (window), 8);
92 gtk_window_set_title (GTK_WINDOW (window), _("Select key bindings"));
93 gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
94 gtk_window_set_modal (GTK_WINDOW (window), TRUE);
95 gtk_window_set_resizable(GTK_WINDOW (window), FALSE);
96 manage_window_set_transient (GTK_WINDOW (window));
98 vbox1 = gtk_vbox_new (FALSE, VSPACING);
99 gtk_container_add (GTK_CONTAINER (window), vbox1);
100 gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
102 hbox1 = gtk_hbox_new (FALSE, 8);
103 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
105 label = gtk_label_new
106 (_("Select preset:"));
107 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
108 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
110 combo = gtk_combo_new ();
111 gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
112 gtkut_combo_set_items (GTK_COMBO (combo),
118 gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO (combo)->entry), FALSE);
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)
202 GtkEntry *entry = GTK_ENTRY(GTK_COMBO(keybind.combo)->entry);
204 struct KeyBind *menurc;
207 static struct KeyBind default_menurc[] = {
208 {"<Main>/File/Empty all Trash folders", "<shift>D"},
209 {"<Main>/File/Save as...", "<control>S"},
210 {"<Main>/File/Print...", "<control>P"},
211 {"<Main>/File/Work offline", "<control>W"},
212 {"<Main>/File/Synchronise folders", "<control><shift>S"},
213 {"<Main>/File/Exit", "<control>Q"},
215 {"<Main>/Edit/Copy", "<control>C"},
216 {"<Main>/Edit/Select all", "<control>A"},
217 {"<Main>/Edit/Find in current message...", "<control>F"},
218 {"<Main>/Edit/Search folder...", "<shift><control>F"},
219 {"<Main>/Edit/Quick search", "slash"},
221 {"<Main>/View/Show or hide/Message View", "V"},
222 {"<Main>/View/Thread view", "<control>T"},
223 {"<Main>/View/Go to/Previous message", "P"},
224 {"<Main>/View/Go to/Next message", "N"},
225 {"<Main>/View/Go to/Previous unread message", "<shift>P"},
226 {"<Main>/View/Go to/Next unread message", "<shift>N"},
227 {"<Main>/View/Go to/Other folder...", "G"},
228 {"<Main>/View/Open in new window", "<control><alt>N"},
229 {"<Main>/View/Message source", "<control>U"},
230 {"<Main>/View/All headers", "<control>H"},
231 {"<Main>/View/Update summary", "<control><alt>U"},
233 {"<Main>/Message/Receive/Get from current account",
235 {"<Main>/Message/Receive/Get from all accounts","<shift><control>I"},
236 {"<Main>/Message/Compose an email message", "<control>M"},
237 {"<Main>/Message/Reply", "<control>R"},
238 {"<Main>/Message/Reply to/all", "<shift><control>R"},
239 {"<Main>/Message/Reply to/sender", ""},
240 {"<Main>/Message/Reply to/mailing list", "<control>L"},
241 {"<Main>/Message/Forward", "<control><alt>F"},
242 /* {"<Main>/Message/Forward as attachment", ""}, */
243 {"<Main>/Message/Move...", "<control>O"},
244 {"<Main>/Message/Copy...", "<shift><control>O"},
245 {"<Main>/Message/Move to trash", "<control>D"},
246 {"<Main>/Message/Mark/Mark", "<shift>asterisk"},
247 {"<Main>/Message/Mark/Unmark", "U"},
248 {"<Main>/Message/Mark/Mark as unread", "<shift>exclam"},
249 {"<Main>/Message/Mark/Mark as read", ""},
251 {"<Main>/Tools/Address book", "<shift><control>A"},
252 {"<Main>/Tools/Execute", "X"},
253 {"<Main>/Tools/Log window", "<shift><control>L"},
255 {"<Compose>/Message/Send", "<control>Return"},
256 {"<Compose>/Message/Send later", "<shift><control>S"},
257 {"<Compose>/Message/Attach file", "<control>M"},
258 {"<Compose>/Message/Insert file", "<control>I"},
259 {"<Compose>/Message/Insert signature", "<control>G"},
260 {"<Compose>/Message/Save", "<control>S"},
261 {"<Compose>/Message/Close", "<control>W"},
262 {"<Compose>/Edit/Undo", "<control>Z"},
263 {"<Compose>/Edit/Redo", "<control>Y"},
264 {"<Compose>/Edit/Cut", "<control>X"},
265 {"<Compose>/Edit/Copy", "<control>C"},
266 {"<Compose>/Edit/Paste", "<control>V"},
267 {"<Compose>/Edit/Select all", "<control>A"},
268 {"<Compose>/Edit/Advanced/Move a character backward", "<control>B"},
269 {"<Compose>/Edit/Advanced/Move a character forward", "<control>F"},
270 {"<Compose>/Edit/Advanced/Move a word backward," ""},
271 {"<Compose>/Edit/Advanced/Move a word forward", ""},
272 {"<Compose>/Edit/Advanced/Move to beginning of line", ""},
273 {"<Compose>/Edit/Advanced/Move to end of line", "<control>E"},
274 {"<Compose>/Edit/Advanced/Move to previous line", "<control>P"},
275 {"<Compose>/Edit/Advanced/Move to next line", "<control>N"},
276 {"<Compose>/Edit/Advanced/Delete a character backward", "<control>H"},
277 {"<Compose>/Edit/Advanced/Delete a character forward", "<control>D"},
278 {"<Compose>/Edit/Advanced/Delete a word backward", ""},
279 {"<Compose>/Edit/Advanced/Delete a word forward", ""},
280 {"<Compose>/Edit/Advanced/Delete line", "<control>U"},
281 {"<Compose>/Edit/Advanced/Delete entire line", ""},
282 {"<Compose>/Edit/Advanced/Delete to end of line", "<control>K"},
283 {"<Compose>/Edit/Wrap current paragraph", "<control>L"},
284 {"<Compose>/Edit/Wrap all long lines", "<control><alt>L"},
285 {"<Compose>/Edit/Auto wrapping", "<shift><control>L"},
286 {"<Compose>/Edit/Edit with external editor", "<shift><control>X"},
287 {"<Compose>/Tools/Address book", "<shift><control>A"},
290 static struct KeyBind mew_wl_menurc[] = {
291 {"<Main>/File/Empty all Trash folders", "<shift>D"},
292 {"<Main>/File/Save as...", "Y"},
293 {"<Main>/File/Print...", "<shift>numbersign"},
294 {"<Main>/File/Exit", "<shift>Q"},
296 {"<Main>/Edit/Copy", "<control>C"},
297 {"<Main>/Edit/Select all", "<control>A"},
298 {"<Main>/Edit/Find in current message...", "<control>F"},
299 {"<Main>/Edit/Search folder...", "<control>S"},
301 {"<Main>/View/Show or hide/Message View", ""},
302 {"<Main>/View/Thread view", "<shift>T"},
303 {"<Main>/View/Go to/Previous message", "P"},
304 {"<Main>/View/Go to/Next message", "N"},
305 {"<Main>/View/Go to/Previous unread message", "<shift>P"},
306 {"<Main>/View/Go to/Next unread message", "<shift>N"},
307 {"<Main>/View/Go to/Other folder...", "G"},
308 {"<Main>/View/Open in new window", "<control><alt>N"},
309 {"<Main>/View/Message source", "<control>U"},
310 {"<Main>/View/All headers", "<shift>H"},
311 {"<Main>/View/Update summary", "<shift>S"},
313 {"<Main>/Message/Receive/Get from current account",
315 {"<Main>/Message/Receive/Get from all accounts","<shift><control>I"},
316 {"<Main>/Message/Compose an email message", "W"},
317 {"<Main>/Message/Reply", "<control>R"},
318 {"<Main>/Message/Reply to/all", "<shift>A"},
319 {"<Main>/Message/Reply to/sender", ""},
320 {"<Main>/Message/Reply to/mailing list", "<control>L"},
321 {"<Main>/Message/Forward", "F"},
322 /* {"<Main>/Message/Forward as attachment", "<shift>F"}, */
323 {"<Main>/Message/Move...", "O"},
324 {"<Main>/Message/Copy...", "<shift>O"},
325 {"<Main>/Message/Delete", "D"},
326 {"<Main>/Message/Mark/Mark", "<shift>asterisk"},
327 {"<Main>/Message/Mark/Unmark", "U"},
328 {"<Main>/Message/Mark/Mark as unread", "<shift>exclam"},
329 {"<Main>/Message/Mark/Mark as read", "<shift>R"},
331 {"<Main>/Tools/Address book", "<shift><control>A"},
332 {"<Main>/Tools/Execute", "X"},
333 {"<Main>/Tools/Log window", "<shift><control>L"},
335 {"<Compose>/Message/Close", "<alt>W"},
336 {"<Compose>/Edit/Select all", ""},
337 {"<Compose>/Edit/Advanced/Move a word backward," "<alt>B"},
338 {"<Compose>/Edit/Advanced/Move a word forward", "<alt>F"},
339 {"<Compose>/Edit/Advanced/Move to beginning of line", "<control>A"},
340 {"<Compose>/Edit/Advanced/Delete a word backward", "<control>W"},
341 {"<Compose>/Edit/Advanced/Delete a word forward", "<alt>D"},
344 static struct KeyBind mutt_menurc[] = {
345 {"<Main>/File/Empty all Trash folders", ""},
346 {"<Main>/File/Save as...", "S"},
347 {"<Main>/File/Print...", "P"},
348 {"<Main>/File/Exit", "Q"},
350 {"<Main>/Edit/Copy", "<control>C"},
351 {"<Main>/Edit/Select all", "<control>A"},
352 {"<Main>/Edit/Find in current message...", "<control>F"},
353 {"<Main>/Edit/Search messages...", "slash"},
355 {"<Main>/View/Show or hide/Message view", "V"},
356 {"<Main>/View/Thread view", "<control>T"},
357 {"<Main>/View/Go to/Previous message", ""},
358 {"<Main>/View/Go to/Next message", ""},
359 {"<Main>/View/Go to/Previous unread message", ""},
360 {"<Main>/View/Go to/Next unread message", ""},
361 {"<Main>/View/Go to/Other folder...", "C"},
362 {"<Main>/View/Open in new window", "<control><alt>N"},
363 {"<Main>/View/Message source", "<control>U"},
364 {"<Main>/View/All headers", "<control>H"},
365 {"<Main>/View/Update summary", "<control><alt>U"},
367 {"<Main>/Message/Receive/Get from current account",
369 {"<Main>/Message/Receive/Get from all accounts","<shift><control>I"},
370 {"<Main>/Message/Compose an email message", "M"},
371 {"<Main>/Message/Reply", "R"},
372 {"<Main>/Message/Reply to/all", "G"},
373 {"<Main>/Message/Reply to/sender", ""},
374 {"<Main>/Message/Reply to/mailing list", "<control>L"},
375 {"<Main>/Message/Forward", "F"},
376 {"<Main>/Message/Forward as attachment", ""},
377 {"<Main>/Message/Move...", "<control>O"},
378 {"<Main>/Message/Copy...", "<shift>C"},
379 {"<Main>/Message/Delete", "D"},
380 {"<Main>/Message/Mark/Mark", "<shift>F"},
381 {"<Main>/Message/Mark/Unmark", "U"},
382 {"<Main>/Message/Mark/Mark as unread", "<shift>N"},
383 {"<Main>/Message/Mark/Mark as read", ""},
385 {"<Main>/Tools/Address book", "<shift><control>A"},
386 {"<Main>/Tools/Execute", "X"},
387 {"<Main>/Tools/Log window", "<shift><control>L"},
389 {"<Compose>/Message/Close", "<alt>W"},
390 {"<Compose>/Edit/Select all", ""},
391 {"<Compose>/Edit/Advanced/Move a word backward", "<alt>B"},
392 {"<Compose>/Edit/Advanced/Move a word forward", "<alt>F"},
393 {"<Compose>/Edit/Advanced/Move to beginning of line", "<control>A"},
394 {"<Compose>/Edit/Advanced/Delete a word backward", "<control>W"},
395 {"<Compose>/Edit/Advanced/Delete a word forward", "<alt>D"},
398 static struct KeyBind old_sylpheed_menurc[] = {
399 {"<Main>/File/Empty all Trash folders", ""},
400 {"<Main>/File/Save as...", ""},
401 {"<Main>/File/Print...", "<alt>P"},
402 {"<Main>/File/Exit", "<alt>Q"},
404 {"<Main>/Edit/Copy", "<control>C"},
405 {"<Main>/Edit/Select all", "<control>A"},
406 {"<Main>/Edit/Find in current message...", "<control>F"},
407 {"<Main>/Edit/Search folder...", "<control>S"},
409 {"<Main>/View/Show or hide/Message View", ""},
410 {"<Main>/View/Thread view", "<control>T"},
411 {"<Main>/View/Go to/Previous message", "P"},
412 {"<Main>/View/Go to/Next message", "N"},
413 {"<Main>/View/Go to/Previous unread message", "<shift>P"},
414 {"<Main>/View/Go to/Next unread message", "<shift>N"},
415 {"<Main>/View/Go to/Other folder...", "<alt>G"},
416 {"<Main>/View/Open in new window", "<shift><control>N"},
417 {"<Main>/View/Message source", "<control>U"},
418 {"<Main>/View/All headers", "<control>H"},
419 {"<Main>/View/Update summary", "<alt>U"},
421 {"<Main>/Message/Receive/Get from current account",
423 {"<Main>/Message/Receive/Get from all accounts","<shift><alt>I"},
424 {"<Main>/Message/Compose an email message", "<alt>N"},
425 {"<Main>/Message/Reply", "<alt>R"},
426 {"<Main>/Message/Reply to/all", "<shift><alt>R"},
427 {"<Main>/Message/Reply to/sender", "<control><alt>R"},
428 {"<Main>/Message/Reply to/mailing list", "<control>L"},
429 {"<Main>/Message/Forward", "<shift><alt>F"},
430 /* "(menu-path \"<Main>/Message/Forward as attachment", "<shift><control>F"}, */
431 {"<Main>/Message/Move...", "<alt>O"},
432 {"<Main>/Message/Copy...", ""},
433 {"<Main>/Message/Delete", "<alt>D"},
434 {"<Main>/Message/Mark/Mark", "<shift>asterisk"},
435 {"<Main>/Message/Mark/Unmark", "U"},
436 {"<Main>/Message/Mark/Mark as unread", "<shift>exclam"},
437 {"<Main>/Message/Mark/Mark as read", ""},
439 {"<Main>/Tools/Address book", "<alt>A"},
440 {"<Main>/Tools/Execute", "<alt>X"},
441 {"<Main>/Tools/Log window", "<alt>L"},
443 {"<Compose>/Message/Close", "<alt>W"},
444 {"<Compose>/Edit/Select all", ""},
445 {"<Compose>/Edit/Advanced/Move a word backward", "<alt>B"},
446 {"<Compose>/Edit/Advanced/Move a word forward", "<alt>F"},
447 {"<Compose>/Edit/Advanced/Move to beginning of line", "<control>A"},
448 {"<Compose>/Edit/Advanced/Delete a word backward", "<control>W"},
449 {"<Compose>/Edit/Advanced/Delete a word forward", "<alt>D"},
452 text = gtk_entry_get_text(entry);
454 if (!strcmp(text, _("Default"))) {
455 menurc = default_menurc;
456 n_menurc = G_N_ELEMENTS(default_menurc);
457 } else if (!strcmp(text, "Mew / Wanderlust")) {
458 menurc = mew_wl_menurc;
459 n_menurc = G_N_ELEMENTS(mew_wl_menurc);
460 } else if (!strcmp(text, "Mutt")) {
461 menurc = mutt_menurc;
462 n_menurc = G_N_ELEMENTS(mutt_menurc);
463 } else if (!strcmp(text, _("Old Sylpheed"))) {
464 menurc = old_sylpheed_menurc;
465 n_menurc = G_N_ELEMENTS(old_sylpheed_menurc);
470 /* prefs_keybind_apply(empty_menurc, G_N_ELEMENTS(empty_menurc)); */
471 prefs_keybind_apply(menurc, n_menurc);
473 gtk_widget_destroy(keybind.window);
474 keybind.window = NULL;
475 keybind.combo = NULL;
478 static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
481 OtherPage *prefs_other = (OtherPage *) _page;
486 GtkWidget *frame_addr;
487 GtkWidget *vbox_addr;
488 GtkWidget *checkbtn_addaddrbyclick;
490 GtkWidget *frame_cliplog;
491 GtkWidget *vbox_cliplog;
492 GtkWidget *hbox_cliplog;
493 GtkWidget *checkbtn_cliplog;
494 GtkWidget *loglength_label;
495 GtkWidget *spinbtn_loglength;
496 GtkObject *spinbtn_loglength_adj;
497 GtkTooltips *loglength_tooltip;
500 GtkWidget *frame_exit;
501 GtkWidget *vbox_exit;
502 GtkWidget *checkbtn_confonexit;
503 GtkWidget *checkbtn_cleanonexit;
504 GtkWidget *checkbtn_askonclean;
505 GtkWidget *checkbtn_warnqueued;
507 GtkWidget *frame_keys;
508 GtkWidget *vbox_keys;
509 GtkWidget *chkbtn_gtk_can_change_accels;
510 GtkTooltips *gtk_can_change_accels_tooltip;
511 GtkWidget *button_keybind;
513 GtkWidget *label_iotimeout;
514 GtkWidget *spinbtn_iotimeout;
515 GtkObject *spinbtn_iotimeout_adj;
517 GtkWidget *chkbtn_never_send_retrcpt;
519 vbox1 = gtk_vbox_new (FALSE, VSPACING);
520 gtk_widget_show (vbox1);
521 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
523 vbox_addr = gtkut_get_options_frame(vbox1, &frame_addr, _("Address book"));
526 (vbox_addr, checkbtn_addaddrbyclick,
527 _("Add address to destination when double-clicked"));
530 vbox_cliplog = gtkut_get_options_frame(vbox1, &frame_cliplog, _("Log Size"));
532 PACK_CHECK_BUTTON (vbox_cliplog, checkbtn_cliplog,
533 _("Clip the log size"));
534 hbox_cliplog = gtk_hbox_new (FALSE, 8);
535 gtk_container_add (GTK_CONTAINER (vbox_cliplog), hbox_cliplog);
536 gtk_widget_show (hbox_cliplog);
538 loglength_label = gtk_label_new (_("Log window length"));
539 gtk_box_pack_start (GTK_BOX (hbox_cliplog), loglength_label,
541 gtk_widget_show (GTK_WIDGET (loglength_label));
543 loglength_tooltip = gtk_tooltips_new();
545 spinbtn_loglength_adj = gtk_adjustment_new (500, 0, G_MAXINT, 1, 10, 10);
546 spinbtn_loglength = gtk_spin_button_new
547 (GTK_ADJUSTMENT (spinbtn_loglength_adj), 1, 0);
548 gtk_widget_show (spinbtn_loglength);
549 gtk_box_pack_start (GTK_BOX (hbox_cliplog), spinbtn_loglength,
551 gtk_widget_set_size_request (GTK_WIDGET (spinbtn_loglength), 64, -1);
552 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_loglength), TRUE);
554 gtk_tooltips_set_tip(GTK_TOOLTIPS(loglength_tooltip), spinbtn_loglength,
555 _("0 to stop logging in the log window"),
558 label = gtk_label_new(_("lines"));
559 gtk_widget_show (label);
560 gtk_box_pack_start(GTK_BOX(hbox_cliplog), label, FALSE, FALSE, 0);
562 SET_TOGGLE_SENSITIVITY(checkbtn_cliplog, loglength_label);
563 SET_TOGGLE_SENSITIVITY(checkbtn_cliplog, spinbtn_loglength);
564 SET_TOGGLE_SENSITIVITY(checkbtn_cliplog, label);
567 vbox_exit = gtkut_get_options_frame(vbox1, &frame_exit, _("On exit"));
569 PACK_CHECK_BUTTON (vbox_exit, checkbtn_confonexit,
570 _("Confirm on exit"));
572 hbox1 = gtk_hbox_new (FALSE, 32);
573 gtk_widget_show (hbox1);
574 gtk_box_pack_start (GTK_BOX (vbox_exit), hbox1, FALSE, FALSE, 0);
576 PACK_CHECK_BUTTON (hbox1, checkbtn_cleanonexit,
577 _("Empty trash on exit"));
578 PACK_CHECK_BUTTON (hbox1, checkbtn_askonclean,
579 _("Ask before emptying"));
580 SET_TOGGLE_SENSITIVITY (checkbtn_cleanonexit, checkbtn_askonclean);
582 PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
583 _("Warn if there are queued messages"));
585 vbox_keys = gtkut_get_options_frame(vbox1, &frame_keys, _("Keyboard shortcuts"));
587 PACK_CHECK_BUTTON(vbox_keys, chkbtn_gtk_can_change_accels,
588 _("Enable customisable menu shortcuts"));
589 gtk_can_change_accels_tooltip = gtk_tooltips_new();
590 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtk_can_change_accels_tooltip),
591 chkbtn_gtk_can_change_accels,
592 _("If checked, you can change the keyboard shortcuts of "
593 "most of the menu items by focusing on the menu "
594 "item and pressing a key combination.\n"
595 "Uncheck this option if you want to lock all "
596 "existing menu shortcuts."),
599 button_keybind = gtk_button_new_with_label (_(" Set key bindings... "));
600 gtk_widget_show (button_keybind);
601 hbox1 = gtk_hbox_new (FALSE, 8);
602 gtk_widget_show (hbox1);
603 gtk_box_pack_start (GTK_BOX (vbox_keys), hbox1, FALSE, FALSE, 0);
604 gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0);
605 g_signal_connect (G_OBJECT (button_keybind), "clicked",
606 G_CALLBACK (prefs_keybind_select), NULL);
608 hbox1 = gtk_hbox_new (FALSE, 8);
609 gtk_widget_show (hbox1);
610 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
612 label_iotimeout = gtk_label_new (_("Socket I/O timeout"));
613 gtk_widget_show (label_iotimeout);
614 gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
616 spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 10);
617 spinbtn_iotimeout = gtk_spin_button_new
618 (GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0);
619 gtk_widget_show (spinbtn_iotimeout);
620 gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout,
622 gtk_widget_set_size_request (spinbtn_iotimeout, 64, -1);
623 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE);
625 label_iotimeout = gtk_label_new (_("seconds"));
626 gtk_widget_show (label_iotimeout);
627 gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
629 PACK_CHECK_BUTTON(vbox1, chkbtn_never_send_retrcpt,
630 _("Never send Return Receipts"));
632 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_addaddrbyclick),
633 prefs_common.add_address_by_click);
634 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_confonexit),
635 prefs_common.confirm_on_exit);
636 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_cleanonexit),
637 prefs_common.clean_on_exit);
638 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonclean),
639 prefs_common.ask_on_clean);
640 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_warnqueued),
641 prefs_common.warn_queued_on_exit);
642 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_cliplog),
643 prefs_common.cliplog);
644 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chkbtn_never_send_retrcpt),
645 prefs_common.never_send_retrcpt);
646 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chkbtn_gtk_can_change_accels),
647 prefs_common.gtk_can_change_accels);
649 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_loglength),
650 prefs_common.loglength);
651 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_iotimeout),
652 prefs_common.io_timeout_secs);
654 prefs_other->checkbtn_addaddrbyclick = checkbtn_addaddrbyclick;
655 prefs_other->checkbtn_confonexit = checkbtn_confonexit;
656 prefs_other->checkbtn_cleanonexit = checkbtn_cleanonexit;
657 prefs_other->checkbtn_askonclean = checkbtn_askonclean;
658 prefs_other->checkbtn_warnqueued = checkbtn_warnqueued;
659 prefs_other->checkbtn_cliplog = checkbtn_cliplog;
660 prefs_other->spinbtn_loglength = spinbtn_loglength;
661 prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
662 prefs_other->chkbtn_never_send_retrcpt = chkbtn_never_send_retrcpt;
663 prefs_other->chkbtn_gtk_can_change_accels = chkbtn_gtk_can_change_accels;
665 prefs_other->page.widget = vbox1;
668 static void prefs_other_save(PrefsPage *_page)
670 OtherPage *page = (OtherPage *) _page;
671 MainWindow *mainwindow;
672 gboolean gtk_can_change_accels;
674 prefs_common.add_address_by_click = gtk_toggle_button_get_active(
675 GTK_TOGGLE_BUTTON(page->checkbtn_addaddrbyclick));
676 prefs_common.confirm_on_exit = gtk_toggle_button_get_active(
677 GTK_TOGGLE_BUTTON(page->checkbtn_confonexit));
678 prefs_common.clean_on_exit = gtk_toggle_button_get_active(
679 GTK_TOGGLE_BUTTON(page->checkbtn_cleanonexit));
680 prefs_common.ask_on_clean = gtk_toggle_button_get_active(
681 GTK_TOGGLE_BUTTON(page->checkbtn_askonclean));
682 prefs_common.warn_queued_on_exit = gtk_toggle_button_get_active(
683 GTK_TOGGLE_BUTTON(page->checkbtn_warnqueued));
684 prefs_common.cliplog = gtk_toggle_button_get_active(
685 GTK_TOGGLE_BUTTON(page->checkbtn_cliplog));
686 prefs_common.loglength = gtk_spin_button_get_value_as_int(
687 GTK_SPIN_BUTTON(page->spinbtn_loglength));
688 prefs_common.io_timeout_secs = gtk_spin_button_get_value_as_int(
689 GTK_SPIN_BUTTON(page->spinbtn_iotimeout));
690 sock_set_io_timeout(prefs_common.io_timeout_secs);
692 imap_main_set_timeout(prefs_common.io_timeout_secs);
694 prefs_common.never_send_retrcpt = gtk_toggle_button_get_active(
695 GTK_TOGGLE_BUTTON(page->chkbtn_never_send_retrcpt));
697 mainwindow = mainwindow_get_mainwindow();
698 log_window_set_clipping(mainwindow->logwin, prefs_common.cliplog,
699 prefs_common.loglength);
701 gtk_can_change_accels = gtk_toggle_button_get_active(
702 GTK_TOGGLE_BUTTON(page->chkbtn_gtk_can_change_accels));
704 if (prefs_common.gtk_can_change_accels != gtk_can_change_accels) {
706 prefs_common.gtk_can_change_accels = gtk_can_change_accels;
708 gtk_settings_set_long_property(gtk_settings_get_default(),
709 "gtk-can-change-accels",
710 (glong)prefs_common.gtk_can_change_accels,
713 /* gtk_can_change_accels value changed : we have (only if changed)
714 * to apply the gtk property to all widgets : */
715 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE);
719 static void prefs_other_destroy_widget(PrefsPage *_page)
723 OtherPage *prefs_other;
725 void prefs_other_init(void)
728 static gchar *path[2];
730 path[0] = _("Other");
733 page = g_new0(OtherPage, 1);
734 page->page.path = path;
735 page->page.create_widget = prefs_other_create_widget;
736 page->page.destroy_widget = prefs_other_destroy_widget;
737 page->page.save_page = prefs_other_save;
738 page->page.weight = 5.0;
739 prefs_gtk_register_page((PrefsPage *) page);
742 gtk_settings_set_long_property(gtk_settings_get_default(),
743 "gtk-can-change-accels",
744 (glong)prefs_common.gtk_can_change_accels,
748 void prefs_other_done(void)
750 prefs_gtk_unregister_page((PrefsPage *) prefs_other);