diff --git a/data/icons/arrow-turn-left-down-symbolic.svg b/data/icons/arrow-turn-left-down-symbolic.svg
new file mode 100644
index 0000000..ec47cb3
--- /dev/null
+++ b/data/icons/arrow-turn-left-down-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/data/ui/downgrade.blp b/data/ui/downgrade.blp
index c6a8974..4c50642 100644
--- a/data/ui/downgrade.blp
+++ b/data/ui/downgrade.blp
@@ -1,75 +1,78 @@
using Gtk 4.0;
using Adw 1;
-template $DowngradeWindow: Adw.Window {
- default-width: 500;
- default-height: 450;
- modal: true;
+template $DowngradeWindow: Adw.Dialog {
+ content-width: 500;
+ content-height: 450;
Adw.ToolbarView main_toolbar_view {
[top]
- HeaderBar header_bar {
- show-title-buttons: false;
-
- [start]
- Button cancel_button {
- label: _("Cancel");
- }
-
- [end]
- Button apply_button {
- sensitive: false;
- label: _("Downgrade");
-
- styles [
- "suggested-action"
- ]
- }
+ Adw.HeaderBar header_bar {
}
content: Adw.ToastOverlay toast_overlay {
- Stack main_stack {
- Box loading {
- orientation: vertical;
- spacing: 10;
- margin-top: 40;
- margin-bottom: 20;
+ Overlay {
+ [overlay]
+ Button apply_button {
+ valign: end;
halign: center;
- valign: center;
-
- Spinner {
- margin-bottom: 35;
- width-request: 30;
- height-request: 30;
- opacity: 0.5;
- spinning: true;
+ margin-bottom: 12;
+ sensitive: false;
+ Adw.ButtonContent {
+ label: _("Downgrade");
+ icon-name: "arrow-turn-left-down-symbolic";
}
- Label loading_label {
- label: _("Fetching Releases");
- styles [
- "title-1",
- "title"
- ]
- }
-
- Label {
- label: _("This could take a while");
- styles ["description", "body"]
- }
+ styles [
+ "suggested-action",
+ "pill"
+ ]
}
- Adw.PreferencesPage outerbox {
- Adw.PreferencesGroup {
- Adw.SwitchRow mask_row {
- title: _("Disable Updates");
- active: true;
+ Stack main_stack {
+ Box loading {
+ orientation: vertical;
+ spacing: 10;
+ margin-top: 40;
+ margin-bottom: 20;
+ halign: center;
+ valign: center;
+
+ Spinner {
+ margin-bottom: 35;
+ width-request: 30;
+ height-request: 30;
+ opacity: 0.5;
+ spinning: true;
+ }
+
+ Label loading_label {
+ label: _("Fetching Releases");
+ styles [
+ "title-1",
+ "title"
+ ]
+ }
+
+ Label {
+ label: _("This could take a while");
+ styles ["description", "body"]
}
}
- Adw.PreferencesGroup versions_group {
- title: _("Select a Release");
- description: _("This will uninstall the current release and install the chosen one instead. Note that downgrading can cause issues.");
+ Adw.PreferencesPage outerbox {
+ Adw.PreferencesGroup {
+ Adw.SwitchRow mask_row {
+ title: _("Disable Updates");
+ active: true;
+ }
+ }
+
+ Adw.PreferencesGroup versions_group {
+ title: _("Select a Release");
+ description: _("This will uninstall the current release and install the chosen one instead. Note that downgrading can cause issues.");
+ margin-bottom: 42;
+ }
}
}
}
diff --git a/src/downgrade_window.py b/src/downgrade_window.py
index 019a3dc..869e74b 100644
--- a/src/downgrade_window.py
+++ b/src/downgrade_window.py
@@ -6,13 +6,12 @@ import pathlib
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/../data/ui/downgrade.ui")
-class DowngradeWindow(Adw.Window):
+class DowngradeWindow(Adw.Dialog):
__gtype_name__ = "DowngradeWindow"
new_env = dict(os.environ)
new_env["LC_ALL"] = "C"
- cancel_button = Gtk.Template.Child()
apply_button = Gtk.Template.Child()
versions_group = Gtk.Template.Child()
toast_overlay = Gtk.Template.Child()
@@ -114,14 +113,13 @@ class DowngradeWindow(Adw.Window):
task.run_in_thread(lambda *_: self.get_commits())
def downgrade_callack(self):
- self.disconnect(self.no_close)
+ self.set_can_close(True)
if self.response != 0:
self.toast_overlay.add_toast(
Adw.Toast.new(_("Could not downgrade {}").format(self.app_name))
)
self.apply_button.set_sensitive(True)
- self.cancel_button.set_sensitive(True)
return
if self.mask_row.get_active():
@@ -143,10 +141,9 @@ class DowngradeWindow(Adw.Window):
def on_apply(self):
self.loading_label.set_label(_("Downgrading…"))
- self.no_close = self.connect("close-request", lambda event: True)
+ self.set_can_close(False)
self.main_stack.set_visible_child(self.loading)
self.apply_button.set_sensitive(False)
- self.cancel_button.set_sensitive(False)
task = Gio.Task.new(None, None, lambda *_: self.downgrade_callack())
task.run_in_thread(lambda *_: self.downgrade_thread())
@@ -172,12 +169,10 @@ class DowngradeWindow(Adw.Window):
# Connections
event_controller.connect("key-pressed", self.key_handler)
- self.cancel_button.connect("clicked", lambda *_: self.close())
self.apply_button.connect("clicked", lambda *_: self.on_apply())
# Apply
self.add_controller(event_controller)
- self.set_transient_for(parent_window)
self.mask_row.set_subtitle(
_("Ensure that {} will never be updated to a newer version").format(
self.app_name
@@ -188,4 +183,4 @@ class DowngradeWindow(Adw.Window):
self.generate_list()
- self.present()
+ self.present(parent_window)
diff --git a/src/warehouse.gresource.xml b/src/warehouse.gresource.xml
index a2034aa..89b65f6 100644
--- a/src/warehouse.gresource.xml
+++ b/src/warehouse.gresource.xml
@@ -35,5 +35,6 @@
../data/icons/eye-not-looking-symbolic.svg
../data/icons/eye-open-negative-filled-symbolic.svg
../data/icons/left-large-symbolic.svg
+ ../data/icons/arrow-turn-left-down-symbolic.svg