[meld] meldbuffer: Make our buffer data reflect the encoding of the source file



commit e9f6bb9f6e658e04a42fc8590e7fc48bdd9e5814
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Oct 28 09:00:53 2017 +1000

    meldbuffer: Make our buffer data reflect the encoding of the source file

 meld/meldbuffer.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/meld/meldbuffer.py b/meld/meldbuffer.py
index ce9cb57..71e2c12 100644
--- a/meld/meldbuffer.py
+++ b/meld/meldbuffer.py
@@ -107,6 +107,12 @@ class MeldBufferData(GObject.GObject):
         str('file-changed'): (GObject.SignalFlags.RUN_FIRST, None, ()),
     }
 
+    encoding = GObject.property(
+        type=GtkSource.Encoding,
+        nick="The file encoding of the linked GtkSourceFile",
+        default=None,
+    )
+
     def __init__(self):
         GObject.GObject.__init__(self)
         self._gfile = None
@@ -183,6 +189,8 @@ class MeldBufferData(GObject.GObject):
         self._gfile = value
         self._sourcefile = GtkSource.File()
         self._sourcefile.set_location(value)
+        self._sourcefile.bind_property(
+            'encoding', self, 'encoding', GObject.BindingFlags.DEFAULT)
 
         # This is aiming to maintain existing behaviour for filename. The
         # behaviour is however wrong and should be fixed.


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