[kernel] r5699 - people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor

Bastian Blank waldi at costa.debian.org
Fri Feb 3 01:07:40 UTC 2006


Author: waldi
Date: Fri Feb  3 01:07:39 2006
New Revision: 5699

Modified:
   people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor/editor.py
Log:
debian/lib/python/debian_linux/kconfigeditor/editor.py: Ask on unsaved changes.


Modified: people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor/editor.py
==============================================================================
--- people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor/editor.py	(original)
+++ people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor/editor.py	Fri Feb  3 01:07:39 2006
@@ -60,10 +60,12 @@
         self.file_inodes = {}
         self.items = {}
         self.variants = sorted_dict()
+        self.changed = False
 
         self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
         self.window.set_size_request(200, 200)
         self.window.set_title("KConfig editor")
+        self.window.connect("delete_event", self.window_delete_event)
         self.window.connect("destroy", self.window_destroy)
 
         box = gtk.VBox()
@@ -169,6 +171,19 @@
         key = self.treestore.get_value(self.treestore.get_iter(path), 0)
         edit_setting(self, key)
 
+    def window_delete_event(self, widget, data = None):
+        if self.changed:
+            dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, "Save the changes before closing?")
+            dialog.add_buttons("Close _without Saving", gtk.RESPONSE_NO, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_YES)
+            dialog.set_default_response(gtk.RESPONSE_YES)
+            response = dialog.run()
+            dialog.destroy()
+            if response == gtk.RESPONSE_CANCEL:
+                return True
+            elif response == gtk.RESPONSE_YES:
+                self.write()
+        return False
+
     def window_destroy(self, widget, data = None):
         gtk.main_quit()
 
@@ -273,6 +288,7 @@
         return True
 
     def edit_menu_activate(self, button, key, command):
+        self.editor.changed = True
         if command == "Set to Yes":
             self.editor.items[key][self.key] = 'y'
         elif command == "Set to Mod":



More information about the Kernel-svn-changes mailing list