[pitivi] Use GTK3 StateFlags instead of StateType to get theme colors



commit 5181f27ea6d645fc89b1aaf8cf05b390063e2a17
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Tue Aug 21 22:27:00 2012 -0400

    Use GTK3 StateFlags instead of StateType to get theme colors

 pitivi/timeline/layer.py |    5 ++---
 pitivi/timeline/ruler.py |    8 +++++---
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index 6c12624..bd42e03 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -50,11 +50,10 @@ class BaseLayerControl(gtk.VBox, Loggable):
         context = self.get_style_context()
 
         # get the default color for the current theme
-        self.UNSELECTED_COLOR = context.get_background_color(gtk.STATE_NORMAL)
+        self.UNSELECTED_COLOR = context.get_background_color(gtk.StateFlags.NORMAL)
         # use base instead of bg colors so that we get the lighter color
         # that is used for list items in TreeView.
-        #FIXME gtk.STATE_SELECTED fails
-        self.SELECTED_COLOR = context.get_background_color(gtk.STATE_NORMAL)
+        self.SELECTED_COLOR = context.get_background_color(gtk.StateFlags.SELECTED)
 
         table = gtk.Table(rows=2, columns=2)
         table.props.border_width = 2
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index cbcb509..33f7e3e 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -198,12 +198,12 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
 
     def drawBackground(self, cr):
         style = self.get_style_context()
-        setCairoColor(cr, style.get_background_color(gtk.STATE_NORMAL))
+        setCairoColor(cr, style.get_background_color(gtk.StateFlags.NORMAL))
         cr.rectangle(0, 0, cr.get_target().get_width(), cr.get_target().get_height())
         cr.fill()
         offset = int(self.nsToPixel(gst.CLOCK_TIME_NONE)) - self.pixbuf_offset
         if offset > 0:
-            setCairoColor(cr, style.get_background_color(gtk.STATE_ACTIVE))
+            setCairoColor(cr, style.get_background_color(gtk.StateFlags.ACTIVE))
             cr.rectangle(0, 0, int(offset), cr.get_target().get_height())
             cr.fill()
 
@@ -276,7 +276,9 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
             paintpos = -frame_width + 0.5
             height = cr.get_target().get_height()
             y = int(height - self.frame_height)
-            states = [gtk.STATE_ACTIVE, gtk.STATE_PRELIGHT]
+            # INSENSITIVE is a dark shade of gray, but lacks contrast
+            # SELECTED will be bright blue and more visible to represent frames
+            states = [gtk.StateFlags.ACTIVE, gtk.StateFlags.SELECTED]
             paintpos += frame_width - offset
             frame_num = int(paintpos // frame_width) % 2
             style = self.get_style_context()



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