[Commits] [SCM] claws branch, gtk2, updated. 3.20.0-72-g9c072967c

wwp at claws-mail.org wwp at claws-mail.org
Mon Apr 8 09:53:16 CET 2024


The branch, gtk2 has been updated
       via  9c072967ca8cfe4c68e243aae9b38bbbb8c52d41 (commit)
      from  aee0b601fbbc5383cc601505d391d94ea890935a (commit)

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


- Log -----------------------------------------------------------------
commit 9c072967ca8cfe4c68e243aae9b38bbbb8c52d41
Author: wwp <subscript at free.fr>
Date:   Mon Apr 8 11:52:50 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 3ca859c16..a67a6c117 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -613,6 +613,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 },
@@ -663,7 +665,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*/
@@ -717,7 +719,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 1064893bd..4c7c49a73 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -514,6 +514,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 },
@@ -548,7 +549,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) }, 
 
@@ -670,7 +671,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 */
@@ -738,7 +739,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 }, 
@@ -765,7 +766,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 },
@@ -839,7 +840,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 c55f274fd..aa90ad15e 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-2019 Colin Leroy and The Claws Mail Team
+ * Copyright (C) 2005-2024 Colin Leroy and The Claws Mail Team
  *
  * 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;
@@ -72,126 +74,12 @@ 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_vbox_new (FALSE, VSPACING);
-	gtk_container_add (GTK_CONTAINER (window), vbox1);
-	gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
-
-	hbox1 = gtk_hbox_new (FALSE, 8);
-	gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
-
-	label = gtk_label_new
-		(_("Select preset:"));
-	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_hbox_new (FALSE, 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_hbox_new (FALSE, 8);
-	gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
-
-	gtkut_stock_button_set_create (&confirm_area, &cancel_btn, GTK_STOCK_CANCEL,
-				       &ok_btn, GTK_STOCK_OK,
-				       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;
@@ -216,20 +104,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"},
@@ -237,20 +127,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"},
@@ -267,8 +169,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"},
@@ -301,7 +206,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[] = {
@@ -349,6 +253,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",			""},
@@ -396,13 +301,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"}, /* - */
@@ -412,7 +318,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;
@@ -430,10 +336,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, 
@@ -458,7 +360,9 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 	GtkWidget *vbox_keys;
 	GtkWidget *checkbtn_gtk_enable_accels;
 	GtkWidget *checkbtn_gtk_can_change_accels;
-	GtkWidget *button_keybind;
+	GtkWidget *keys_preset_hbox;
+	GtkWidget *keys_preset_label;
+	GtkWidget *keys_preset_combo;
 
 	GtkWidget *label_iotimeout;
 	GtkWidget *spinbtn_iotimeout;
@@ -527,16 +431,24 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 				"Uncheck this option if you want to lock all "
 				"existing keyboard shortcuts."));
 
-	button_keybind = gtk_button_new_with_label(
-				_(" Choose preset keyboard shortcuts... "));
-	gtk_widget_show (button_keybind);
-	hbox1 = gtk_hbox_new (FALSE, 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_hbox_new(FALSE, 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"
@@ -636,7 +548,6 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 			  G_CALLBACK (prefs_change_primary_passphrase), NULL);
 #endif
 	SET_TOGGLE_SENSITIVITY(checkbtn_gtk_enable_accels, checkbtn_gtk_can_change_accels);
-	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);
@@ -652,6 +563,7 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 		prefs_common.gtk_enable_accels);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_can_change_accels),
 		prefs_common.gtk_can_change_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);
@@ -672,6 +584,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;
@@ -728,6 +642,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