[iagno] Let GameWindow load the CSS.



commit 48eaf0ed469a62697c5139a1fc71a185e4429232
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue Mar 3 21:24:21 2015 +0100

    Let GameWindow load the CSS.

 src/game-window.vala |    9 ++++++++-
 src/iagno.vala       |    7 ++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/game-window.vala b/src/game-window.vala
index 078fb12..e9c3bef 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -88,8 +88,15 @@ public class GameWindow : ApplicationWindow
     public SimpleAction undo_action;
     public SimpleAction redo_action;
 
-    public GameWindow (string name, int width, int height, bool maximized, bool start_now, GameWindowFlags 
flags, Box new_game_screen, Widget _view)
+    public GameWindow (string? css_resource, string name, int width, int height, bool maximized, bool 
start_now, GameWindowFlags flags, Box new_game_screen, Widget _view)
     {
+        if (css_resource != null)
+        {
+            CssProvider css_provider = new CssProvider ();
+            css_provider.load_from_resource (css_resource);
+            StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), css_provider, 
STYLE_PROVIDER_PRIORITY_APPLICATION);
+        }
+
         view = _view;
 
         /* window actions */
diff --git a/src/iagno.vala b/src/iagno.vala
index dc048f9..2e12205 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -143,10 +143,6 @@ public class Iagno : Gtk.Application
     {
         base.startup ();
 
-        CssProvider css_provider = new CssProvider ();
-        css_provider.load_from_resource ("/org/gnome/iagno/ui/iagno.css");
-        StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), css_provider, 
STYLE_PROVIDER_PRIORITY_APPLICATION);
-
         /* Settings */
         settings = new GLib.Settings ("org.gnome.iagno");
 
@@ -179,7 +175,8 @@ public class Iagno : Gtk.Application
         view.theme = settings.get_string ("theme");
 
         /* Window */
-        window = new GameWindow (_("Iagno"),
+        window = new GameWindow ("/org/gnome/iagno/ui/iagno.css",
+                                 _("Iagno"),
                                  settings.get_int ("window-width"),
                                  settings.get_int ("window-height"),
                                  settings.get_boolean ("window-is-maximized"),


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