[gnome-chess/chess-telepathy-networking-support-664946-rebase: 2/64] [Chess Screen] Set welcome-screen and game-screen default sizes



commit a2c905bea293e470e8597c9372f47095e83ab777
Author: Chandni Verma <chandniverma2112 gmail com>
Date:   Sat Mar 31 15:10:39 2012 +0530

    [Chess Screen] Set welcome-screen and game-screen default sizes

 data/org.gnome.gnome-chess.gschema.xml.in |   34 +++++++++++++++++++++-
 src/gnome-chess.vala                      |   43 +++++++++++++++++++++++++++-
 2 files changed, 73 insertions(+), 4 deletions(-)
---
diff --git a/data/org.gnome.gnome-chess.gschema.xml.in b/data/org.gnome.gnome-chess.gschema.xml.in
index 42bafb9..daf2599 100644
--- a/data/org.gnome.gnome-chess.gschema.xml.in
+++ b/data/org.gnome.gnome-chess.gschema.xml.in
@@ -31,12 +31,42 @@
   </enum>
 
   <schema id="org.gnome.gnome-chess.Settings" path="/org/gnome/gnome-chess/" gettext-domain="gnome-games">
-    <key name="width" type="i">
+    <key name="welcome-screen-width" type="i">
+      <default>600</default>
+      <_summary>The width of welcome screen</_summary>
+      <_description>The width of welcome screen in pixels.</_description>
+    </key>
+    <key name="welcome-screen-height" type="i">
+      <default>300</default>
+      <_summary>The height of the welcome screen</_summary>
+      <_description>The height of the welcome screen in pixels.</_description>
+    </key>
+    <key name="remote-player-selector-width" type="i">
+      <default>600</default>
+      <_summary>The width of the welcome screen</_summary>
+      <_description>The width of the welcome screen in pixels.</_description>
+    </key>
+    <key name="remote-player-selector-height" type="i">
+      <default>400</default>
+      <_summary>The height of remote player selector screen</_summary>
+      <_description>The height of remote player selector screen in pixels.</_description>
+    </key>
+    <key name="preferences-screen-width" type="i">
+      <default>600</default>
+      <_summary>The width of preferences screen</_summary>
+      <_description>The width of preferences screen in pixels.</_description>
+    </key>
+    <key name="preferences-screen-height" type="i">
+      <default>300</default>
+      <_summary>The height of preferences screen</_summary>
+      <_description>The height of preferences screen in pixels.</_description>
+    </key>
+    <key name="game-screen-width" type="i">
       <default>500</default>
       <_summary>The width of the window</_summary>
       <_description>The width of the main window in pixels.</_description>
     </key>
-    <key name="height" type="i">
+    <key name="game-screen-height" type="i">
       <default>550</default>
       <_summary>The height of the window</_summary>
       <_description>The height of the main window in pixels.</_description>
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 433db19..59ebc68 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -1015,8 +1015,35 @@ public class Application : Gtk.Application
     {
         if (!settings.get_boolean ("maximized") && !settings.get_boolean ("fullscreen"))
         {
-            settings.set_int ("width", event.width);
-            settings.set_int ("height", event.height);
+            if (grid_welcome.visible)
+            {
+                if (grid_preferences.visible)
+                {
+                    settings.set_int ("preferences-screen-width", event.width);
+                    settings.set_int ("preferences-screen-height",
+                    event.height);
+                }
+                else
+                {
+                    if (grid_select_remote_player.visible)
+                    {
+                        settings.set_int ("remote-player-selector-width",
+                        event.width);
+                        settings.set_int ("remote-player-selector-height",
+                        event.height);
+                    }
+                    else
+                    {
+                        settings.set_int ("welcome-screen-width", event.width);
+                        settings.set_int ("welcome-screen-height", event.height);
+                    }
+                }
+            }
+            else
+            {
+                settings.set_int ("game-screen-width", event.width);
+                settings.set_int ("game-screen-height", event.height);
+            }
         }
 
         return false;
@@ -1044,6 +1071,8 @@ public class Application : Gtk.Application
     {
         game_vbox.hide ();
         grid_welcome.show ();
+        window.resize (settings.get_int ("welcome-screen-width"),
+            settings.get_int ("welcome-screen-height"));
 
         grid_select_game.show ();
         grid_select_opponent.hide ();
@@ -1056,6 +1085,8 @@ public class Application : Gtk.Application
     {
         game_vbox.hide ();
         grid_welcome.show ();
+        window.resize (settings.get_int ("welcome-screen-width"),
+            settings.get_int ("welcome-screen-height"));
 
         grid_select_game.hide ();
         grid_select_opponent.show ();
@@ -1068,6 +1099,8 @@ public class Application : Gtk.Application
     {
         game_vbox.hide ();
         grid_welcome.show ();
+        window.resize (settings.get_int ("remote-player-selector-width"),
+            settings.get_int ("remote-player-selector-height"));
 
         grid_select_game.hide ();
         grid_select_opponent.hide ();
@@ -1080,6 +1113,8 @@ public class Application : Gtk.Application
     {
         game_vbox.hide ();
         grid_welcome.show ();
+        window.resize (settings.get_int ("welcome-screen-width"),
+            settings.get_int ("welcome-screen-height"));
 
         grid_select_game.hide ();
         grid_select_opponent.hide ();
@@ -1092,6 +1127,8 @@ public class Application : Gtk.Application
     {
         game_vbox.hide ();
         grid_welcome.show ();
+        window.resize (settings.get_int ("preferences-screen-width"),
+            settings.get_int ("preferences-screen-height"));
 
         grid_select_game.hide ();
         grid_select_opponent.hide ();
@@ -1104,6 +1141,8 @@ public class Application : Gtk.Application
     {
         game_vbox.show ();
         grid_welcome.hide ();
+        window.resize (settings.get_int ("game-screen-width"),
+            settings.get_int ("game-screen-height"));
     }
 
     [CCode (cname = "G_MODULE_EXPORT game_selected_cb", instance_pos = 1.1)]



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