[meld] sourceview: Delay settings init to realize for theme lookup changes



commit e25a1b030738019593f2fe4f3cc8c12b71a34b1b
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Mon Oct 23 07:03:14 2017 +1000

    sourceview: Delay settings init to realize for theme lookup changes
    
    We're about to want to initialise a MeldSourceView when doing colour
    lookups for themes, which fails on infinite recursion currently. The
    easiest (and technically probably correct) way of fixing this is to
    delay the settings initialisation in the widget until we actually hit
    the realize hook.

 meld/sourceview.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/meld/sourceview.py b/meld/sourceview.py
index 451ae79..1cf6cd1 100644
--- a/meld/sourceview.py
+++ b/meld/sourceview.py
@@ -150,8 +150,6 @@ class MeldSourceView(GtkSource.View):
         self.set_buffer(buf)
 
         meldsettings.connect('changed', self.on_setting_changed)
-        self.on_setting_changed(meldsettings, 'font')
-        self.on_setting_changed(meldsettings, 'style-scheme')
 
     def get_y_for_line_num(self, line):
         buf = self.get_buffer()
@@ -191,6 +189,8 @@ class MeldSourceView(GtkSource.View):
 
     def do_realize(self):
         bind_settings(self)
+        self.on_setting_changed(meldsettings, 'font')
+        self.on_setting_changed(meldsettings, 'style-scheme')
         return GtkSource.View.do_realize(self)
 
     def do_draw_layer(self, layer, context):


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