[meld] filediff: Reset chooser filename for cancelled selection (bgo#741928)



commit f901908f5e2244bca8959ffebdb086311eff585a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue Dec 30 08:45:26 2014 +1000

    filediff: Reset chooser filename for cancelled selection (bgo#741928)
    
    If the user has an unsaved file and selects a new file in the chooser,
    we prompt for saving the existing file. If that dialog is cancelled,
    we're left in an inconsistent state where the file chooser thinks
    we've got one file, and the buffer has another.
    
    This commit adds a slightly bodgy workaround for this situation, just
    manually checking whether the action was cancelled. It would be
    possible to do something more serious by performing our checks before
    the chooser dialog closes, but that would be a lot more work for little
    gain.

 meld/filediff.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index a73561b..cc78a16 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1739,11 +1739,15 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         self.save_file(idx)
 
     def on_fileentry_file_set(self, entry):
+        entries = self.fileentry[:self.num_panes]
         if self.check_save_modified() != Gtk.ResponseType.CANCEL:
-            entries = self.fileentry[:self.num_panes]
             files = [e.get_file() for e in entries]
             paths = [f.get_path() for f in files]
             self.set_files(paths)
+        else:
+            idx = entries.index(entry)
+            existing_path = self.textbuffer[idx].data.filename
+            entry.set_filename(existing_path)
         return True
 
     def _get_focused_pane(self):


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