[lightsoff/wip/gtkview] Added gtk styling to match the clutter theme



commit 9d1e72b550ff3dbf867f19d43d0bbf4946b7bbe8
Author: Robert Roth <robert roth off gmail com>
Date:   Thu Jul 5 20:28:42 2018 +0300

    Added gtk styling to match the clutter theme

 data/lightsoff.css          | 27 +++++++++++++++++++++++++++
 src/lightsoff-window.vala   |  5 +++++
 src/lightsoff.gresource.xml |  2 +-
 3 files changed, 33 insertions(+), 1 deletion(-)
---
diff --git a/data/lightsoff.css b/data/lightsoff.css
new file mode 100644
index 0000000..f9daa97
--- /dev/null
+++ b/data/lightsoff.css
@@ -0,0 +1,27 @@
+.appmenu {
+  border: none;
+}
+
+.grid > .toggle, .grid > .toggle:backdrop, .grid > .toggle:focus {
+  background-image: linear-gradient(90deg, #050505, #222);
+  /*background-color: black;*/
+  border-color: #353535;
+  border-radius: 5px;
+  border-width: 1px;
+  margin: 4px;
+  box-shadow: none;
+  transition: 150ms;
+}
+
+.grid > .toggle:checked/*, .grid > .toggle:hover */{
+  border-width: 1px;
+  border-color: #729fcf;
+  background-image: linear-gradient(90deg,  #35669b, #5e92c8);
+  box-shadow: none;
+  margin: 0;
+  transition: 150ms;
+}
+
+.aspect {
+  background-color: black;
+}
diff --git a/src/lightsoff-window.vala b/src/lightsoff-window.vala
index a392435..10891c6 100644
--- a/src/lightsoff-window.vala
+++ b/src/lightsoff-window.vala
@@ -50,6 +50,8 @@ public class LightsoffWindow : ApplicationWindow
     public Gtk.Widget build_gtk_game_container (int level, out GameView out_game_view)
     {
         var aspect_frame = new Gtk.AspectFrame (null, 0.5f, 0.5f, 1.0f, false);
+        aspect_frame.set_shadow_type (ShadowType.NONE);
+        aspect_frame.get_style_context ().add_class ("aspect");
         aspect_frame.show ();
 
         GtkGameView gtk_game_view = new GtkGameView (level);
@@ -58,6 +60,9 @@ public class LightsoffWindow : ApplicationWindow
         aspect_frame.add (gtk_game_view);
 
         out_game_view = gtk_game_view;
+        var provider = new Gtk.CssProvider ();
+        provider.load_from_resource ("/org/gnome/lightsoff/ui/lightsoff.css");
+        Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, 
STYLE_PROVIDER_PRIORITY_APPLICATION);
         return aspect_frame;
     }
 
diff --git a/src/lightsoff.gresource.xml b/src/lightsoff.gresource.xml
index f29f055..ecc06fb 100644
--- a/src/lightsoff.gresource.xml
+++ b/src/lightsoff.gresource.xml
@@ -2,7 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/lightsoff/ui">
     <file preprocess="xml-stripblanks" alias="lightsoff.ui">../data/lightsoff.ui</file>
-    <!-- <file alias="lightsoff.css">../data/lightsoff.css</file> -->
+    <file alias="lightsoff.css">../data/lightsoff.css</file>
   </gresource>
   <gresource prefix="/org/gnome/lightsoff/gtk">
     <file preprocess="xml-stripblanks" alias="menus.ui">../data/lightsoff-menus.ui</file>


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