Improve new snapshot button

This commit is contained in:
heliguy
2023-11-13 20:28:48 -05:00
parent 5ab4f3c7f1
commit c8fb16cfad
2 changed files with 21 additions and 24 deletions

View File

@@ -9,14 +9,6 @@ template SnapshotsWindow: Adw.Window {
Adw.ToolbarView main_toolbar_view {
[top]
HeaderBar header_bar {
[start]
Button new_snapshot {
Adw.ButtonContent {
label: _("New Snapshot");
icon-name: "plus-large-symbolic";
}
}
[end]
Button oepn_folder_button {
icon-name: "document-open-symbolic";
@@ -24,6 +16,27 @@ template SnapshotsWindow: Adw.Window {
}
}
[bottom]
ActionBar {
Box {
halign: center;
hexpand: true;
Button new_snapshot {
margin-top: 6;
margin-bottom: 6;
styles[
"pill",
"suggested-action"
]
Adw.ButtonContent {
label: _("New Snapshot");
icon-name: "plus-large-symbolic";
}
}
}
}
content: Adw.ToastOverlay toast_overlay {
Overlay main_overlay {
[overlay]
@@ -59,16 +72,6 @@ template SnapshotsWindow: Adw.Window {
title: _("No Snapshots");
description: _("Snapshots are backups of the app's user data. They can be reapplied at any time.");
icon-name: "clock-alt-symbolic";
Button new_snapshot_pill {
label: _("New Snapshot");
halign: center;
styles [
"pill",
"suggested-action"
]
}
}
}
}

View File

@@ -19,7 +19,6 @@ class SnapshotsWindow(Adw.Window):
main_stack = Gtk.Template.Child()
no_snapshots = Gtk.Template.Child()
new_snapshot = Gtk.Template.Child()
new_snapshot_pill = Gtk.Template.Child()
oepn_folder_button = Gtk.Template.Child()
toast_overlay = Gtk.Template.Child()
outerbox = Gtk.Template.Child()
@@ -116,7 +115,6 @@ class SnapshotsWindow(Adw.Window):
def callback():
self.create_row(f"{epoch}_{self.app_version}.tar.zst")
self.new_snapshot.set_sensitive(True)
self.new_snapshot_pill.set_sensitive(True)
self.progress_bar.set_visible(False)
self.disconnect(self.no_close_id) # Make window able to close
self.main_stack.set_sensitive(True)
@@ -126,7 +124,6 @@ class SnapshotsWindow(Adw.Window):
file.make_directory()
self.new_snapshot.set_sensitive(False)
self.new_snapshot_pill.set_sensitive(False)
self.progress_bar.set_visible(True)
self.no_close_id = self.connect("close-request", lambda event: True) # Make window unable to close
self.main_stack.set_sensitive(False)
@@ -150,7 +147,6 @@ class SnapshotsWindow(Adw.Window):
if not self.applied:
self.toast_overlay.add_toast(Adw.Toast.new(_("Could not apply snapshot")))
self.new_snapshot.set_sensitive(True)
self.new_snapshot_pill.set_sensitive(True)
self.progress_bar.set_visible(False)
self.disconnect(self.no_close_id) # Make window able to close
self.main_stack.set_sensitive(True)
@@ -173,7 +169,6 @@ class SnapshotsWindow(Adw.Window):
return
self.new_snapshot.set_sensitive(False)
self.new_snapshot_pill.set_sensitive(False)
self.progress_bar.set_visible(True)
self.no_close_id = self.connect("close-request", lambda event: True) # Make window unable to close
self.main_stack.set_sensitive(False)
@@ -223,7 +218,6 @@ class SnapshotsWindow(Adw.Window):
self.generateList()
self.oepn_folder_button.connect("clicked", self.open_button_handler, self.snapshots_of_app_path)
self.new_snapshot.connect("clicked", lambda *_: self.createSnapshot())
self.new_snapshot_pill.connect("clicked", lambda *_: self.createSnapshot())
self.pulser()
event_controller = Gtk.EventControllerKey()