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]
[row]
[column]
border = "all"
border_size = 5
[button]
id = "apply"
definition = "default"
label = _ "Apply"
[/button]
[/column]
[column]
border = "all"
border_size = 5

View File

@ -196,14 +196,29 @@
[/row]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[menu_button]
id = "choose_gui2_theme"
tooltip = _ "Change the UI (GUI2) theme. Additional themes may be provided by community-made add-ons"
[/menu_button]
[menu_button]
id = "choose_gui2_theme"
tooltip = _ "Change the UI (GUI2) theme. Additional themes may be provided by community-made add-ons"
[/menu_button]
[/column]
[column]
border = "all"
border_size = 5
[button]
id = "apply"
definition = "default"
label = _ "Apply"
[/button]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]

View File

@ -591,6 +591,10 @@ void preferences_dialog::initialize_callbacks()
/* SELECT GUI2 THEME */
menu_button& gui2_theme_list = find_widget<menu_button>(this, "choose_gui2_theme", false);
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),
std::bind(&preferences_dialog::handle_gui2_theme_select, this));