[gnome-boxes] graph: Use style's state to draw rather than widget's



commit 745383cb96f4d22e2998344ccb9bf948b3843710
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Mar 15 18:22:48 2016 +0000

    graph: Use style's state to draw rather than widget's
    
    Passing a fixed state to Gtk.StyleContext.get_color() will result in
    warnings on the console with latest gtk+ and is not supported way of
    doing things anymore. This patch sets the required state on the style and
    then uses the style's state to get the color for that state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763677

 src/resource-graph.vala |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/resource-graph.vala b/src/resource-graph.vala
index 958334b..584dcbb 100644
--- a/src/resource-graph.vala
+++ b/src/resource-graph.vala
@@ -43,7 +43,10 @@ private class Boxes.ResourceGraph: Gtk.DrawingArea {
         if (ymax != 0)
             dy = (double) height / ymax;
 
-        Gdk.cairo_set_source_rgba (cr, style.get_color (Gtk.StateFlags.NORMAL));
+        style.save ();
+        style.set_state (Gtk.StateFlags.NORMAL);
+        Gdk.cairo_set_source_rgba (cr, style.get_color (get_state_flags ()));
+        style.restore ();
         var x = 0.0;
         foreach (var p in points) {
             var y = height - p * dy;


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