[meld] filediff: Check for unsaved changes on encoding reload (ggo#151)



commit 8a085638ab734d551b8d3d7108ce913abf8bd670
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Jan 19 06:36:07 2018 +1000

    filediff: Check for unsaved changes on encoding reload (ggo#151)
    
    We're reusing the revert dialog here, because that's actually what is
    happening. We could come up with a new one (or include a bit more
    explanatory text) but I feel like it's... fairly clear what's happening?
    I hope...

 meld/filediff.py | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index e04dc496..1fa94f41 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -233,6 +233,8 @@ class FileDiff(MeldDoc, Component):
                 GObject.BindingFlags.DEFAULT)
 
             def reload_with_encoding(widget, encoding, pane):
+                if not self.check_unsaved_changes():
+                    return
                 self.set_file(pane, self.textbuffer[pane].data.gfile, encoding)
 
             def go_to_line(widget, line, pane):


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