[gnome-clocks] Always pass the current css state to get_color



commit 53c07b38cf21607e3d0457a07802bbffc6656c3e
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Nov 22 17:19:07 2015 +0100

    Always pass the current css state to get_color

 src/stopwatch.vala |    4 ++--
 src/timer.vala     |    9 ++++-----
 src/widgets.vala   |    2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/stopwatch.vala b/src/stopwatch.vala
index 66bc86d..01be908 100644
--- a/src/stopwatch.vala
+++ b/src/stopwatch.vala
@@ -42,7 +42,7 @@ public class Frame : AnalogFrame {
         cr.set_line_width (LINE_WIDTH);
         cr.set_line_cap  (Cairo.LineCap.ROUND);
 
-        var color = context.get_color (Gtk.StateFlags.NORMAL);
+        var color = context.get_color (context.get_state ());
         var progress = ((double) seconds + millisecs) / 60;
         if (progress > 0) {
             cr.arc (center_x,
@@ -60,7 +60,7 @@ public class Frame : AnalogFrame {
         context.add_class ("progress-fast");
 
         cr.set_line_width (LINE_WIDTH - 2);
-        color = context.get_color (Gtk.StateFlags.NORMAL);
+        color = context.get_color (context.get_state ());
         progress = millisecs;
         if (progress > 0) {
             cr.arc (center_x,
diff --git a/src/timer.vala b/src/timer.vala
index ef6e305..c51ece3 100644
--- a/src/timer.vala
+++ b/src/timer.vala
@@ -45,19 +45,18 @@ public class CountdownFrame : AnalogFrame {
     }
 
     public override void draw_progress (Cairo.Context cr, int center_x, int center_y, int radius) {
+        var progress = get_progress ();
         var context = get_style_context ();
 
         context.save ();
         context.add_class ("progress");
 
-        cr.set_line_width (LINE_WIDTH);
-        cr.set_line_cap  (Cairo.LineCap.ROUND);
-
-        var color = context.get_color (Gtk.StateFlags.NORMAL);
+        var color = context.get_color (context.get_state ());
 
-        var progress = get_progress ();
         cr.arc (center_x, center_y, radius - LINE_WIDTH / 2, 1.5  * Math.PI, (1.5 + (1 - progress) * 2 ) * 
Math.PI);
         Gdk.cairo_set_source_rgba (cr, color);
+        cr.set_line_width (LINE_WIDTH);
+        cr.set_line_cap  (Cairo.LineCap.ROUND);
         cr.stroke ();
 
         context.restore ();
diff --git a/src/widgets.vala b/src/widgets.vala
index 849a32d..6e54f52 100644
--- a/src/widgets.vala
+++ b/src/widgets.vala
@@ -838,7 +838,7 @@ public class AnalogFrame : Gtk.Frame {
         context.save ();
         context.add_class (Gtk.STYLE_CLASS_TROUGH);
 
-        var color = context.get_color (Gtk.StateFlags.NORMAL);
+        var color = context.get_color (context.get_state ());
 
         cr.set_line_width (LINE_WIDTH);
         Gdk.cairo_set_source_rgba (cr, color);


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