diff --git a/data/eu.callcc.audrey.gschema.xml b/data/eu.callcc.audrey.gschema.xml
index a68f494..e6ca50c 100644
--- a/data/eu.callcc.audrey.gschema.xml
+++ b/data/eu.callcc.audrey.gschema.xml
@@ -6,6 +6,15 @@
100
+
+
+ -1
+
+
+ -1
+
+
+ false
diff --git a/src/ui/window.rs b/src/ui/window.rs
index 03861b4..0793d9b 100644
--- a/src/ui/window.rs
+++ b/src/ui/window.rs
@@ -172,7 +172,15 @@ mod imp {
let settings = gio::Settings::new(crate::APP_ID);
settings.bind("mute", self.obj().as_ref(), "mute").build();
- settings.bind("volume", self.obj().as_ref(), "volume").build();
+ settings
+ .bind("volume", self.obj().as_ref(), "volume")
+ .build();
+
+ self.obj()
+ .set_default_size(settings.int("window-width"), settings.int("window-height"));
+ if settings.boolean("is-maximized") {
+ self.obj().maximize();
+ }
// update time-pos every 100 ms
let window = self.obj().downgrade();
@@ -293,7 +301,20 @@ mod imp {
}
}
- impl WindowImpl for Window {}
+ impl WindowImpl for Window {
+ fn close_request(&self) -> glib::Propagation {
+ let size = self.obj().default_size();
+ // TODO: don't instantiate this so many times maybe? OnceCell in imp struct?
+ let settings = gio::Settings::new(crate::APP_ID);
+ settings.set_int("window-width", size.0).unwrap();
+ settings.set_int("window-height", size.1).unwrap();
+ settings
+ .set_boolean("is-maximized", self.obj().is_maximized())
+ .unwrap();
+
+ glib::Propagation::Proceed
+ }
+ }
impl ApplicationWindowImpl for Window {}