[gnome-boxes] Improve the themeing



commit e6ccb0e6a06643fa2c3207ac72f79eee4782723f
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Mon Oct 10 22:52:32 2011 +0200

    Improve the themeing

 data/gtk-style.css |   10 ++++++++++
 src/app.vala       |   16 +++++++++++++---
 src/machine.vala   |   15 +++++++++------
 src/sidebar.vala   |    1 +
 4 files changed, 33 insertions(+), 9 deletions(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index 5eb10b6..5f7781e 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -1,4 +1,14 @@
+ define-color boxes_bg_color darker (@theme_bg_color);
+
 #TopbarLabel {
     font-size: 14;
     font-weight: bold;
 }
+
+.view {
+    background-color: @theme_bg_color;
+}
+
+.boxes-bg {
+    background-color: @boxes_bg_color;
+}
diff --git a/src/app.vala b/src/app.vala
index 0a20ee1..a17bb45 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -80,9 +80,19 @@ private class Boxes.App: Boxes.UI {
         window.add (embed);
         stage = embed.get_stage () as Clutter.Stage;
 
-        var background = new GtkClutter.Actor (); // just to have background
-        background.add_constraint (new Clutter.BindConstraint (stage, BindCoordinate.SIZE, 0));
-        stage.add_actor (background);
+        var style = new Gtk.StyleContext ();
+        var path = new Gtk.WidgetPath ();
+        path.append_type (typeof (Gtk.Window));
+        style.set_path (path);
+        style.add_class ("boxes-bg");
+        var gdk_rgba = style.get_background_color (0);
+        Clutter.Color color = {
+            (uint8) (gdk_rgba.red * 255).clamp (0, 255),
+            (uint8) (gdk_rgba.green * 255).clamp (0, 255),
+            (uint8) (gdk_rgba.blue * 255).clamp (0, 255),
+            (uint8) (gdk_rgba.alpha * 255).clamp (0, 255)
+        };
+        stage.set_color (color);
 
         state = new Clutter.State ();
         state.set_duration (null, null, duration);
diff --git a/src/machine.vala b/src/machine.vala
index dc962d0..bf8acdd 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -148,12 +148,12 @@ private class Boxes.Machine: Boxes.CollectionItem {
             var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, width, height);
             var context = new Cairo.Context (surface);
 
-            var pattern = new Cairo.Pattern.linear (0, 0, 0, height);
-            pattern.add_color_stop_rgb (0, 0.260, 0.260, 0.260);
-            pattern.add_color_stop_rgb (1, 0.220, 0.220, 0.220);
-
-            context.set_source (pattern);
-            context.paint ();
+            // make it take color from theme
+            // var pattern = new Cairo.Pattern.linear (0, 0, 0, height);
+            // pattern.add_color_stop_rgb (0, 0.260, 0.260, 0.260);
+            // pattern.add_color_stop_rgb (1, 0.220, 0.220, 0.220);
+            // context.set_source (pattern);
+            // context.paint ();
 
             int size = (int) (height * 0.5);
             var icon_info = IconTheme.get_default ().lookup_icon ("computer-symbolic", size,
@@ -231,6 +231,9 @@ private class Boxes.MachineActor: Boxes.UI {
 
         vbox = new Gtk.VBox (false, 0);
         gtk_vbox = new GtkClutter.Actor.with_contents (vbox);
+
+        gtk_vbox.get_widget ().get_style_context ().add_class ("boxes-bg");
+
         label = new Gtk.Label (machine.name);
         vbox.add (label);
         entry = new Gtk.Entry ();
diff --git a/src/sidebar.vala b/src/sidebar.vala
index d3db182..d1e016b 100644
--- a/src/sidebar.vala
+++ b/src/sidebar.vala
@@ -61,6 +61,7 @@ private class Boxes.Sidebar: Boxes.UI {
         notebook.append_page (vbox, new Gtk.Label (""));
 
         tree_view = new Gtk.TreeView ();
+        tree_view.set_name ("MyTreeview");
         var selection = tree_view.get_selection ();
         selection.set_select_function (selection_func);
         tree_view_activate_on_single_click (tree_view, true);



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