[meld] Migrate to using GtkStyleContext everywhere for colour lookup



commit 210ea666e83e36301f03892bfac0077167ea7e12
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue Dec 31 12:19:00 2013 +1000

    Migrate to using GtkStyleContext everywhere for colour lookup

 meld/diffmap.py  |    8 ++++----
 meld/dirdiff.py  |    9 +++++----
 meld/filediff.py |    8 ++++----
 meld/tree.py     |    4 ++--
 meld/vcview.py   |    3 ++-
 5 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/meld/diffmap.py b/meld/diffmap.py
index 62d0efb..9d143a5 100644
--- a/meld/diffmap.py
+++ b/meld/diffmap.py
@@ -47,11 +47,11 @@ class DiffMap(Gtk.DrawingArea):
             o.disconnect(h)
 
         self._scrolladj = scrollbar.get_adjustment()
-        self.on_scrollbar_style_set(scrollbar, None)
+        self.on_scrollbar_style_updated(scrollbar)
         self.on_scrollbar_size_allocate(scrollbar, scrollbar.get_allocation())
         scrollbar.ensure_style()
-        scroll_style_hid = scrollbar.connect("style-set",
-                                             self.on_scrollbar_style_set)
+        scroll_style_hid = scrollbar.connect("style-updated",
+                                             self.on_scrollbar_style_updated)
         scroll_size_hid = scrollbar.connect("size-allocate",
                                             self.on_scrollbar_size_allocate)
         adj_change_hid = self._scrolladj.connect("changed",
@@ -75,7 +75,7 @@ class DiffMap(Gtk.DrawingArea):
         self.fill_colors, self.line_colors = color_map
         self.queue_draw()
 
-    def on_scrollbar_style_set(self, scrollbar, previous_style):
+    def on_scrollbar_style_updated(self, scrollbar):
         value = GObject.Value(int)
         scrollbar.style_get_property("stepper-size", value)
         stepper_size = value.get_int()
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 8ad12c2..d893262 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -328,13 +328,14 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                                      "vbox"])
 
         self.widget.ensure_style()
-        self.on_style_set(self.widget, None)
-        self.widget.connect("style-set", self.on_style_set)
+        self.on_style_updated(self.widget)
+        self.widget.connect("style-updated", self.on_style_updated)
 
         self.custom_labels = []
         self.set_num_panes(num_panes)
 
-        self.widget.connect("style-set", self.model.on_style_set)
+        self.widget.connect("style-updated", self.model.on_style_updated)
+        self.model.on_style_updated(self.widget)
 
         self.do_to_others_lock = False
         self.focus_in_events = []
@@ -441,7 +442,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                 action_name = self.state_actions[s][1]
                 self.actiongroup.get_action(action_name).set_active(True)
 
-    def on_style_set(self, widget, prev_style):
+    def on_style_updated(self, widget):
         style = widget.get_style_context()
 
         def lookup(name, default):
diff --git a/meld/filediff.py b/meld/filediff.py
index 0b2957c..fa75e18 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -312,8 +312,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         self.findbar = findbar.FindBar(self.grid)
 
         self.widget.ensure_style()
-        self.on_style_set(self.widget, None)
-        self.widget.connect("style-set", self.on_style_set)
+        self.on_style_updated(self.widget)
+        self.widget.connect("style-updated", self.on_style_updated)
 
         self.set_num_panes(num_panes)
         self.cursor = CursorDetails()
@@ -405,8 +405,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         elif event.type == Gdk.EventType.KEY_RELEASE:
             self.keymask &= ~mod_key
 
-    def on_style_set(self, widget, prev_style):
-        style = widget.get_style()
+    def on_style_updated(self, widget):
+        style = widget.get_style_context()
 
         def lookup(name, default):
             found, colour = style.lookup_color(name)
diff --git a/meld/tree.py b/meld/tree.py
index 8ff8dde..ca3750e 100644
--- a/meld/tree.py
+++ b/meld/tree.py
@@ -46,8 +46,8 @@ class DiffTreeStore(Gtk.TreeStore):
         self.ntree = ntree
         self._setup_default_styles()
 
-    def on_style_set(self, widget, prev_style):
-        style = widget.get_style()
+    def on_style_updated(self, widget):
+        style = widget.get_style_context()
         self._setup_default_styles(style)
 
     def _setup_default_styles(self, style=None):
diff --git a/meld/vcview.py b/meld/vcview.py
index 59f111f..07ca36e 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -172,7 +172,8 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
         self.actiongroup = self.VcviewActions
         self.actiongroup.set_translation_domain("meld")
         self.model = VcTreeStore()
-        self.widget.connect("style-set", self.model.on_style_set)
+        self.widget.connect("style-updated", self.model.on_style_updated)
+        self.model.on_style_updated(self.widget)
         self.treeview.set_model(self.model)
         selection = self.treeview.get_selection()
         selection.set_mode(Gtk.SelectionMode.MULTIPLE)


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