/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to viz/branchwin.py

  • Committer: Daniel Schierbeck
  • Date: 2007-11-04 18:53:17 UTC
  • mto: This revision was merged to the branch mainline in revision 353.
  • Revision ID: daniel.schierbeck@gmail.com-20071104185317-9huqsq7byuqy090m
Added dropdown menu to Back button.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
from bzrlib.plugins.gtk.window import Window
17
17
from bzrlib.plugins.gtk.preferences import PreferencesWindow
 
18
from bzrlib.revision import Revision
18
19
from treeview import TreeView
19
20
 
20
21
class BranchWindow(Window):
202
203
        self.toolbar = gtk.Toolbar()
203
204
        self.toolbar.set_style(gtk.TOOLBAR_BOTH_HORIZ)
204
205
 
205
 
        self.back_button = gtk.ToolButton(stock_id=gtk.STOCK_GO_BACK)
 
206
        self.back_button = gtk.MenuToolButton(stock_id=gtk.STOCK_GO_BACK)
206
207
        self.back_button.set_is_important(True)
207
208
        self.back_button.add_accelerator("clicked", self.accel_group, ord('['),
208
209
                                         0, 0)
243
244
        children = self.treeview.get_children()
244
245
 
245
246
        if revision is not None:
246
 
            self.back_button.set_sensitive(len(parents) > 0)
 
247
            back_menu = gtk.Menu()
 
248
            if len(parents) > 0:
 
249
                self.back_button.set_sensitive(True)
 
250
                for parent_id in parents:
 
251
                    parent = self.branch.repository.get_revision(parent_id)
 
252
                    item = gtk.MenuItem(parent.message.split("\n")[0])
 
253
                    item.connect('activate', self._set_revision_cb, parent_id)
 
254
                    back_menu.add(item)
 
255
                back_menu.show_all()
 
256
            else:
 
257
                self.back_button.set_sensitive(False)
 
258
                back_menu.hide()
 
259
 
 
260
            self.back_button.set_menu(back_menu)
 
261
 
247
262
            self.fwd_button.set_sensitive(len(children) > 0)
248
263
            tags = []
249
264
            if self.branch.supports_tags():
269
284
        self.treeview.show_diff(self.branch, revid, parentid)
270
285
        self.treeview.grab_focus()
271
286
 
 
287
    def _set_revision_cb(self, w, revision_id):
 
288
        self.treeview.set_revision(revision_id)
 
289
 
272
290
    def _col_visibility_changed(self, col, property):
273
291
        self.treeview.set_property(property + '-column-visible', col.get_active())
274
292