[Commits] [SCM] claws branch, master, updated. 4.2.0-73-g75a265c24

wwp at claws-mail.org wwp at claws-mail.org
Mon Apr 8 08:22:26 CET 2024


The branch, master has been updated
       via  75a265c2446822652843fecaa0c1aef44c9081eb (commit)
      from  529ea62653d3af081f7e210ca438df322eb4bb69 (commit)

Summary of changes:
 src/compose.c     |   6 +-
 src/mainwindow.c  |  11 +--
 src/prefs_other.c | 195 +++++++++++++++---------------------------------------
 3 files changed, 65 insertions(+), 147 deletions(-)


- Log -----------------------------------------------------------------
commit 75a265c2446822652843fecaa0c1aef44c9081eb
Author: wwp <subscript at free.fr>
Date:   Mon Apr 8 10:18:06 2024 +0200

    fix bug 4789, 'Integrate single-setting dialog "Choose preset keyboard shortcuts"'
    Moved keyboard binding preset selection from child dialog to main prefs_other window.
    Update the combobox's sensitivity status to follow the 'Enable keyboard shortcuts' checkbox.
    Select preset using combobox (as previously), click Apply or OK to activate the selected preset.
    If 'Current' is the selected preset in combobox, Apply/OK won't change anything and keep current settings.
    
    Add missing ketboard shortcuts to default preset in prefs_other (sync with tables in compose and main windows).
    
    Add missing <control>E shortcut to compose window.
    
    Normalized few <control><shift> to <shift><control>.

diff --git a/src/compose.c b/src/compose.c
index 8e12c9a34..68b94bdf0 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -608,6 +608,8 @@ static GtkActionEntry compose_popup_entries[] =
 	{"Compose/Properties", NULL, N_("_Properties..."), NULL, NULL, G_CALLBACK(compose_attach_property) },
 };
 
+/* make sure to keep the key bindings in the tables below in sync with the default_menurc[] in prefs_other.c
+   as well as with tables in messageview.c */
 static GtkActionEntry compose_entries[] =
 {
 	{"Menu",                          NULL, "Menu", NULL, NULL, NULL },
@@ -658,7 +660,7 @@ static GtkActionEntry compose_entries[] =
 	{"Edit/Advanced/BackWord",        NULL, N_("Move a word backward"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_WORD*/
 	{"Edit/Advanced/ForwWord",        NULL, N_("Move a word forward"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_WORD*/
 	{"Edit/Advanced/BegLine",         NULL, N_("Move to beginning of line"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_BEGINNING_OF_LINE*/
-	{"Edit/Advanced/EndLine",         NULL, N_("Move to end of line"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_END_OF_LINE*/
+	{"Edit/Advanced/EndLine",         NULL, N_("Move to end of line"), "<control>E", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_END_OF_LINE*/
 	{"Edit/Advanced/PrevLine",        NULL, N_("Move to previous line"), "<control>P", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_PREVIOUS_LINE*/
 	{"Edit/Advanced/NextLine",        NULL, N_("Move to next line"), "<control>N", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_NEXT_LINE*/
 	{"Edit/Advanced/DelBackChar",     NULL, N_("Delete a character backward"), "<control>H", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_CHARACTER*/
@@ -712,7 +714,7 @@ static GtkActionEntry compose_entries[] =
 	{"Options/Encoding/Thai",         NULL, N_("Thai"), NULL, NULL, NULL },
 
 /* Tools menu */
-	{"Tools/AddressBook",             NULL, N_("_Address book"), NULL, NULL, G_CALLBACK(compose_address_cb) }, 
+	{"Tools/AddressBook",             NULL, N_("_Address book"), "<shift><control>A", NULL, G_CALLBACK(compose_address_cb) }, 
 
 	{"Tools/Template",                NULL, N_("_Template"), NULL, NULL, NULL },
 	{"Tools/Template/PlaceHolder",    NULL, "Placeholder", NULL, NULL, G_CALLBACK(compose_nothing_cb) },
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 80168e320..4473b8004 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -508,6 +508,7 @@ static void 	mw_compose_news_cb			(GtkAction *gaction, gpointer data)
 	compose_news_cb(data, 0, NULL);
 }
 
+/* make sure to keep the tables below in sync with the default_menurc[] in prefs_other.c */
 static GtkActionEntry mainwin_entries[] =
 {
 	{"Menu",                        NULL, "Menu", NULL, NULL, NULL },
@@ -542,7 +543,7 @@ static GtkActionEntry mainwin_entries[] =
 	{"File/PageSetup",              NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
 	{"File/Print",                  NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
 	/* {"File/---",                 NULL, "---", NULL, NULL, NULL }, */
-	{"File/SynchroniseFolders",     NULL, N_("Synchronise folders"), "<control><shift>S", NULL, G_CALLBACK(sync_cb) }, 
+	{"File/SynchroniseFolders",     NULL, N_("Synchronise folders"), "<shift><control>S", NULL, G_CALLBACK(sync_cb) }, 
 	/* {"File/---",                 NULL, "---", NULL, NULL, NULL }, */
 	{"File/Exit",                   NULL, N_("E_xit"), "<control>Q", NULL, G_CALLBACK(app_exit_cb) }, 
 
@@ -664,7 +665,7 @@ static GtkActionEntry mainwin_entries[] =
 
 	{"Message/Reply",                                NULL, N_("_Reply"), "<control>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY */
 	{"Message/ReplyTo",                              NULL, N_("Repl_y to"), NULL, NULL, NULL }, 
-	{"Message/ReplyTo/All",                          NULL, N_("_All"), "<control><shift>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_ALL */
+	{"Message/ReplyTo/All",                          NULL, N_("_All"), "<shift><control>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_ALL */
 	{"Message/ReplyTo/Sender",                       NULL, N_("_Sender"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_SENDER */
 	{"Message/ReplyTo/List",                         NULL, N_("Mailing _list"), "<control>L", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_LIST */
 	{"Message/FollowupReply",                        NULL, N_("Follow-up and reply to"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FOLLOWUP_AND_REPLY_TO */
@@ -732,7 +733,7 @@ static GtkActionEntry mainwin_entries[] =
 
 /* Tools menu */
 
-	{"Tools/AddressBook",                        NULL, N_("_Address book"), "<control><shift>A", NULL, G_CALLBACK(addressbook_open_cb) }, 
+	{"Tools/AddressBook",                        NULL, N_("_Address book"), "<shift><control>A", NULL, G_CALLBACK(addressbook_open_cb) }, 
 	{"Tools/AddSenderToAB",                      NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(add_address_cb) }, 
 
 	{"Tools/CollectAddresses",                   NULL, N_("C_ollect addresses"), NULL, NULL, NULL }, 
@@ -759,7 +760,7 @@ static GtkActionEntry mainwin_entries[] =
 	{"Tools/CreateProcessingRule/BySender",      NULL, N_("By S_ender"), NULL, NULL, G_CALLBACK(create_processing_cb) },
 	/* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
 
-	{"Tools/ListUrls",                           NULL, N_("List _URLs..."), "<control><shift>U", NULL, G_CALLBACK(open_urls_cb) }, 
+	{"Tools/ListUrls",                           NULL, N_("List _URLs..."), "<shift><control>U", NULL, G_CALLBACK(open_urls_cb) }, 
 
 	/* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
 	{"Tools/Actions",                            NULL, N_("Actio_ns"), NULL, NULL, NULL },
@@ -833,7 +834,7 @@ static GtkToggleActionEntry mainwin_toggle_entries[] = {
 	{"View/HideDelMessages",                 NULL, N_("Hide deleted messages"), NULL, NULL, G_CALLBACK(hide_del_messages), FALSE }, /* toggle */
 	{"View/FullScreen",                      NULL, N_("_Fullscreen"), "F11", NULL, G_CALLBACK(toggle_fullscreen_cb), FALSE }, /* toggle */
 	{"View/AllHeaders",                      NULL, N_("Show all _headers"), "<control>H", NULL, G_CALLBACK(show_all_header_cb), FALSE }, /* toggle */
-	{"View/Quotes/CollapseAll",              NULL, N_("_Collapse all"), "<control><shift>Q", NULL, G_CALLBACK(hide_quotes_cb), FALSE }, /* 1 toggle */
+	{"View/Quotes/CollapseAll",              NULL, N_("_Collapse all"), "<shift><control>Q", NULL, G_CALLBACK(hide_quotes_cb), FALSE }, /* 1 toggle */
 	{"View/Quotes/Collapse2",                NULL, N_("Collapse from level _2"), NULL, NULL, G_CALLBACK(hide_quotes_cb), FALSE }, /* 2 toggle */
 	{"View/Quotes/Collapse3",                NULL, N_("Collapse from level _3"), NULL, NULL, G_CALLBACK(hide_quotes_cb), FALSE }, /* 3 toggle */
 };
diff --git a/src/prefs_other.c b/src/prefs_other.c
index db26cfd81..076a6cfa0 100644
--- a/src/prefs_other.c
+++ b/src/prefs_other.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2005-2022 the Claws Mail team and Colin Leroy
+ * Copyright (C) 2005-2024 the Claws Mail team and Colin Leroy
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -53,6 +53,8 @@ typedef struct _OtherPage
 
 	GtkWidget *window;
 
+	GtkWidget *keys_preset_combo;
+	GtkWidget *keys_preset_hbox;
 	GtkWidget *checkbtn_addaddrbyclick;
 	GtkWidget *checkbtn_confonexit;
 	GtkWidget *checkbtn_cleanonexit;
@@ -71,126 +73,11 @@ typedef struct _OtherPage
 #endif
 } OtherPage;
 
-static struct KeybindDialog {
-	GtkWidget *window;
-	GtkWidget *combo;
-} keybind;
-
-static void prefs_keybind_select		(void);
-static gint prefs_keybind_deleted		(GtkWidget	*widget,
-						 GdkEventAny	*event,
-						 gpointer	 data);
-static gboolean prefs_keybind_key_pressed	(GtkWidget	*widget,
-						 GdkEventKey	*event,
-						 gpointer	 data);
-static void prefs_keybind_cancel		(void);
-static void prefs_keybind_apply_clicked		(GtkWidget	*widget);
 #ifndef PASSWORD_CRYPTO_OLD
 static void prefs_change_primary_passphrase(GtkButton *button, gpointer data);
 static void prefs_use_passphrase_toggled(GtkToggleButton *button, gpointer data);
 #endif
 
-
-static void prefs_keybind_select(void)
-{
-	GtkWidget *window;
-	GtkWidget *vbox1;
-	GtkWidget *hbox1;
-	GtkWidget *label;
-	GtkWidget *combo;
-	GtkWidget *confirm_area;
-	GtkWidget *ok_btn;
-	GtkWidget *cancel_btn;
-
-	window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_other");
-	gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-	gtk_window_set_title (GTK_WINDOW (window), 
-				_("Choose preset keyboard shortcuts"));
-	gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
-	gtk_window_set_modal (GTK_WINDOW (window), TRUE);
-	gtk_window_set_resizable(GTK_WINDOW (window), FALSE);
-	gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
-	manage_window_set_transient (GTK_WINDOW (window));
-
-	vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, VSPACING);
-	gtk_container_add (GTK_CONTAINER (window), vbox1);
-	gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
-
-	hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
-	gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
-
-	label = gtk_label_new
-		(_("Select preset keyboard shortcuts:"));
-	gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-
-	combo = combobox_text_new(FALSE,
-			       _("Default"),
-			       "Mew / Wanderlust",
-			       "Mutt",
-			       NULL);
-	gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
-
-	hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
-	gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
-/*
-	label = gtk_label_new
-		(_("You can also modify each menu shortcut by pressing\n"
-		   "any key(s) when focusing the mouse pointer on the item."));
-	gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
-	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-	gtkut_widget_set_small_font_size (label);
-*/
-	hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
-	gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
-
-	gtkut_stock_button_set_create (&confirm_area, &cancel_btn,NULL,  _("_Cancel"),
-				       &ok_btn, NULL, _("_OK"),
-				       NULL, NULL, NULL);
-	gtk_box_pack_end (GTK_BOX (hbox1), confirm_area, FALSE, FALSE, 0);
-	gtk_widget_grab_focus (ok_btn);
-
-	MANAGE_WINDOW_SIGNALS_CONNECT(window);
-	g_signal_connect (G_OBJECT (window), "delete_event",
-			  G_CALLBACK (prefs_keybind_deleted), NULL);
-	g_signal_connect (G_OBJECT (window), "key_press_event",
-			  G_CALLBACK (prefs_keybind_key_pressed), NULL);
-	g_signal_connect (G_OBJECT (ok_btn), "clicked",
-			  G_CALLBACK (prefs_keybind_apply_clicked),
-			  NULL);
-	g_signal_connect (G_OBJECT (cancel_btn), "clicked",
-			  G_CALLBACK (prefs_keybind_cancel),
-			  NULL);
-
-	gtk_widget_show_all(window);
-
-	keybind.window = window;
-	keybind.combo = combo;
-}
-
-static gboolean prefs_keybind_key_pressed(GtkWidget *widget, GdkEventKey *event,
-					  gpointer data)
-{
-	if (event && event->keyval == GDK_KEY_Escape)
-		prefs_keybind_cancel();
-	return FALSE;
-}
-
-static gint prefs_keybind_deleted(GtkWidget *widget, GdkEventAny *event,
-				  gpointer data)
-{
-	prefs_keybind_cancel();
-	return TRUE;
-}
-
-static void prefs_keybind_cancel(void)
-{
-	gtk_widget_destroy(keybind.window);
-	keybind.window = NULL;
-	keybind.combo = NULL;
-}
-  
 struct KeyBind {
 	const gchar *accel_path;
 	const gchar *accel_key;
@@ -215,20 +102,22 @@ static void prefs_keybind_apply(struct KeyBind keybind[], gint num)
 	}
 }
 
-static void prefs_keybind_apply_clicked(GtkWidget *widget)
+static void prefs_keybind_preset_changed(GtkComboBox *widget)
 {
 	gchar *text;
 	struct KeyBind *menurc;
 	gint n_menurc;
 
+	/* make sure to keep the table below in sync with the ones in mainwindow.c, messageview.c */
 	static struct KeyBind default_menurc[] = {
 		/* main */
 		{"<Actions>/Menu/File/EmptyTrashes",			"<shift>D"},
 		{"<Actions>/Menu/File/SaveAs",				"<control>S"},
+		{"<Actions>/Menu/File/SavePartAs",			"Y"},
 		{"<Actions>/Menu/File/Print",				"<control>P"},
-		{"<Actions>/Menu/File/OfflineMode",			"<control>W"},
-		{"<Actions>/Menu/File/SynchroniseFolders",		"<control><shift>S"},
+		{"<Actions>/Menu/File/SynchroniseFolders",		"<shift><control>S"},
 		{"<Actions>/Menu/File/Exit",				"<control>Q"},
+		{"<Actions>/Menu/File/OfflineMode",			"<control>W"},
 
 		{"<Actions>/Menu/Edit/Copy",				"<control>C"},
 		{"<Actions>/Menu/Edit/SelectAll",			"<control>A"},
@@ -236,20 +125,32 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 		{"<Actions>/Menu/Edit/SearchFolder",			"<shift><control>F"},
 		{"<Actions>/Menu/Edit/QuickSearch",			"slash"},
 
+		{"<Actions>/Menu/View/ShowHide/MenuBar",		"<control>F12"},
 		{"<Actions>/Menu/View/ShowHide/MessageView",		"V"},
 		{"<Actions>/Menu/View/ThreadView",			"<control>T"},
+		{"<Actions>/Menu/View/FullScreen",			"F11"},
+		{"<Actions>/Menu/View/AllHeaders",			"<control>H"},
+		{"<Actions>/Menu/View/Quotes/CollapseAll",		"<shift><control>Q"},
+
 		{"<Actions>/Menu/View/Goto/Prev",			"P"},
 		{"<Actions>/Menu/View/Goto/Next",			"N"},
 		{"<Actions>/Menu/View/Goto/PrevUnread",			"<shift>P"},
 		{"<Actions>/Menu/View/Goto/NextUnread",			"<shift>N"},
+		{"<Actions>/Menu/View/Goto/PrevHistory",		"<alt>Left"},
+		{"<Actions>/Menu/View/Goto/NextHistory",		"<alt>Right"},
+		{"<Actions>/Menu/View/Goto/ParentMessage",		"<control>Up"},
+		{"<Actions>/Menu/View/Goto/NextUnreadFolder",		"<shift>G"},
 		{"<Actions>/Menu/View/Goto/Folder",			"G"},
+		{"<Actions>/Menu/View/Goto/NextPart",			"A"},
+		{"<Actions>/Menu/View/Goto/PrevPart",			"Z"},
 		{"<Actions>/Menu/View/OpenNewWindow",			"<control><alt>N"},
 		{"<Actions>/Menu/View/MessageSource",			"<control>U"},
-		{"<Actions>/Menu/View/AllHeaders",			"<control>H"},
+		{"<Actions>/Menu/View/Part/AsText",			"T"},
+		{"<Actions>/Menu/View/Part/Open",			"L"},
+		{"<Actions>/Menu/View/Part/OpenWith",			"O"},
 		{"<Actions>/Menu/View/UpdateSummary",			"<control><alt>U"},
 
-		{"<Actions>/Menu/Message/Receive/CurrentAccount",
-									"<control>I"},
+		{"<Actions>/Menu/Message/Receive/CurrentAccount",	"<control>I"},
 		{"<Actions>/Menu/Message/Receive/AllAccounts",		"<shift><control>I"},
 		{"<Actions>/Menu/Message/ComposeEmail",			"<control>M"},
 		{"<Actions>/Menu/Message/Reply",			"<control>R"},
@@ -266,8 +167,11 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 		{"<Actions>/Menu/Message/Mark/MarkRead",		""},
 
 		{"<Actions>/Menu/Tools/AddressBook",			"<shift><control>A"},
+		{"<Actions>/Menu/Tools/ListUrls",			"<shift><control>U"}, 
 		{"<Actions>/Menu/Tools/Execute",			"X"},
+		{"<Actions>/Menu/Tools/Expunge",			"<control>E"}, 
 		{"<Actions>/Menu/Tools/NetworkLog",			"<shift><control>L"},
+
 		/* compose */
 		{"<Actions>/Menu/Message/Send",				"<control>Return"},
 		{"<Actions>/Menu/Message/SendLater",			"<shift><control>S"},
@@ -300,7 +204,6 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 		{"<Actions>/Menu/Edit/WrapAllLines",			"<control><alt>L"},
 		{"<Actions>/Menu/Edit/AutoWrap",			"<shift><control>L"},
 		{"<Actions>/Menu/Edit/ExtEditor",			"<shift><control>X"},
-		{"<Actions>/Menu/Tools/AddressBook",			"<shift><control>A"},
 	};
 
 	static struct KeyBind mew_wl_menurc[] = {
@@ -348,6 +251,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 		{"<Actions>/Menu/Tools/AddressBook",			"<shift><control>A"},
 		{"<Actions>/Menu/Tools/Execute",			"X"},
 		{"<Actions>/Menu/Tools/NetworkLog",			"<shift><control>L"},
+
 		/* compose */
 		{"<Actions>/Menu/Message/Close",			"<alt>W"},
 		{"<Actions>/Menu/Edit/SelectAll",			""},
@@ -395,13 +299,14 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 		{"<Actions>/Menu/Message/Copy",				"<shift>C"}, /* copy-message */
 		{"<Actions>/Menu/Message/Trash",			"D"}, /* delete-message */
 		{"<Actions>/Menu/Message/Mark/Mark",			"<shift>F"}, /* flag-message */
-		{"<Actions>/Menu/Message/Mark/Unmark",			"<control><shift>F"}, /* - */
+		{"<Actions>/Menu/Message/Mark/Unmark",			"<shift><control>F"}, /* - */
 		{"<Actions>/Menu/Message/Mark/MarkUnread",		"<shift>N"}, /* toggle-new */
 		{"<Actions>/Menu/Message/Mark/MarkRead",		"<control>R"}, /* read-thread */
 
 		{"<Actions>/Menu/Tools/AddressBook",			"<shift><control>A"}, /* - */
 		{"<Actions>/Menu/Tools/Execute",			"dollar"}, /* sync-mailbox */
 		{"<Actions>/Menu/Tools/NetworkLog",			"<shift><control>L"}, /* - */
+
 		/* compose */
 		{"<Actions>/Menu/Message/Close",			"<alt>W"}, /* - */
 		{"<Actions>/Menu/Edit/Advanced/BackWord",		"<alt>B"}, /* - */
@@ -411,7 +316,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 		{"<Actions>/Menu/Edit/Advanced/DelForwWord",		"<alt>D"}, /* - */
 	};
 
-	text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(keybind.combo));
+	text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widget));
 
 	if (!strcmp(text, _("Default"))) {
 		menurc = default_menurc;
@@ -429,10 +334,6 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
 	g_free(text);
 
 	prefs_keybind_apply(menurc, n_menurc);
-
-	gtk_widget_destroy(keybind.window);
-	keybind.window = NULL;
-	keybind.combo = NULL;
 }
 
 static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window, 
@@ -456,7 +357,9 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 	GtkWidget *frame_keys;
 	GtkWidget *vbox_keys;
 	GtkWidget *checkbtn_gtk_enable_accels;
-	GtkWidget *button_keybind;
+	GtkWidget *keys_preset_hbox;
+	GtkWidget *keys_preset_label;
+	GtkWidget *keys_preset_combo;
 
 	GtkWidget *label_iotimeout;
 	GtkWidget *spinbtn_iotimeout;
@@ -515,16 +418,24 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 	PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_enable_accels,
 			_("Enable keyboard shortcuts"));
 
-	button_keybind = gtk_button_new_with_label(
-				_(" Choose preset keyboard shortcuts... "));
-	gtk_widget_show (button_keybind);
-	hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
-	gtk_widget_show (hbox1);
-	gtk_box_pack_start (GTK_BOX (vbox_keys), hbox1, FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0);
-	g_signal_connect (G_OBJECT (button_keybind), "clicked",
-			  G_CALLBACK (prefs_keybind_select), NULL);
+	keys_preset_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
+	gtk_widget_show (keys_preset_hbox);
+	gtk_box_pack_start (GTK_BOX (vbox_keys), keys_preset_hbox, FALSE, FALSE, 0);
 
+	keys_preset_label = gtk_label_new
+		(_("Select preset keyboard shortcuts:"));
+	gtk_box_pack_start (GTK_BOX (keys_preset_hbox), keys_preset_label, FALSE, FALSE, 0);
+	gtk_label_set_justify (GTK_LABEL (keys_preset_label), GTK_JUSTIFY_LEFT);
+
+	keys_preset_combo = combobox_text_new(FALSE,
+			       _("Current"),
+			       _("Default"),
+			       "Mew / Wanderlust",
+			       "Mutt",
+			       NULL);
+	gtk_box_pack_start (GTK_BOX (keys_preset_hbox), keys_preset_combo, FALSE, FALSE, 0);
+	gtk_widget_show_all(frame_keys);
+	SET_TOGGLE_SENSITIVITY (checkbtn_gtk_enable_accels, keys_preset_hbox);
 
 	vbox_metadata = gtkut_get_options_frame(vbox1, &frame_metadata, _("Metadata handling"));
 	metadata_label = gtk_label_new(_("Safer mode asks the OS to write metadata to disk directly;\n"
@@ -624,7 +535,6 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 	g_signal_connect (G_OBJECT (button_change_passphrase), "clicked",
 			  G_CALLBACK (prefs_change_primary_passphrase), NULL);
 #endif
-	SET_TOGGLE_SENSITIVITY(checkbtn_gtk_enable_accels, button_keybind);
 
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_addaddrbyclick), 
 		prefs_common.add_address_by_click);
@@ -638,6 +548,7 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 		prefs_common.warn_queued_on_exit);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_enable_accels),
 		prefs_common.gtk_enable_accels);
+	gtk_widget_set_sensitive(keys_preset_hbox, prefs_common.gtk_enable_accels);
 
 	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_iotimeout),
 		prefs_common.io_timeout_secs);
@@ -658,6 +569,8 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 			prefs_common.use_primary_passphrase);
 #endif
 
+	prefs_other->keys_preset_hbox = keys_preset_hbox;
+	prefs_other->keys_preset_combo = keys_preset_combo;
 	prefs_other->checkbtn_addaddrbyclick = checkbtn_addaddrbyclick;
 	prefs_other->checkbtn_confonexit = checkbtn_confonexit;
 	prefs_other->checkbtn_cleanonexit = checkbtn_cleanonexit;
@@ -713,6 +626,8 @@ static void prefs_other_save(PrefsPage *_page)
 		gtk_toggle_button_get_active(
 			GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync));
 
+	prefs_keybind_preset_changed(page->keys_preset_combo);
+
 #ifndef PASSWORD_CRYPTO_OLD
 	/* If we're disabling use of primary passphrase, we need to reencrypt
 	 * all account passwords with hardcoded key. */

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list