[PATCH] Fix saving of multiple modified files on quit



Previously, file modifications could be lost when quitting meld
when multiple diff panes were open and more than 1 of the panes
had file modifications.  Quitting would prompt the user to
Discard/Cancel/Save the changes in one of the modified panes.  Pressing
"Discard Changes" would result in Meld quitting immediately without
prompting the user if they wanted to save the other modified files.

This issue only occurred if multiple diff panes were open, eg when using
Meld to diff/modify multiple files in a version-controlled directory.

Signed-off-by: Peter Tyser <ptyser gmail com>
---
 meld/meldapp.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/meld/meldapp.py b/meld/meldapp.py
index 7de8ab3..0f5b6c6 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -642,12 +642,14 @@ class MeldApp(gnomeglade.Component):
             self.try_remove_page(page)
 
     def on_menu_quit_activate(self, *extra):
-        for c in self.notebook.get_children():
-            response = c.get_data("pyobject").on_delete_event(appquit=1)
+        # Delete pages from right-to-left.  This ensures that if a version
+        # control page is open in the far left page, it will be deleted last.
+        for c in reversed(self.notebook.get_children()):
+            page = c.get_data("pyobject")
+            self.notebook.set_current_page(self.notebook.page_num(page.widget))
+            response = page.on_delete_event(appquit=1)
             if response == gtk.RESPONSE_CANCEL:
                 return gtk.RESPONSE_CANCEL
-            elif response == gtk.RESPONSE_CLOSE:
-                break
         for c in self.notebook.get_children():
             c.get_data("pyobject").on_quit_event()
         gtk.main_quit()
-- 
1.6.2-rc2.GIT



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