[meld/ui-next: 27/35] sourceview: Hook up compact view property to config



commit fb63fdf63302fe854113ce13f9ffd13b3d36a929
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Feb 15 09:53:05 2019 +1000

    sourceview: Hook up compact view property to config

 meld/sourceview.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/meld/sourceview.py b/meld/sourceview.py
index 8cf77917..7403e853 100644
--- a/meld/sourceview.py
+++ b/meld/sourceview.py
@@ -407,6 +407,10 @@ class MeldSourceMap(GtkSource.Map, SourceViewHelperMixin):
 
     __gtype_name__ = "MeldSourceMap"
 
+    __gsettings_bindings_view__ = (
+        ('use-compact-sourcemap', 'compact-view'),
+    )
+
     compact_view = GObject.Property(
         type=bool,
         nick="Limit the view to a fixed width",
@@ -415,6 +419,14 @@ class MeldSourceMap(GtkSource.Map, SourceViewHelperMixin):
 
     COMPACT_MODE_WIDTH = 40
 
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        self.connect('notify::compact-view', lambda *args: self.queue_resize())
+
+    def do_realize(self):
+        bind_settings(self)
+        return GtkSource.Map.do_realize(self)
+
     def do_draw_layer(self, layer, context):
         if layer != Gtk.TextViewLayer.BELOW_TEXT:
             return GtkSource.Map.do_draw_layer(self, layer, context)


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