Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

gdialog: add show_toolbar_on_start and _show_toolbar functions

show_toolbar_on_start may be overridden by subclasses to return False,
causing the toolbar to not being shown on dialog start.

The toolbar can be later shown by calling _show_toolbar.

Changeset a95a9ef8c7e5

Parent 7d91c4a48d37

by Adrian Buehlmann

Changes to one file · Browse files at a95a9ef8c7e5 Showing diff from parent 7d91c4a48d37 Diff from another changeset...

 
231
232
233
 
 
 
 
234
235
236
 
515
516
517
518
 
 
 
 
 
 
519
520
521
 
523
524
525
 
 
 
 
 
 
 
 
526
527
528
 
231
232
233
234
235
236
237
238
239
240
 
519
520
521
 
522
523
524
525
526
527
528
529
530
 
532
533
534
535
536
537
538
539
540
541
542
543
544
545
@@ -231,6 +231,10 @@
  except KeyError:   pass   + + def show_toolbar_on_start(self): + return True +   ### End of overridable methods ###     def display(self, opengui=True): @@ -515,7 +519,12 @@
  self.add(vbox)   if menus:   vbox.pack_start(menubar, False, False, 0) - vbox.pack_start(toolbar, False, False, 0) + + self.toolbar_box = gtk.VBox() + vbox.pack_start(self.toolbar_box, False, False, 0) + if self.show_toolbar_on_start(): + self._show_toolbar(True) +   vbox.pack_start(body, True, True, 0)   if extras:   vbox.pack_end(extras, False, False, 0) @@ -523,6 +532,14 @@
  self.connect('destroy', self._destroying)     + def _show_toolbar(self, show): + if self.toolbar in self.toolbar_box.get_children(): + self.toolbar.set_property('visible', show) + elif show: + self.toolbar_box.pack_start(self.toolbar, False, False, 0) + self.toolbar.show_all() + +   def _destroying(self, gtkobj):   settings = self.save_settings()   self.settings.set_value('dialogs', settings)