Commits

Steve Borho committed 5c5f393

hggtk/hgcmd: cleaner method for closing dialog

also fixes a long-standing copy-paste bug

Comments (0)

Files changed (1)

 from shlib import set_tortoise_icon
 
 class CmdDialog(gtk.Dialog):
-    def __init__(self, cmdline, width=520, height=400, mainapp=False):
+    def __init__(self, cmdline, width=520, height=400):
         title = 'hg ' + ' '.join(cmdline[1:])
         gtk.Dialog.__init__(self,
                             title=title,
         self.vbox.pack_start(scrolledwindow, True, True)
         self.connect('map_event', self._on_window_map_event)
 
-        if mainapp:
-            self._button_ok.connect('clicked', gtk.main_quit)
-        else:
-            self._button_ok.connect('clicked', self._on_commit_clicked)
-            self.show_all()
+        self._button_ok.connect('clicked', self._on_ok_clicked)
+        self.show_all()
 
-    def _on_commit_clicked(self, button):
-        """ Commit button clicked handler. """
+    def _on_ok_clicked(self, button):
+        """ Ok button clicked handler. """
         self.response(gtk.RESPONSE_ACCEPT)
         
     def _on_window_map_event(self, event, param):
             return True
 
 def run(cmdline=[], **opts):
-    dlg = CmdDialog(cmdline, mainapp=True)
+    dlg = CmdDialog(cmdline)
+    dlg.connect('response', gtk.main_quit)
     dlg.show_all()
     gtk.gdk.threads_init()
     gtk.gdk.threads_enter()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.