Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

hggtk: remove many redundant calls to gtk.main_quit()

Also involved renaming appropriate class methods 'should_live'
so they get called by the ctrl-q/w keyboard events.

Changeset f2e267185ef0

Parent 17a9f40c4b8d

by Steve Borho

Changes to 9 files · Browse files at f2e267185ef0 Showing diff from parent 17a9f40c4b8d Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​about.py Stacked
 
78
79
80
 
81
82
83
84
 
 
85
86
87
 
78
79
80
81
82
 
 
 
83
84
85
86
87
@@ -78,10 +78,10 @@
  self.set_comments("with " + lib_versions + "\n\n" + comment)   self.set_logo(gtk.gdk.pixbuf_new_from_file(thg_logo))   self.set_icon_from_file(thg_icon) + self.connect('response', self.response)   - # somehow clicking on the Close button doesn't automatically - # close the About dialog... - self.connect('response', gtk.main_quit) + def response(self, widget, respid): + self.destroy()    def run(_ui, *pats, **opts):   return AboutDialog()
Change 1 of 1 Show Entire File hggtk/​clone.py Stacked
 
44
45
46
47
48
49
50
 
44
45
46
 
47
48
49
@@ -44,7 +44,6 @@
    def _create(self):   self.set_default_size(520, 180) - self.connect('destroy', gtk.main_quit)   ewidth = 16     # add toolbar with tooltips
Change 1 of 1 Show Entire File hggtk/​hgignore.py Stacked
 
161
162
163
164
 
165
166
167
 
161
162
163
 
164
165
166
167
@@ -161,7 +161,7 @@
    def refresh(self):   try: repo = hg.repository(ui.ui(), path=self.root) - except: gtk.main_quit() + except: self.destroy()   matcher = match.always(repo.root, repo.root)   changes = repo.dirstate.status(matcher, ignored=False, clean=False,   unknown=True)
Change 1 of 1 Show Entire File hggtk/​hginit.py Stacked
 
33
34
35
36
37
 
38
39
40
 
33
34
35
 
 
36
37
38
39
@@ -33,8 +33,7 @@
    def _create(self):   self.set_default_size(350, 150) - self.connect('destroy', gtk.main_quit) - +   # add toolbar with tooltips   self.tbar = gtk.Toolbar()   self.tips = gtk.Tooltips()
Change 1 of 1 Show Entire File hggtk/​hgtk.py Stacked
 
47
48
49
 
50
51
52
 
47
48
49
50
51
52
53
@@ -47,6 +47,7 @@
  opts = {}   opts['cmd'] = ' '.join(sys.argv[1:])   opts['error'] = error + # TODO: keep track of whether gtk.main() is running   print error   run(u, **opts)  
Change 1 of 1 Show Entire File hggtk/​recovery.py Stacked
 
88
89
90
91
 
 
92
93
94
 
95
96
97
98
 
 
99
100
101
 
88
89
90
 
91
92
93
94
 
95
96
97
 
 
98
99
100
101
102
@@ -88,14 +88,15 @@
  vbox.pack_start(self.stbar, False, False, 2)     def _delete(self, widget, event): - self._do_close() + if not self.should_live(): + self.destroy()   return True   - def _do_close(self): + def should_live(self):   if self._cmd_running():   error_dialog(self, _('Cannot close now'), _('command is running')) - else: - gtk.main_quit() + return True + return False     def _toolbutton(self, stock, label, handler,   menu=None, userdata=None, tip=None):
Change 1 of 2 Show Entire File hggtk/​rename.py Stacked
 
34
35
36
37
 
38
39
40
41
42
43
 
44
45
46
 
69
70
71
72
 
 
34
35
36
 
37
38
39
40
41
42
 
43
44
45
46
 
69
70
71
 
72
@@ -34,13 +34,13 @@
   def rename_resp(dialog, response):   if response != gtk.RESPONSE_OK: - gtk.main_quit() + dialog.destroy()   return   try:   root = rootpath()   repo = hg.repository(ui.ui(), root)   except (ImportError, RepoError): - gtk.main_quit() + dialog.destroy()   return     new_name = fromutf(dialog.entry.get_text()) @@ -69,4 +69,4 @@
  if len(textout) > 1:   error_dialog(None, _('rename error'), textout)   elif toquit: - gtk.main_quit() + dialog.destroy()
Change 1 of 1 Show Entire File hggtk/​serve.py Stacked
 
109
110
111
112
113
 
114
115
116
 
109
110
111
 
 
112
113
114
115
@@ -109,8 +109,7 @@
  try:   repo = hg.repository(ui.ui(), path=self._root)   except hglib.RepoError: - print _('no repository found') - gtk.main_quit() + self.destroy()   self.defport = repo.ui.config('web', 'port') or '8000'   self.webname = repo.ui.config('web', 'name') or \   os.path.basename(self._root)
Change 1 of 1 Show Entire File hggtk/​synch.py Stacked
 
361
362
363
364
365
366
367
 
368
369
 
370
371
372
 
 
 
373
374
375
376
377
378
379
380
 
 
381
382
383
 
361
362
363
 
 
 
 
364
365
366
367
368
 
 
369
370
371
372
 
 
 
 
373
 
 
374
375
376
377
378
@@ -361,23 +361,18 @@
  self._pathtext.set_text(dialog.get_filename())   dialog.destroy()   - def _close_clicked(self, toolbutton, data=None): - self._do_close() - - def _do_close(self): + def should_live(self):   if self._cmd_running():   error_dialog(self, _('Cannot close now'), _('command is running')) + return True   else: - self._save_settings() - gtk.main_quit() + self.update_settings() + self._settings.write() + return False   - def _save_settings(self): - self.update_settings() - self._settings.write() -   def _delete(self, widget, event): - self._do_close() - return True + if not self.should_live(): + self.destroy()     def _toolbutton(self, stock, label, handler,   menu=None, userdata=None, tip=None):