[console/wip/msandova/remember-window-size] schema: Add setting to remember size on close



commit 31c083141b883dc3c6eda64178fc20c5aa4b7a34
Author: Maximiliano Sandoval R <msandova gnome org>
Date:   Fri Aug 5 16:38:26 2022 +0200

    schema: Add setting to remember size on close
    
    Enabled by default. If this setting is disabled it will still load the
    saved size, but won't save it on close.

 data/org.gnome.Console.gschema.xml.in | 3 +++
 src/kgx-application.c                 | 8 +++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.Console.gschema.xml.in b/data/org.gnome.Console.gschema.xml.in
index 7e87e13..5b06808 100644
--- a/data/org.gnome.Console.gschema.xml.in
+++ b/data/org.gnome.Console.gschema.xml.in
@@ -27,5 +27,8 @@
     <key name="window-height" type="i">
       <default>-1</default>
     </key>
+    <key name="remember-window-size" type="b">
+      <default>true</default>
+    </key>
   </schema>
 </schemalist>
diff --git a/src/kgx-application.c b/src/kgx-application.c
index aba9005..18dabc8 100644
--- a/src/kgx-application.c
+++ b/src/kgx-application.c
@@ -1252,8 +1252,10 @@ kgx_application_save_window_size (KgxApplication *self,
 {
   g_return_if_fail (KGX_IS_APPLICATION (self));
 
-  g_debug ("Saving window geometry: %ix%i", width, height);
+  if (g_settings_get_boolean (self->settings, "remember-window-size")) {
+    g_debug ("Saving window geometry: %ix%i", width, height);
 
-  g_settings_set_int (self->settings, "window-width", width);
-  g_settings_set_int (self->settings, "window-height", height);
+    g_settings_set_int (self->settings, "window-width", width);
+    g_settings_set_int (self->settings, "window-height", height);
+  }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]