# HG changeset patch
# User Sune Foldager <c...@cyanite.org>
# Date 1254583325 -7200
# Node ID 17e213460b42bbc83c6bfc56233d02b05006cea6
# Parent  020838e360424db9f545063b88cb8d09a0e19805
update: don't return before all work is done

The Update button used to be an action button, which would make it
exit out of run() when clicked. When the process was subsequently
shut down, the in-progress update would, at best, fail.

diff --git a/tortoisehg/hgtk/update.py b/tortoisehg/hgtk/update.py
--- a/tortoisehg/hgtk/update.py
+++ b/tortoisehg/hgtk/update.py
@@ -7,7 +7,7 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 import os
-import gtk
+import gtke
 import gobject
 
 from mercurial import hg, ui
@@ -31,7 +31,6 @@
         self.set_resizable(False)
         self.set_size_request(450, -1)
         self.set_has_separator(False)
-        self.connect('response', self.dialog_response)
         self.connect('delete-event', self.delete_event)
 
         try:
@@ -45,8 +44,12 @@
         self.set_title(_('Update - %s') % reponame)
 
         # add dialog buttons
-        self.updatebtn = self.add_button(_('Update'), gtk.RESPONSE_OK)
-        self.closebtn = self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CLOSE)
+        self.updatebtn = gtk.Button(_('Update'))
+        self.updatebtn.connect('clicked', lambda b: self.update(repo))
+        self.action_area.pack_end(self.updatebtn)
+        self.closebtn = gtk.Button(_('Cancel'))
+        self.closebtn.connect('clicked', lambda b: 
self.response(gtk.RESPONSE_CLOSE))
+        self.action_area.pack_end(self.closebtn)
 
         # layout table for fixed items
         table = gtklib.LayoutTable()
@@ -146,12 +149,6 @@
         table.show_all()
         self.revcombo.connect('changed', lambda b: self.update_summaries())
 
-    def dialog_response(self, dialog, response_id):
-        if response_id == gtk.RESPONSE_OK:
-            self.update(self.repo)
-        elif not self.cmd.is_alive():
-            self.destroy()
-
     def delete_event(self, dialog, event):
         if self.cmd.is_alive():
             ret = gdialog.Confirm(_('Confirm Cancel'), [], self,
@@ -323,7 +320,8 @@
             if hasattr(self, 'notify_func'):
                 self.notify_func(self.notify_args)
             if returncode == 0 and not self.cmd.is_show_log():
-                self.destroy()
+                self.response(gtk.RESPONSE_OK)
+
         self.switch_to(MODE_UPDATING)
         self.cmd.execute(cmdline, cmd_done)
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to