Use full width row buttons

This commit is contained in:
kramo
2023-11-11 10:48:09 +01:00
parent 2b52391229
commit b574439328
2 changed files with 62 additions and 18 deletions

View File

@@ -111,9 +111,9 @@ class PreferencesWindow(Adw.PreferencesWindow):
sgdb_spinner = Gtk.Template.Child()
danger_zone_group = Gtk.Template.Child()
reset_action_row = Gtk.Template.Child()
reset_button = Gtk.Template.Child()
remove_all_games_button = Gtk.Template.Child()
remove_all_games_list_box = Gtk.Template.Child()
reset_list_box = Gtk.Template.Child()
reset_group = Gtk.Template.Child()
removed_games: set[Game] = set()
warning_menu_buttons: dict = {}
@@ -137,12 +137,12 @@ class PreferencesWindow(Adw.PreferencesWindow):
self.add_controller(shortcut_controller)
# General
self.remove_all_games_button.connect("clicked", self.remove_all_games)
self.remove_all_games_list_box.connect("row-activated", self.remove_all_games)
# Debug
if shared.PROFILE == "development":
self.reset_action_row.set_visible(True)
self.reset_button.connect("clicked", self.reset_app)
self.reset_group.set_visible(True)
self.reset_list_box.connect("row-activated", self.reset_app)
# Sources settings
for source_class in (

View File

@@ -33,32 +33,76 @@ template $PreferencesWindow : Adw.PreferencesWindow {
Adw.PreferencesGroup danger_zone_group {
title: _("Danger Zone");
Adw.ActionRow {
title: _("Remove All Games");
ListBox remove_all_games_list_box {
Adw.PreferencesRow {
activatable: true;
selectable: false;
Button remove_all_games_button {
label: _("Remove");
Box {
spacing: 6;
valign: center;
halign: center;
Label {
label: _("Remove All Games");
ellipsize: end;
styles [
"heading",
]
}
styles [
"destructive-action",
"header",
]
}
styles [
"error",
]
}
styles [
"boxed-list",
]
}
}
Adw.ActionRow reset_action_row {
title: "Reset App";
subtitle: "Completely resets and quits Cartridges";
visible: false;
Adw.PreferencesGroup reset_group {
visible: false;
Button reset_button {
label: "Reset";
ListBox reset_list_box {
Adw.PreferencesRow {
activatable: true;
selectable: false;
Box {
spacing: 6;
valign: center;
halign: center;
Label {
label: _("Reset App");
ellipsize: end;
styles [
"heading",
]
}
styles [
"destructive-action",
"header",
]
}
styles [
"error",
]
}
styles [
"boxed-list",
]
}
}
}