From 932e17672bb02d10ac1af9aa036bdde1cdad8c34 Mon Sep 17 00:00:00 2001 From: heliguy4599 Date: Wed, 4 Oct 2023 17:25:56 -0400 Subject: [PATCH] Window size is now remembered --- README.md | 2 +- data/io.github.flattool.Warehouse.gschema.xml | 10 ++++++++++ src/window.blp | 4 ++-- src/window.py | 13 +++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 62c8b43..be072d4 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,11 @@ flatpak run io.github.flattool.Warehouse - [x] +Display dependent runtimes in app properties - [ ] +Filter by runtimes - [x] +Indicate apps & runtimes that are EOL +- [x] Remember window size [ * = Needed before new release, + = New feature, ! = Bug fix ] ## Ideas that might get added but no promise of happening - Installing new apps via ID match -- Remember window size - Pin / unpin runtimes and apps - Option to uninstall apps when removing a remote - Make refreshing the main list after install and uninstall happen in a thread \ No newline at end of file diff --git a/data/io.github.flattool.Warehouse.gschema.xml b/data/io.github.flattool.Warehouse.gschema.xml index c6fe5d9..d6af08f 100644 --- a/data/io.github.flattool.Warehouse.gschema.xml +++ b/data/io.github.flattool.Warehouse.gschema.xml @@ -1,5 +1,15 @@ + + 800 + Window Width + The width of the main window + + + 500 + Window Height + The height of the main window + diff --git a/src/window.blp b/src/window.blp index 27d97eb..c0571e5 100644 --- a/src/window.blp +++ b/src/window.blp @@ -2,8 +2,8 @@ using Gtk 4.0; using Adw 1; template WarehouseWindow : Adw.ApplicationWindow { - default-width: 800; - default-height: 500; + // default-width: 800; + // default-height: 500; Adw.ToolbarView main_toolbar_view { [top] diff --git a/src/window.py b/src/window.py index dfaeb39..e722996 100644 --- a/src/window.py +++ b/src/window.py @@ -510,12 +510,23 @@ class WarehouseWindow(Adw.ApplicationWindow): self.windowSetEmpty(True) self.filter_button.set_sensitive(True) + def loadSettings(self): + width = self.settings.get_int("window-width") + height = self.settings.get_int("window-height") + self.set_default_size(width, height) + + def saveSettings(self, _a): + self.settings.set_int("window-width", self.get_allocated_width()) + self.settings.set_int("window-height", self.get_allocated_height()) + def __init__(self, **kwargs): super().__init__(**kwargs) self.my_utils = myUtils(self) self.filter_list = [True, False, ["all"], ["all"]] self.host_flatpaks = self.my_utils.getHostFlatpaks() self.set_size_request(0, 230) + self.settings = Gio.Settings.new("io.github.flattool.Warehouse") + self.loadSettings() if self.host_flatpaks == [['']]: self.windowSetEmpty(True) @@ -542,5 +553,7 @@ class WarehouseWindow(Adw.ApplicationWindow): self.filter_button.connect("toggled", self.filterWindowHandler) + self.connect("close-request", self.saveSettings) +