Preferences: move the Apply button and disable it unless needed

this also makes it obvious that the Apply button is used only for UI theme selection, and is not a global Apply button
This commit is contained in:
Subhraman Sarkar 2024-09-10 07:03:45 +05:30 committed by Charles Dang
parent b316ee518b
commit 14732806c9
3 changed files with 26 additions and 17 deletions

View File

@ -425,16 +425,6 @@
[grid] [grid]
[row] [row]
[column]
border = "all"
border_size = 5
[button]
id = "apply"
definition = "default"
label = _ "Apply"
[/button]
[/column]
[column] [column]
border = "all" border = "all"
border_size = 5 border_size = 5

View File

@ -194,6 +194,9 @@
[/label] [/label]
[/column] [/column]
[/row] [/row]
[row]
[column]
[grid]
[row] [row]
[column] [column]
border = "all" border = "all"
@ -205,6 +208,18 @@
tooltip = _ "Change the UI (GUI2) theme. Additional themes may be provided by community-made add-ons" tooltip = _ "Change the UI (GUI2) theme. Additional themes may be provided by community-made add-ons"
[/menu_button] [/menu_button]
[/column] [/column]
[column]
border = "all"
border_size = 5
[button]
id = "apply"
definition = "default"
label = _ "Apply"
[/button]
[/column]
[/row]
[/grid]
[/column]
[/row] [/row]
[/grid] [/grid]
[/column] [/column]

View File

@ -591,6 +591,10 @@ void preferences_dialog::initialize_callbacks()
/* SELECT GUI2 THEME */ /* SELECT GUI2 THEME */
menu_button& gui2_theme_list = find_widget<menu_button>(this, "choose_gui2_theme", false); menu_button& gui2_theme_list = find_widget<menu_button>(this, "choose_gui2_theme", false);
set_gui2_theme_list(gui2_theme_list); set_gui2_theme_list(gui2_theme_list);
connect_signal_notify_modified(find_widget<menu_button>(this, "choose_gui2_theme", false), std::bind([&]() {
find_widget<button>(this, "apply", false).set_active(true);
}));
find_widget<button>(this, "apply", false).set_active(false);
connect_signal_mouse_left_click(find_widget<button>(this, "apply", false), connect_signal_mouse_left_click(find_widget<button>(this, "apply", false),
std::bind(&preferences_dialog::handle_gui2_theme_select, this)); std::bind(&preferences_dialog::handle_gui2_theme_select, this));