[meld: 25/63] meldbuffer: Create and keep a sourcefile associated with our buffer



commit 1ef1ee2421d5a471f90e9a193cb9edb2324ee92c
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Aug 2 07:49:33 2015 +1000

    meldbuffer: Create and keep a sourcefile associated with our buffer
    
    This is nice anyway, but we need to do this for saving, so that we
    get GtkSourceView-supported notifications of whether the file has
    changed on disk.

 meld/meldbuffer.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/meld/meldbuffer.py b/meld/meldbuffer.py
index e1fcc76..302eb1c 100644
--- a/meld/meldbuffer.py
+++ b/meld/meldbuffer.py
@@ -108,6 +108,7 @@ class MeldBufferData(GObject.GObject):
         self._gfile = None
         self._label = None
         self._monitor = None
+        self._sourcefile = None
         self.reset(gfile=None)
 
     def reset(self, gfile):
@@ -176,6 +177,9 @@ class MeldBufferData(GObject.GObject):
     def gfile(self, value):
         self._disconnect_monitor()
         self._gfile = value
+        self._sourcefile = GtkSource.File()
+        self._sourcefile.set_location(value)
+
         # This is aiming to maintain existing behaviour for filename. The
         # behaviour is however wrong and should be fixed.
         self.filename = value.get_path().decode('utf8') if value else None
@@ -183,6 +187,10 @@ class MeldBufferData(GObject.GObject):
         self._connect_monitor()
 
     @property
+    def sourcefile(self):
+        return self._sourcefile
+
+    @property
     def writable(self):
         path = self.savefile or self.filename
         if not path:


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