[meld] sourceview: Delay settings connection until realize



commit 9380e02fa66187d9bc2cf1046cc8627b394fdb20
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Jul 5 09:52:44 2019 +1000

    sourceview: Delay settings connection until realize
    
    There's no reason to connect at initialisation time.

 meld/sourceview.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/meld/sourceview.py b/meld/sourceview.py
index 296327bc..52cb7c11 100644
--- a/meld/sourceview.py
+++ b/meld/sourceview.py
@@ -25,7 +25,7 @@ from gi.repository import Gtk
 from gi.repository import GtkSource
 
 from meld.meldbuffer import MeldBuffer
-from meld.settings import bind_settings, meldsettings, settings
+from meld.settings import bind_settings, get_meld_settings, settings
 from meld.style import colour_lookup_with_fallback, get_common_theme
 
 
@@ -197,8 +197,6 @@ class MeldSourceView(GtkSource.View, SourceViewHelperMixin):
         buf.create_tag("dimmed")
         self.set_buffer(buf)
 
-        meldsettings.connect('changed', self.on_setting_changed)
-
     def do_paste_clipboard(self, *args):
         # This is an awful hack to replace another awful hack. The idea
         # here is to sanitise the clipboard contents so that it doesn't
@@ -287,8 +285,13 @@ class MeldSourceView(GtkSource.View, SourceViewHelperMixin):
         self.draw_spaces_bool = draw_spaces_to_bool(
             None, self.props.draw_spaces)
 
-        self.on_setting_changed(meldsettings, 'font')
-        self.on_setting_changed(meldsettings, 'style-scheme')
+        meld_settings = get_meld_settings()
+
+        self.on_setting_changed(meld_settings, 'font')
+        self.on_setting_changed(meld_settings, 'style-scheme')
+
+        meld_settings.connect('changed', self.on_setting_changed)
+
         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]