# HG changeset patch
# User Yuki KODAMA <endflow....@gmail.com>
# Date 1247065608 -32400
# Node ID d3b51cfc722713c270e872057d23f3eb6e6e16e9
# Parent  53f9750fa12b645bc1ea70ab228a0e13e8efc06d
commit: prevent unexpected clearing by ESC key

This fix prevents unexpected clearing by ESC key. I changed to
2 buttons style. To apply changes, the user have to push 'OK'.
'Close' will cause misunderstanding.

diff --git a/hggtk/commit.py b/hggtk/commit.py
--- a/hggtk/commit.py
+++ b/hggtk/commit.py
@@ -27,7 +27,8 @@
 class BranchOperationDialog(gtk.Dialog):
     def __init__(self, branch, close):
         gtk.Dialog.__init__(self, parent=None, flags=gtk.DIALOG_MODAL,
-                          buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+                          buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
+                              gtk.STOCK_OK, gtk.RESPONSE_OK))
         gtklib.set_tortoise_keys(self)
         self.connect('response', self.response)
         self.set_title(_('Branch Operations'))
@@ -57,9 +58,11 @@

         self.newbranchradio.set_active(True)
         if branch:
+            self.newbranch = branch
             self.branchentry.set_text(branch)
             self.newbranchradio.set_active(True)
         elif close:
+            self.closebranch = close
             self.closebranchradio.set_active(True)
         else:
             nochanges.set_active(True)
@@ -69,13 +72,14 @@
         self.branchentry.set_sensitive(radio.get_active())

     def response(self, widget, response_id):
-        if response_id != gtk.RESPONSE_CLOSE:
-            self.destroy()
-            return
-        if self.newbranchradio.get_active():
-            self.newbranch = self.branchentry.get_text()
-        elif self.closebranchradio.get_active():
-            self.closebranch = True
+        if response_id == gtk.RESPONSE_OK:
+            if self.newbranchradio.get_active():
+                self.newbranch = self.branchentry.get_text()
+            elif self.closebranchradio.get_active():
+                self.closebranch = True
+            else:
+                self.newbranch = None
+                self.closebranch = False
         self.destroy()

Attachment: thg-crew-kuy_rev3137.patch
Description: Binary data

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to