Skip to content

Commit 4d3ba53

Browse files
committed
Remember window size
1 parent 597a180 commit 4d3ba53

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<schemalist gettext-domain="iplookup">
33
<schema id="io.github.bytezz.IPLookup" path="/io/github/bytezz/IPLookup/">
4+
<key name="window-width" type="i">
5+
<default>500</default>
6+
</key>
7+
<key name="window-height" type="i">
8+
<default>715</default>
9+
</key>
10+
<key name="window-maximized" type="b">
11+
<default>false</default>
12+
</key>
413
</schema>
514
</schemalist>

src/window.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
from gi.repository import Adw
2121
from gi.repository import Gtk
22+
from gi.repository import Gio
2223

2324
@Gtk.Template(resource_path='/io/github/bytezz/IPLookup/window.ui')
2425
class IplookupWindow(Adw.ApplicationWindow):
@@ -45,3 +46,11 @@ class IplookupWindow(Adw.ApplicationWindow):
4546
def __init__(self, **kwargs):
4647
super().__init__(**kwargs)
4748
self.ip_entry.grab_focus()
49+
50+
self.settings = Gio.Settings(schema_id="io.github.bytezz.IPLookup")
51+
self.settings.bind("window-width", self, "default-width",
52+
Gio.SettingsBindFlags.DEFAULT)
53+
self.settings.bind("window-height", self, "default-height",
54+
Gio.SettingsBindFlags.DEFAULT)
55+
self.settings.bind("window-maximized", self, "maximized",
56+
Gio.SettingsBindFlags.DEFAULT)

0 commit comments

Comments
 (0)