416
def get_widget(self, uri, window):
417
controldir, path = ControlDir.open_containing(uri)
419
tree = controldir.open_workingtree()
420
except NoWorkingTree:
422
ret = Gtk.HBox(False, 4)
423
text = 'This is a Bazaar working tree. '
424
get_shelf_manager = getattr(tree, 'get_shelf_manager', None)
425
if get_shelf_manager is not None:
426
manager = get_shelf_manager()
427
shelves = manager.active_shelves()
428
if len(shelves) == 0:
430
elif len(shelves) == 1:
431
text += '1 shelf exists. '
433
text += '%d shelf exists. ' % len(shelves)
434
label = Gtk.Label(text)
436
ret.pack_start(label, True, True, 0)
416
441
class PropertyPageFile(Nautilus.PropertyPage):
464
489
super(PropertyPageBranch, self).__init__(label=label,
465
490
name="BzrNautilus::branch_page", page=table)
492
def _create_location_entry(self, get_location, set_location):
493
location = get_location()
495
if location is not None:
496
ret.set_text(location)
467
499
def _create_table(self):
468
table = Gtk.Table(homogeneous=False, columns=2, rows=3)
500
table = Gtk.Table(homogeneous=False, columns=2, rows=6)
502
self._push_location_entry = self._create_location_entry(
503
self.branch.get_push_location, self.branch.set_push_location)
504
self._parent_location_entry = self._create_location_entry(
505
self.branch.get_parent, self.branch.set_parent)
506
self._bound_location_entry = self._create_location_entry(
507
self.branch.get_bound_location, self.branch.set_bound_location)
508
self._public_location_entry = self._create_location_entry(
509
self.branch.get_public_branch, self.branch.set_public_branch)
510
self._submit_location_entry = self._create_location_entry(
511
self.branch.get_submit_branch, self.branch.set_submit_branch)
470
513
table.attach(Gtk.Label('Push location:'), 0, 1, 0, 1)
471
table.attach(Gtk.Label(self.branch.get_push_location()), 1, 2, 0, 1)
514
table.attach(self._push_location_entry, 1, 2, 0, 1)
473
516
table.attach(Gtk.Label('Parent location:'), 0, 1, 1, 2)
474
table.attach(Gtk.Label(self.branch.get_parent()), 1, 1, 1, 2)
517
table.attach(self._parent_location_entry, 1, 1, 1, 2)
519
table.attach(Gtk.Label('Bound location:'), 0, 1, 2, 3)
520
table.attach(self._bound_location_entry, 1, 1, 2, 3)
522
table.attach(Gtk.Label('Public location:'), 0, 1, 3, 4)
523
table.attach(self._public_location_entry, 1, 1, 3, 4)
525
table.attach(Gtk.Label('Submit location:'), 0, 1, 4, 5)
526
table.attach(self._submit_location_entry, 1, 1, 4, 5)
528
self._append_revisions_only = Gtk.CheckButton('Append revisions only')
529
value = self.branch.get_append_revisions_only()
532
self._append_revisions_only.set_active(value)
533
table.attach(self._append_revisions_only, 0, 2, 5, 6)