[meld] filediff: Handle save responses better in delete events (bgo#744081)



commit 501ac484362326ca0f2d51cb40629f08c64c8336
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Feb 7 06:14:26 2015 +1000

    filediff: Handle save responses better in delete events (bgo#744081)
    
    The "you have modified files" dialog offers a "Close without saving"
    option, which returns a CLOSE response code instead of our usual OK.
    This was being handled correctly in most places, but not when the tab
    was being closed via a delete event. This patch fixes it so that the
    check_save_modified() always returns either OK or CANCEL, since that's
    really the only thing we need out of it.
    
    This commit also removes a stray delete-event handler on a widget that
    should never ever be loaded.

 data/ui/filediff.ui |    1 -
 meld/filediff.py    |    3 +++
 2 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/filediff.ui b/data/ui/filediff.ui
index 2e9f3e6..4949713 100644
--- a/data/ui/filediff.ui
+++ b/data/ui/filediff.ui
@@ -280,7 +280,6 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">window1</property>
-    <signal name="destroy" handler="on_delete_event" swapped="no"/>
     <child>
       <object class="GtkVBox" id="filediff">
         <property name="visible">True</property>
diff --git a/meld/filediff.py b/meld/filediff.py
index 2fa674a..c56c381 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -883,6 +883,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
             elif response == Gtk.ResponseType.DELETE_EVENT:
                 response = Gtk.ResponseType.CANCEL
 
+        if response == Gtk.ResponseType.CLOSE:
+            response = Gtk.ResponseType.OK
+
         if response == Gtk.ResponseType.OK and self.meta:
             parent = self.meta.get('parent', None)
             saved = self.meta.get('middle_saved', False)


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