[epiphany] Move window position setting from ui to state schema



commit fedcde29c79954e028dcd2283c66cf3c87ea5304
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Tue Jan 31 10:13:00 2017 +0100

    Move window position setting from ui to state schema
    
    And use a tuple instead of two settings.

 data/org.gnome.epiphany.gschema.xml |   25 ++++++++++---------------
 src/ephy-window.c                   |   26 ++++++++++++++++----------
 2 files changed, 26 insertions(+), 25 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index f47d8b1..b99017e 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -105,21 +105,6 @@
                        <summary>The visibility policy for the tabs  bar.</summary>
                        <description>Controls when the tabs bar is shown. Possible values are “always” (the 
tabs bar is always shown), “more-than-one” (the tabs bar is only shown if there’s two or more tabs) and 
“never” (the tabs bar is never shown).</description>
                </key>
-               <key type="i" name="width">
-                       <default>-1</default>
-                       <summary>Window width</summary>
-                       <description>The width to use for a new window that is not restored from a previous 
session.</description>
-               </key>
-               <key type="i" name="height">
-                       <default>-1</default>
-                       <summary>Window height</summary>
-                       <description>The height to use for a new window that is not restored from a previous 
session.</description>
-               </key>
-               <key type="b" name="is-maximized">
-                       <default>false</default>
-                       <summary>Is maximized</summary>
-                       <description>Whether a new window that is not restored from a previous session should 
be initially maximized.</description>
-               </key>
        </schema>
        <schema path="/org/gnome/epiphany/web/" id="org.gnome.Epiphany.web">
                <key type="i" name="min-font-size">
@@ -215,6 +200,16 @@
                <key type="as" name="recent-encodings">
                        <default>['' ]</default>
                </key>
+               <key type="(ii)" name="window-size">
+                       <default>(-1, -1)</default>
+                       <summary>Window size</summary>
+                       <description>The size to use for a new window that is not restored from a previous 
session.</description>
+               </key>
+               <key type="b" name="is-maximized">
+                       <default>false</default>
+                       <summary>Is maximized</summary>
+                       <description>Whether a new window that is not restored from a previous session should 
be initially maximized.</description>
+               </key>
        </schema>
        <schema path="/org/gnome/epiphany/lockdown/" id="org.gnome.Epiphany.lockdown">
                <key type="b" name="disable-fullscreen">
diff --git a/src/ephy-window.c b/src/ephy-window.c
index db56dc5..c86fafd 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2750,13 +2750,17 @@ ephy_window_show (GtkWidget *widget)
   EphyWindow *window = EPHY_WINDOW (widget);
 
   if (!window->has_size && !window->is_popup) {
-    window->current_width = g_settings_get_int (EPHY_SETTINGS_UI, "width");
-    window->current_height = g_settings_get_int (EPHY_SETTINGS_UI, "height");
-    window->is_maximized = g_settings_get_boolean (EPHY_SETTINGS_UI, "is-maximized");
-
-    gtk_window_resize (GTK_WINDOW (window),
-                       window->current_width,
-                       window->current_height);
+    g_settings_get (EPHY_SETTINGS_STATE,
+                    "window-size", "(ii)",
+                    &window->current_width,
+                    &window->current_height);
+    window->is_maximized = g_settings_get_boolean (EPHY_SETTINGS_STATE, "is-maximized");
+
+    if (window->current_width > 0 && window->current_height > 0) {
+      gtk_window_resize (GTK_WINDOW (window),
+                         window->current_width,
+                         window->current_height);
+    }
 
     if (window->is_maximized)
       gtk_window_maximize (GTK_WINDOW (window));
@@ -2773,9 +2777,11 @@ ephy_window_destroy (GtkWidget *widget)
   EphyWindow *window = EPHY_WINDOW (widget);
 
   if (!window->is_popup) {
-    g_settings_set_int (EPHY_SETTINGS_UI, "width", window->current_width);
-    g_settings_set_int (EPHY_SETTINGS_UI, "height", window->current_height);
-    g_settings_set_boolean (EPHY_SETTINGS_UI, "is-maximized", window->is_maximized);
+    g_settings_set (EPHY_SETTINGS_STATE,
+                    "window-size", "(ii)",
+                    window->current_width,
+                    window->current_height);
+    g_settings_set_boolean (EPHY_SETTINGS_STATE, "is-maximized", window->is_maximized);
   }
 
   GTK_WIDGET_CLASS (ephy_window_parent_class)->destroy (widget);


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