talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

prefs_other.c (19473B)


      1 /*
      2  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
      3  * Copyright (C) 2005-2025 the Claws Mail team and Colin Leroy
      4  *
      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.
      9  *
     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.
     14  *
     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/>.
     17  */
     18 
     19 #include "defs.h"
     20 
     21 #include <stdio.h>
     22 #include <stdlib.h>
     23 
     24 #include <glib.h>
     25 #include <glib/gi18n.h>
     26 #include <gtk/gtk.h>
     27 #include <gdk/gdkkeysyms.h>
     28 
     29 #include "prefs_common.h"
     30 #include "prefs_gtk.h"
     31 
     32 #include "gtk/gtkutils.h"
     33 #include "gtk/manage_window.h"
     34 #include "gtk/prefswindow.h"
     35 #include "combobox.h"
     36 
     37 #include "etpan/imap-thread.h"
     38 
     39 #include "common/file-utils.h"
     40 
     41 typedef struct _OtherPage
     42 {
     43 	PrefsPage page;
     44 
     45 	GtkWidget *window;
     46 
     47 	GtkWidget *keys_preset_combo;
     48 	GtkWidget *keys_preset_hbox;
     49 	GtkWidget *checkbtn_askonclean;
     50 	GtkWidget *checkbtn_warnqueued;
     51 	GtkWidget *spinbtn_iotimeout;
     52 	GtkWidget *checkbtn_gtk_enable_accels;
     53 	GtkWidget *checkbtn_real_time_sync;
     54 } OtherPage;
     55 
     56 struct KeyBind {
     57 	const gchar *accel_path;
     58 	const gchar *accel_key;
     59 };
     60 
     61 static void prefs_keybind_apply(struct KeyBind keybind[], gint num)
     62 {
     63 	gint i;
     64 	guint key;
     65 	GdkModifierType mods;
     66 
     67 	for (i = 0; i < num; i++) {
     68 		const gchar *accel_key
     69 			= keybind[i].accel_key ? keybind[i].accel_key : "";
     70 		gtk_accelerator_parse(accel_key, &key, &mods);
     71 		if (key == 0 && mods == 0) {
     72 			g_message("Failed parsing accelerator '%s' for path '%s'\n",
     73 				  accel_key, keybind[i].accel_path);
     74 		}
     75 		gtk_accel_map_change_entry(keybind[i].accel_path,
     76 					   key, mods, TRUE);
     77 	}
     78 }
     79 
     80 static void prefs_keybind_preset_changed(GtkComboBox *widget)
     81 {
     82 	gchar *text;
     83 	struct KeyBind *menurc;
     84 	gint n_menurc;
     85 
     86 	/* make sure to keep the table below in sync with the ones in mainwindow.c, messageview.c */
     87 	static struct KeyBind default_menurc[] = {
     88 		/* main */
     89 		{"<Actions>/Menu/File/EmptyTrashes",			"<shift>D"},
     90 		{"<Actions>/Menu/File/SaveAs",				"<control>S"},
     91 		{"<Actions>/Menu/File/SavePartAs",			"Y"},
     92 		{"<Actions>/Menu/File/SynchroniseFolders",		"<shift><control>S"},
     93 		{"<Actions>/Menu/File/Exit",				"<control>Q"},
     94 		{"<Actions>/Menu/File/OfflineMode",			"<control>W"},
     95 
     96 		{"<Actions>/Menu/Edit/Copy",				"<control>C"},
     97 		{"<Actions>/Menu/Edit/SelectAll",			"<control>A"},
     98 		{"<Actions>/Menu/Edit/Find",				"<control>F"},
     99 
    100 		{"<Actions>/Menu/View/ShowHide/MenuBar",		"<control>F12"},
    101 		{"<Actions>/Menu/View/ShowHide/MessageView",		"V"},
    102 		{"<Actions>/Menu/View/ThreadView",			"<control>T"},
    103 		{"<Actions>/Menu/View/FullScreen",			"F11"},
    104 		{"<Actions>/Menu/View/AllHeaders",			"<control>H"},
    105 		{"<Actions>/Menu/View/Quotes/CollapseAll",		"<shift><control>Q"},
    106 
    107 		{"<Actions>/Menu/View/Goto/Prev",			"P"},
    108 		{"<Actions>/Menu/View/Goto/Next",			"N"},
    109 		{"<Actions>/Menu/View/Goto/PrevUnread",			"<shift>P"},
    110 		{"<Actions>/Menu/View/Goto/NextUnread",			"<shift>N"},
    111 		{"<Actions>/Menu/View/Goto/PrevHistory",		"<alt>Left"},
    112 		{"<Actions>/Menu/View/Goto/NextHistory",		"<alt>Right"},
    113 		{"<Actions>/Menu/View/Goto/ParentMessage",		"<control>Up"},
    114 		{"<Actions>/Menu/View/Goto/NextUnreadFolder",		"<shift>G"},
    115 		{"<Actions>/Menu/View/Goto/Folder",			"G"},
    116 		{"<Actions>/Menu/View/Goto/NextPart",			"A"},
    117 		{"<Actions>/Menu/View/Goto/PrevPart",			"Z"},
    118 		{"<Actions>/Menu/View/OpenNewWindow",			"<control><alt>N"},
    119 		{"<Actions>/Menu/View/MessageSource",			"<control>U"},
    120 		{"<Actions>/Menu/View/Part/AsText",			"T"},
    121 		{"<Actions>/Menu/View/Part/Open",			"L"},
    122 		{"<Actions>/Menu/View/Part/OpenWith",			"O"},
    123 		{"<Actions>/Menu/View/UpdateSummary",			"<control><alt>U"},
    124 
    125 		{"<Actions>/Menu/Message/Receive/CurrentAccount",	"<control>I"},
    126 		{"<Actions>/Menu/Message/Receive/AllAccounts",		"<shift><control>I"},
    127 		{"<Actions>/Menu/Message/ComposeEmail",			"<control>M"},
    128 		{"<Actions>/Menu/Message/Reply",			"<control>R"},
    129 		{"<Actions>/Menu/Message/ReplyTo/All",			"<shift><control>R"},
    130 		{"<Actions>/Menu/Message/ReplyTo/Sender",		""},
    131 		{"<Actions>/Menu/Message/ReplyTo/List",			"<control>L"},
    132 		{"<Actions>/Menu/Message/Forward",			"<control><alt>F"},
    133 		{"<Actions>/Menu/Message/Move",				"<control>O"},
    134 		{"<Actions>/Menu/Message/Copy",				"<shift><control>O"},
    135 		{"<Actions>/Menu/Message/Trash",			"<control>D"},
    136 		{"<Actions>/Menu/Message/Marks/Mark",			"<shift>asterisk"},
    137 		{"<Actions>/Menu/Message/Marks/Unmark",			"U"},
    138 		{"<Actions>/Menu/Message/Marks/MarkUnread",		"<shift>exclam"},
    139 		{"<Actions>/Menu/Message/Marks/MarkRead",		""},
    140 
    141 		{"<Actions>/Menu/Tools/AddressBook",			"<shift><control>A"},
    142 		{"<Actions>/Menu/Tools/Execute",			"X"},
    143 		{"<Actions>/Menu/Tools/Expunge",			"<control>E"},
    144 		{"<Actions>/Menu/Tools/NetworkLog",			"<shift><control>L"},
    145 
    146 		/* compose */
    147 		{"<Actions>/Menu/Message/Send",				"<control>Return"},
    148 		{"<Actions>/Menu/Message/SendLater",			"<shift><control>S"},
    149 		{"<Actions>/Menu/Message/AttachFile",			"<control>M"},
    150 		{"<Actions>/Menu/Message/InsertFile",			"<control>I"},
    151 		{"<Actions>/Menu/Message/Save",				"<control>S"},
    152 		{"<Actions>/Menu/Message/Close",			"<control>W"},
    153 		{"<Actions>/Menu/Edit/Undo",				"<control>Z"},
    154 		{"<Actions>/Menu/Edit/Redo",				"<control>Y"},
    155 		{"<Actions>/Menu/Edit/Cut",				"<control>X"},
    156 		{"<Actions>/Menu/Edit/Copy",				"<control>C"},
    157 		{"<Actions>/Menu/Edit/Paste",				"<control>V"},
    158 		{"<Actions>/Menu/Edit/SelectAll",			"<control>A"},
    159 		{"<Actions>/Menu/Edit/Advanced/BackChar",		"<control>B"},
    160 		{"<Actions>/Menu/Edit/Advanced/ForwChar",		"<control>F"},
    161 		{"<Actions>/Menu/Edit/Advanced/BackWord",		""},
    162 		{"<Actions>/Menu/Edit/Advanced/ForwWord",		""},
    163 		{"<Actions>/Menu/Edit/Advanced/BegLine",		""},
    164 		{"<Actions>/Menu/Edit/Advanced/EndLine",		"<control>E"},
    165 		{"<Actions>/Menu/Edit/Advanced/PrevLine",		"<control>P"},
    166 		{"<Actions>/Menu/Edit/Advanced/NextLine",		"<control>N"},
    167 		{"<Actions>/Menu/Edit/Advanced/DelBackChar",		"<control>H"},
    168 		{"<Actions>/Menu/Edit/Advanced/DelForwChar",		"<control>D"},
    169 		{"<Actions>/Menu/Edit/Advanced/DelBackWord",		""},
    170 		{"<Actions>/Menu/Edit/Advanced/DelForwWord",		""},
    171 		{"<Actions>/Menu/Edit/Advanced/DelLine",		"<control>U"},
    172 		{"<Actions>/Menu/Edit/Advanced/DelEndLine",		"<control>K"},
    173 		{"<Actions>/Menu/Edit/WrapPara",			"<control>L"},
    174 		{"<Actions>/Menu/Edit/WrapAllLines",			"<control><alt>L"},
    175 		{"<Actions>/Menu/Edit/AutoWrap",			"<shift><control>L"},
    176 		{"<Actions>/Menu/Edit/ExtEditor",			"<shift><control>X"},
    177 	};
    178 
    179 	static struct KeyBind mew_wl_menurc[] = {
    180 		/* main */
    181 		{"<Actions>/Menu/File/EmptyTrashes",			"<shift>D"},
    182 		{"<Actions>/Menu/File/SaveAs",				"Y"},
    183 		{"<Actions>/Menu/File/Exit",				"<shift>Q"},
    184 
    185 		{"<Actions>/Menu/Edit/Copy",				"<control>C"},
    186 		{"<Actions>/Menu/Edit/SelectAll",			"<control>A"},
    187 		{"<Actions>/Menu/Edit/Find",				"<control>F"},
    188 		{"<Actions>/Menu/Edit/SearchFolder",			"<control>S"},
    189 		{"<Actions>/Menu/Edit/QuickSearch",			"slash"},
    190 
    191 		{"<Actions>/Menu/View/ShowHide/MessageView",		""},
    192 		{"<Actions>/Menu/View/ThreadView",			"<shift>T"},
    193 		{"<Actions>/Menu/View/Goto/Prev",			"P"},
    194 		{"<Actions>/Menu/View/Goto/Next",			"N"},
    195 		{"<Actions>/Menu/View/Goto/PrevUnread",			"<shift>P"},
    196 		{"<Actions>/Menu/View/Goto/NextUnread",			"<shift>N"},
    197 		{"<Actions>/Menu/View/Goto/Folder",			"G"},
    198 		{"<Actions>/Menu/View/OpenNewWindow",			"<control><alt>N"},
    199 		{"<Actions>/Menu/View/MessageSource",			"<control>U"},
    200 		{"<Actions>/Menu/View/AllHeaders",			"<shift>H"},
    201 		{"<Actions>/Menu/View/UpdateSummary",			"<shift>S"},
    202 
    203 		{"<Actions>/Menu/Message/Receive/CurrentAccount",
    204 									"<control>I"},
    205 		{"<Actions>/Menu/Message/Receive/AllAccounts",		"<shift><control>I"},
    206 		{"<Actions>/Menu/Message/ComposeEmail",			"W"},
    207 		{"<Actions>/Menu/Message/Reply",			"<control>R"},
    208 		{"<Actions>/Menu/Message/ReplyTo/All",			"<shift>A"},
    209 		{"<Actions>/Menu/Message/ReplyTo/Sender",		""},
    210 		{"<Actions>/Menu/Message/ReplyTo/List",			"<control>L"},
    211 		{"<Actions>/Menu/Message/Forward",			"F"},
    212 		{"<Actions>/Menu/Message/Move",				"O"},
    213 		{"<Actions>/Menu/Message/Copy",				"<shift>O"},
    214 		{"<Actions>/Menu/Message/Trash",			"D"},
    215 		{"<Actions>/Menu/Message/Marks/Mark",			"<shift>asterisk"},
    216 		{"<Actions>/Menu/Message/Marks/Unmark",			"U"},
    217 		{"<Actions>/Menu/Message/Marks/MarkUnread",		"<shift>exclam"},
    218 		{"<Actions>/Menu/Message/Marks/MarkRead",		"<shift>R"},
    219 
    220 		{"<Actions>/Menu/Tools/AddressBook",			"<shift><control>A"},
    221 		{"<Actions>/Menu/Tools/Execute",			"X"},
    222 		{"<Actions>/Menu/Tools/NetworkLog",			"<shift><control>L"},
    223 
    224 		/* compose */
    225 		{"<Actions>/Menu/Message/Close",			"<alt>W"},
    226 		{"<Actions>/Menu/Edit/SelectAll",			""},
    227 		{"<Actions>/Menu/Edit/Advanced/BackChar",		"<alt>B"},
    228 		{"<Actions>/Menu/Edit/Advanced/ForwChar",		"<alt>F"},
    229 		{"<Actions>/Menu/Edit/Advanced/BackWord",		""},
    230 		{"<Actions>/Menu/Edit/Advanced/ForwWord",		""},
    231 		{"<Actions>/Menu/Edit/Advanced/BegLine",		"<control>A"},
    232 		{"<Actions>/Menu/Edit/Advanced/DelBackWord",		"<control>W"},
    233 		{"<Actions>/Menu/Edit/Advanced/DelForwWord",		"<alt>D"},
    234 	};
    235 
    236 	static struct KeyBind mutt_menurc[] = {
    237 		/* main */
    238 		{"<Actions>/Menu/File/SaveAs",				"S"}, /* save-message */
    239 		{"<Actions>/Menu/File/Exit",				"Q"}, /* quit */
    240 
    241 		{"<Actions>/Menu/Edit/Copy",				"<control>C"}, /* - */
    242 		{"<Actions>/Menu/Edit/SelectAll",			"<control>A"}, /* - */
    243 		{"<Actions>/Menu/Edit/Find",				"<alt>B"}, /* <esc>B: search in message bodies */
    244 		{"<Actions>/Menu/Edit/SearchFolder",			"slash"}, /* search */
    245 		{"<Actions>/Menu/Edit/QuickSearch",			"L"}, /* limit */
    246 
    247 		{"<Actions>/Menu/View/ShowHide/MessageView",		"V"}, /* - */
    248 		{"<Actions>/Menu/View/ThreadView",			"<control>T"}, /* - */
    249 		{"<Actions>/Menu/View/Goto/Prev",			"K"}, /* previous-entry */
    250 		{"<Actions>/Menu/View/Goto/Next",			"J"}, /* next-entry */
    251 		{"<Actions>/Menu/View/Goto/PrevUnread",			"<alt>U"}, /* <esc>Tab: previous-new-then-unread */
    252 		{"<Actions>/Menu/View/Goto/NextUnread",			"U"}, /* Tab: next-new-then-unread */
    253 		{"<Actions>/Menu/View/Goto/Folder",			"C"}, /* change-folder */
    254 		{"<Actions>/Menu/View/OpenNewWindow",			"<control><alt>N"}, /* - */
    255 		{"<Actions>/Menu/View/MessageSource",			"E"}, /* edit the raw message */
    256 		{"<Actions>/Menu/View/AllHeaders",			"H"}, /* display-toggle-weed */
    257 		{"<Actions>/Menu/View/UpdateSummary",			"<control><alt>U"}, /* - */
    258 
    259 		{"<Actions>/Menu/Message/Receive/CurrentAccount",	"<control>I"}, /* - */
    260 		{"<Actions>/Menu/Message/Receive/AllAccounts",		"<shift>G"}, /* fetch-mail */
    261 		{"<Actions>/Menu/Message/ComposeEmail",			"M"}, /* mail */
    262 		{"<Actions>/Menu/Message/Reply",			"R"}, /* reply */
    263 		{"<Actions>/Menu/Message/ReplyTo/All",			"G"}, /* group-reply */
    264 		{"<Actions>/Menu/Message/ReplyTo/List",			"<shift>L"}, /* list-reply */
    265 		{"<Actions>/Menu/Message/Forward",			"F"}, /* forward-message */
    266 		{"<Actions>/Menu/Message/Move",				"<control>O"}, /* - */
    267 		{"<Actions>/Menu/Message/Copy",				"<shift>C"}, /* copy-message */
    268 		{"<Actions>/Menu/Message/Trash",			"D"}, /* delete-message */
    269 		{"<Actions>/Menu/Message/Marks/Mark",			"<shift>F"}, /* flag-message */
    270 		{"<Actions>/Menu/Message/Marks/Unmark",			"<shift><control>F"}, /* - */
    271 		{"<Actions>/Menu/Message/Marks/MarkUnread",		"<shift>N"}, /* toggle-new */
    272 		{"<Actions>/Menu/Message/Marks/MarkRead",		"<control>R"}, /* read-thread */
    273 
    274 		{"<Actions>/Menu/Tools/AddressBook",			"<shift><control>A"}, /* - */
    275 		{"<Actions>/Menu/Tools/Execute",			"dollar"}, /* sync-mailbox */
    276 		{"<Actions>/Menu/Tools/NetworkLog",			"<shift><control>L"}, /* - */
    277 
    278 		/* compose */
    279 		{"<Actions>/Menu/Message/Close",			"<alt>W"}, /* - */
    280 		{"<Actions>/Menu/Edit/Advanced/BackWord",		"<alt>B"}, /* - */
    281 		{"<Actions>/Menu/Edit/Advanced/ForwWord",		"<alt>F"}, /* - */
    282 		{"<Actions>/Menu/Edit/Advanced/BegLine",		"<control>A"}, /* - */
    283 		{"<Actions>/Menu/Edit/Advanced/DelBackWord",		"<control>W"}, /* - */
    284 		{"<Actions>/Menu/Edit/Advanced/DelForwWord",		"<alt>D"}, /* - */
    285 	};
    286 
    287 	text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widget));
    288 
    289 	if (!strcmp(text, _("Default"))) {
    290 		menurc = default_menurc;
    291 		n_menurc = G_N_ELEMENTS(default_menurc);
    292 	} else if (!strcmp(text, "Mew / Wanderlust")) {
    293 		menurc = mew_wl_menurc;
    294 		n_menurc = G_N_ELEMENTS(mew_wl_menurc);
    295 	} else if (!strcmp(text, "Mutt")) {
    296 		menurc = mutt_menurc;
    297 		n_menurc = G_N_ELEMENTS(mutt_menurc);
    298 	} else {
    299 		g_free(text);
    300 		return;
    301 	}
    302 	g_free(text);
    303 
    304 	prefs_keybind_apply(menurc, n_menurc);
    305 }
    306 
    307 static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
    308 			       	  gpointer data)
    309 {
    310 	OtherPage *prefs_other = (OtherPage *) _page;
    311 
    312 	GtkWidget *vbox1;
    313 	GtkWidget *hbox1;
    314 
    315 	GtkWidget *frame_exit;
    316 	GtkWidget *vbox_exit;
    317 	GtkWidget *checkbtn_warnqueued;
    318 
    319 	GtkWidget *frame_keys;
    320 	GtkWidget *vbox_keys;
    321 	GtkWidget *checkbtn_gtk_enable_accels;
    322 	GtkWidget *keys_preset_hbox;
    323 	GtkWidget *keys_preset_label;
    324 	GtkWidget *keys_preset_combo;
    325 
    326 	GtkWidget *label_iotimeout;
    327 	GtkWidget *spinbtn_iotimeout;
    328 	GtkAdjustment *spinbtn_iotimeout_adj;
    329 
    330 	GtkWidget *vbox2;
    331 	GtkWidget *checkbtn_askonclean;
    332 	GtkWidget *checkbtn_real_time_sync;
    333 
    334 	vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, VSPACING);
    335 	gtk_widget_show (vbox1);
    336 	gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
    337 
    338 	/* On Exit */
    339 	vbox_exit = gtkut_get_options_frame(vbox1, &frame_exit, _("On exit"));
    340 	PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
    341 			   _("Warn if there are queued messages"));
    342 
    343 	vbox_keys = gtkut_get_options_frame(vbox1, &frame_keys, _("Keyboard shortcuts"));
    344 	PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_enable_accels,
    345 			_("Enable keyboard shortcuts"));
    346 	keys_preset_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
    347 	gtk_widget_show (keys_preset_hbox);
    348 	gtk_box_pack_start (GTK_BOX (vbox_keys), keys_preset_hbox, FALSE, FALSE, 0);
    349 
    350 	keys_preset_label = gtk_label_new
    351 		(_("Select preset keyboard shortcuts:"));
    352 	gtk_box_pack_start (GTK_BOX (keys_preset_hbox), keys_preset_label, FALSE, FALSE, 0);
    353 	gtk_label_set_justify (GTK_LABEL (keys_preset_label), GTK_JUSTIFY_LEFT);
    354 
    355 	keys_preset_combo = combobox_text_new(FALSE,
    356 			       _("Current"),
    357 			       _("Default"),
    358 			       "Mew / Wanderlust",
    359 			       "Mutt",
    360 			       NULL);
    361 	gtk_box_pack_start (GTK_BOX (keys_preset_hbox), keys_preset_combo, FALSE, FALSE, 0);
    362 	gtk_widget_show_all(frame_keys);
    363 	SET_TOGGLE_SENSITIVITY (checkbtn_gtk_enable_accels, keys_preset_hbox);
    364 
    365 	hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
    366 	gtk_widget_show (hbox1);
    367 	gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
    368 
    369 	label_iotimeout = gtk_label_new (_("Socket I/O timeout"));
    370 	gtk_widget_show (label_iotimeout);
    371 	gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
    372 
    373 	spinbtn_iotimeout_adj = GTK_ADJUSTMENT(gtk_adjustment_new (60, 0, 1000, 1, 10, 0));
    374 	spinbtn_iotimeout = gtk_spin_button_new
    375 		(GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0);
    376 	gtk_widget_show (spinbtn_iotimeout);
    377 	gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout,
    378 			    FALSE, FALSE, 0);
    379 	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE);
    380 
    381 	label_iotimeout = gtk_label_new (_("seconds"));
    382 	gtk_widget_show (label_iotimeout);
    383 	gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
    384 
    385 	vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
    386 	gtk_widget_show (vbox2);
    387 	gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
    388 
    389 	PACK_CHECK_BUTTON (vbox2, checkbtn_askonclean,
    390 			   _("Ask before emptying trash"));
    391 	PACK_CHECK_BUTTON (vbox2, checkbtn_real_time_sync,
    392 				   _("Synchronise offline folders as soon as possible"));
    393 
    394 	hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
    395 	gtk_widget_show(hbox1);
    396 	gtk_box_pack_start(GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
    397 
    398 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonclean),
    399 		prefs_common.ask_on_clean);
    400 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_warnqueued),
    401 		prefs_common.warn_queued_on_exit);
    402 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_enable_accels),
    403 		prefs_common.gtk_enable_accels);
    404 	gtk_widget_set_sensitive(keys_preset_hbox, prefs_common.gtk_enable_accels);
    405 
    406 	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_iotimeout),
    407 		prefs_common.io_timeout_secs);
    408 
    409 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync),
    410 		prefs_common.real_time_sync);
    411 
    412 	prefs_other->keys_preset_hbox = keys_preset_hbox;
    413 	prefs_other->keys_preset_combo = keys_preset_combo;
    414 	prefs_other->checkbtn_askonclean = checkbtn_askonclean;
    415 	prefs_other->checkbtn_warnqueued = checkbtn_warnqueued;
    416 	prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
    417 	prefs_other->checkbtn_gtk_enable_accels = checkbtn_gtk_enable_accels;
    418 	prefs_other->checkbtn_real_time_sync = checkbtn_real_time_sync;
    419 	prefs_other->page.widget = vbox1;
    420 }
    421 
    422 static void prefs_other_save(PrefsPage *_page)
    423 {
    424 	OtherPage *page = (OtherPage *) _page;
    425 	GtkSettings *settings = gtk_settings_get_default();
    426 	gboolean gtk_enable_accels;
    427 
    428 	prefs_common.ask_on_clean = gtk_toggle_button_get_active(
    429 		GTK_TOGGLE_BUTTON(page->checkbtn_askonclean));
    430 	prefs_common.warn_queued_on_exit = gtk_toggle_button_get_active(
    431 		GTK_TOGGLE_BUTTON(page->checkbtn_warnqueued));
    432 	prefs_common.io_timeout_secs = gtk_spin_button_get_value_as_int(
    433 		GTK_SPIN_BUTTON(page->spinbtn_iotimeout));
    434 	sock_set_io_timeout(prefs_common.io_timeout_secs);
    435 	imap_main_set_timeout(prefs_common.io_timeout_secs);
    436 	prefs_common.real_time_sync =
    437 		gtk_toggle_button_get_active(
    438 			GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync));
    439 
    440 	prefs_keybind_preset_changed(GTK_COMBO_BOX(page->keys_preset_combo));
    441 
    442 	gtk_enable_accels = gtk_toggle_button_get_active(
    443 		GTK_TOGGLE_BUTTON(page->checkbtn_gtk_enable_accels));
    444 
    445 	if (prefs_common.gtk_enable_accels != gtk_enable_accels) {
    446 		prefs_common.gtk_enable_accels = gtk_enable_accels;
    447 
    448 		g_object_set(G_OBJECT(settings), "gtk-enable-accels",
    449 			     (glong)prefs_common.gtk_enable_accels,
    450 			     NULL);
    451 		g_object_set(G_OBJECT(settings), "gtk-enable-mnemonics",
    452 			     (glong)prefs_common.gtk_enable_accels,
    453 			     NULL);
    454 	}
    455 
    456 	if (prefs_common.gtk_enable_accels != gtk_enable_accels) {
    457 		/* gtk_can_change_accels value changed : we have (only if changed)
    458 		 * to apply the gtk property to all widgets : */
    459 		gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE);
    460 	}
    461 }
    462 
    463 static void prefs_other_destroy_widget(PrefsPage *_page)
    464 {
    465 }
    466 
    467 OtherPage *prefs_other;
    468 
    469 void prefs_other_init(void)
    470 {
    471 	OtherPage *page;
    472 	GtkSettings *settings = gtk_settings_get_default();
    473 	static gchar *path[3];
    474 
    475 	path[0] = _("Other");
    476 	path[1] = _("Miscellaneous");
    477 	path[2] = NULL;
    478 
    479 	page = g_new0(OtherPage, 1);
    480 	page->page.path = path;
    481 	page->page.create_widget = prefs_other_create_widget;
    482 	page->page.destroy_widget = prefs_other_destroy_widget;
    483 	page->page.save_page = prefs_other_save;
    484 	page->page.weight = 5.0;
    485 	prefs_gtk_register_page((PrefsPage *) page);
    486 	prefs_other = page;
    487 
    488 	g_object_set(G_OBJECT(settings), "gtk-enable-accels",
    489 			(glong)prefs_common.gtk_enable_accels,
    490 			NULL);
    491 	g_object_set(G_OBJECT(settings), "gtk-enable-mnemonics",
    492 			(glong)prefs_common.gtk_enable_accels,
    493 			NULL);
    494 }
    495 
    496 void prefs_other_done(void)
    497 {
    498 	prefs_gtk_unregister_page((PrefsPage *) prefs_other);
    499 	g_free(prefs_other);
    500 }