Window size is now remembered

This commit is contained in:
heliguy4599
2023-10-04 17:25:56 -04:00
parent ee2975df34
commit 932e17672b
4 changed files with 26 additions and 3 deletions

View File

@@ -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

View File

@@ -1,5 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="warehouse">
<schema id="io.github.flattool.Warehouse" path="/io/github/flattool/Warehouse/">
<key name="window-width" type="i">
<default>800</default>
<summary>Window Width</summary>
<description>The width of the main window</description>
</key>
<key name="window-height" type="i">
<default>500</default>
<summary>Window Height</summary>
<description>The height of the main window</description>
</key>
</schema>
</schemalist>

View File

@@ -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]

View File

@@ -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)