From cf1146741afc0d948bf06905d46913aa8093d93a Mon Sep 17 00:00:00 2001 From: heliguy4599 Date: Wed, 4 Oct 2023 17:33:18 -0400 Subject: [PATCH] Properly remember window size and state The previous commit's way of doing it worked but was not adviseable --- data/io.github.flattool.Warehouse.gschema.xml | 22 ++++++++++--------- src/window.py | 5 ++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/data/io.github.flattool.Warehouse.gschema.xml b/data/io.github.flattool.Warehouse.gschema.xml index d6af08f..0893008 100644 --- a/data/io.github.flattool.Warehouse.gschema.xml +++ b/data/io.github.flattool.Warehouse.gschema.xml @@ -1,15 +1,17 @@ - - 800 - Window Width - The width of the main window - - - 500 - Window Height - The height of the main window - + + 640 + + + 480 + + + false + + + false + diff --git a/src/window.py b/src/window.py index e722996..b30ca7c 100644 --- a/src/window.py +++ b/src/window.py @@ -526,7 +526,10 @@ class WarehouseWindow(Adw.ApplicationWindow): self.host_flatpaks = self.my_utils.getHostFlatpaks() self.set_size_request(0, 230) self.settings = Gio.Settings.new("io.github.flattool.Warehouse") - self.loadSettings() + self.settings.bind("window-width", self, "default-width", Gio.SettingsBindFlags.DEFAULT) + self.settings.bind("window-height", self, "default-height", Gio.SettingsBindFlags.DEFAULT) + self.settings.bind("is-maximized", self, "maximized", Gio.SettingsBindFlags.DEFAULT) + self.settings.bind("is-fullscreen", self, "fullscreened", Gio.SettingsBindFlags.DEFAULT) if self.host_flatpaks == [['']]: self.windowSetEmpty(True)