/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 revisionview.py

  • Committer: Jelmer Vernooij
  • Date: 2010-03-03 14:10:25 UTC
  • mto: This revision was merged to the branch mainline in revision 686.
  • Revision ID: jelmer@samba.org-20100303141025-rz53ongyh8miv3q5
Don't crash when there is already a lan-notify instance running.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
 
from gi.repository import Gtk
19
 
from gi.repository import Pango
20
 
from gi.repository import GObject
 
18
import pygtk
 
19
pygtk.require("2.0")
 
20
import gtk
 
21
import pango
 
22
import gobject
21
23
import webbrowser
22
24
 
23
25
from bzrlib import trace
24
26
from bzrlib.osutils import format_date
25
 
from bzrlib.bencode import bdecode
 
27
try:
 
28
    from bzrlib.bencode import bdecode
 
29
except ImportError:
 
30
    from bzrlib.util.bencode import bdecode
26
31
from bzrlib.testament import Testament
27
32
 
28
33
from bzrlib.plugins.gtk import icon_path
29
34
 
30
 
from bzrlib.plugins.gtk.avatarsbox import AvatarsBox
31
 
 
32
35
try:
33
36
    from bzrlib.plugins.gtk import seahorse
34
37
except ImportError:
48
51
            webbrowser._tryorder.insert(0, '%s "%%s"' % cmd)
49
52
    webbrowser.open(uri)
50
53
 
 
54
gtk.link_button_set_uri_hook(_open_link)
51
55
 
52
 
class BugsTab(Gtk.VBox):
 
56
class BugsTab(gtk.VBox):
53
57
 
54
58
    def __init__(self):
55
 
        super(BugsTab, self).__init__(homogeneous=False, spacing=6)
56
 
 
57
 
        table = Gtk.Table(rows=2, columns=2)
 
59
        super(BugsTab, self).__init__(False, 6)
 
60
    
 
61
        table = gtk.Table(rows=2, columns=2)
58
62
 
59
63
        table.set_row_spacings(6)
60
64
        table.set_col_spacing(0, 16)
61
65
 
62
 
        image = Gtk.Image()
 
66
        image = gtk.Image()
63
67
        image.set_from_file(icon_path("bug.png"))
64
 
        table.attach(image, 0, 1, 0, 1, Gtk.AttachOptions.FILL)
 
68
        table.attach(image, 0, 1, 0, 1, gtk.FILL)
65
69
 
66
 
        align = Gtk.Alignment.new(0.0, 0.1, 0, 0)
67
 
        self.label = Gtk.Label()
 
70
        align = gtk.Alignment(0.0, 0.1)
 
71
        self.label = gtk.Label()
68
72
        align.add(self.label)
69
 
        table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.FILL)
 
73
        table.attach(align, 1, 2, 0, 1, gtk.FILL)
70
74
 
71
75
        treeview = self.construct_treeview()
72
 
        table.attach(treeview, 1, 2, 1, 2, Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND)
 
76
        table.attach(treeview, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND)
73
77
 
74
78
        self.set_border_width(6)
75
 
        self.pack_start(table, False, True, 0)
 
79
        self.pack_start(table, expand=False)
76
80
 
77
81
        self.clear()
78
82
        self.show_all()
87
91
                (url, status) = bugline.split(" ")
88
92
                if status == "fixed":
89
93
                    self.add_bug(url, status)
90
 
 
 
94
        
91
95
        if self.num_bugs == 0:
92
96
            return
93
97
        elif self.num_bugs == 1:
100
104
                              "%d %s." % (self.num_bugs, label))
101
105
 
102
106
    def construct_treeview(self):
103
 
        self.bugs = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
104
 
        self.treeview = Gtk.TreeView(model=self.bugs)
 
107
        self.bugs = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
 
108
        self.treeview = gtk.TreeView(self.bugs)
105
109
        self.treeview.set_headers_visible(False)
106
110
 
107
 
        uri_column = Gtk.TreeViewColumn('Bug URI', Gtk.CellRendererText(), text=0)
 
111
        uri_column = gtk.TreeViewColumn('Bug URI', gtk.CellRendererText(), text=0)
108
112
        self.treeview.append_column(uri_column)
109
113
 
110
114
        self.treeview.connect('row-activated', self.on_row_activated)
111
115
 
112
 
        win = Gtk.ScrolledWindow()
113
 
        win.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
114
 
        win.set_shadow_type(Gtk.ShadowType.IN)
 
116
        win = gtk.ScrolledWindow()
 
117
        win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
 
118
        win.set_shadow_type(gtk.SHADOW_IN)
115
119
        win.add(self.treeview)
116
120
 
117
121
        return win
136
140
        _open_link(self, uri)
137
141
 
138
142
 
139
 
class SignatureTab(Gtk.VBox):
 
143
class SignatureTab(gtk.VBox):
140
144
 
141
145
    def __init__(self, repository):
142
146
        self.key = None
143
147
        self.revision = None
144
148
        self.repository = repository
145
149
 
146
 
        super(SignatureTab, self).__init__(homogeneous=False, spacing=6)
147
 
        signature_box = Gtk.Table(rows=3, columns=3)
 
150
        super(SignatureTab, self).__init__(False, 6)
 
151
        signature_box = gtk.Table(rows=3, columns=3)
148
152
        signature_box.set_col_spacing(0, 16)
149
153
        signature_box.set_col_spacing(1, 12)
150
154
        signature_box.set_row_spacings(6)
151
155
 
152
 
        self.signature_image = Gtk.Image()
153
 
        signature_box.attach(self.signature_image, 0, 1, 0, 1, Gtk.AttachOptions.FILL)
 
156
        self.signature_image = gtk.Image()
 
157
        signature_box.attach(self.signature_image, 0, 1, 0, 1, gtk.FILL)
154
158
 
155
 
        align = Gtk.Alignment.new(0.0, 0.1, 0.0, 0.0)
156
 
        self.signature_label = Gtk.Label()
 
159
        align = gtk.Alignment(0.0, 0.1)
 
160
        self.signature_label = gtk.Label()
157
161
        align.add(self.signature_label)
158
 
        signature_box.attach(align, 1, 3, 0, 1, Gtk.AttachOptions.FILL)
 
162
        signature_box.attach(align, 1, 3, 0, 1, gtk.FILL)
159
163
 
160
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
161
 
        self.signature_key_id_label = Gtk.Label()
 
164
        align = gtk.Alignment(0.0, 0.5)
 
165
        self.signature_key_id_label = gtk.Label()
162
166
        self.signature_key_id_label.set_markup("<b>Key Id:</b>")
163
167
        align.add(self.signature_key_id_label)
164
 
        signature_box.attach(align, 1, 2, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
168
        signature_box.attach(align, 1, 2, 1, 2, gtk.FILL, gtk.FILL)
165
169
 
166
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
167
 
        self.signature_key_id = Gtk.Label()
 
170
        align = gtk.Alignment(0.0, 0.5)
 
171
        self.signature_key_id = gtk.Label()
168
172
        self.signature_key_id.set_selectable(True)
169
173
        align.add(self.signature_key_id)
170
 
        signature_box.attach(align, 2, 3, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
174
        signature_box.attach(align, 2, 3, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
171
175
 
172
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
173
 
        self.signature_fingerprint_label = Gtk.Label()
 
176
        align = gtk.Alignment(0.0, 0.5)
 
177
        self.signature_fingerprint_label = gtk.Label()
174
178
        self.signature_fingerprint_label.set_markup("<b>Fingerprint:</b>")
175
179
        align.add(self.signature_fingerprint_label)
176
 
        signature_box.attach(align, 1, 2, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
180
        signature_box.attach(align, 1, 2, 2, 3, gtk.FILL, gtk.FILL)
177
181
 
178
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
179
 
        self.signature_fingerprint = Gtk.Label()
 
182
        align = gtk.Alignment(0.0, 0.5)
 
183
        self.signature_fingerprint = gtk.Label()
180
184
        self.signature_fingerprint.set_selectable(True)
181
185
        align.add(self.signature_fingerprint)
182
 
        signature_box.attach(align, 2, 3, 2, 3, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
186
        signature_box.attach(align, 2, 3, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL)
183
187
 
184
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
185
 
        self.signature_trust_label = Gtk.Label()
 
188
        align = gtk.Alignment(0.0, 0.5)
 
189
        self.signature_trust_label = gtk.Label()
186
190
        self.signature_trust_label.set_markup("<b>Trust:</b>")
187
191
        align.add(self.signature_trust_label)
188
 
        signature_box.attach(align, 1, 2, 3, 4, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
192
        signature_box.attach(align, 1, 2, 3, 4, gtk.FILL, gtk.FILL)
189
193
 
190
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
191
 
        self.signature_trust = Gtk.Label()
 
194
        align = gtk.Alignment(0.0, 0.5)
 
195
        self.signature_trust = gtk.Label()
192
196
        self.signature_trust.set_selectable(True)
193
197
        align.add(self.signature_trust)
194
 
        signature_box.attach(align, 2, 3, 3, 4, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
198
        signature_box.attach(align, 2, 3, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
195
199
 
196
200
        self.set_border_width(6)
197
 
        self.pack_start(signature_box, False, True, 0)
 
201
        self.pack_start(signature_box, expand=False)
198
202
        self.show_all()
199
203
 
200
204
    def set_revision(self, revision):
284
288
        self.signature_trust.set_text('This key is ' + trust_text)
285
289
 
286
290
 
287
 
class RevisionView(Gtk.Notebook):
 
291
class RevisionView(gtk.Notebook):
288
292
    """ Custom widget for commit log details.
289
293
 
290
294
    A variety of bzr tools may need to implement such a thing. This is a
293
297
 
294
298
    __gproperties__ = {
295
299
        'branch': (
296
 
            GObject.TYPE_PYOBJECT,
 
300
            gobject.TYPE_PYOBJECT,
297
301
            'Branch',
298
302
            'The branch holding the revision being displayed',
299
 
            GObject.PARAM_CONSTRUCT_ONLY | GObject.PARAM_WRITABLE
 
303
            gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_WRITABLE
300
304
        ),
301
305
 
302
306
        'revision': (
303
 
            GObject.TYPE_PYOBJECT,
 
307
            gobject.TYPE_PYOBJECT,
304
308
            'Revision',
305
309
            'The revision being displayed',
306
 
            GObject.PARAM_READWRITE
 
310
            gobject.PARAM_READWRITE
307
311
        ),
308
312
 
309
313
        'children': (
310
 
            GObject.TYPE_PYOBJECT,
 
314
            gobject.TYPE_PYOBJECT,
311
315
            'Children',
312
316
            'Child revisions',
313
 
            GObject.PARAM_READWRITE
 
317
            gobject.PARAM_READWRITE
314
318
        ),
315
319
 
316
320
        'file-id': (
317
 
            GObject.TYPE_PYOBJECT,
 
321
            gobject.TYPE_PYOBJECT,
318
322
            'File Id',
319
323
            'The file id',
320
 
            GObject.PARAM_READWRITE
 
324
            gobject.PARAM_READWRITE
321
325
        )
322
326
    }
323
327
 
324
328
    def __init__(self, branch=None, repository=None):
325
 
        super(RevisionView, self).__init__()
 
329
        gtk.Notebook.__init__(self)
326
330
 
327
331
        self._revision = None
328
332
        self._branch = branch
330
334
            self._repository = branch.repository
331
335
        else:
332
336
            self._repository = repository
333
 
        self.signature_table = None
334
337
 
335
338
        self._create_general()
336
339
        self._create_relations()
397
400
 
398
401
    def _set_revision(self, revision):
399
402
        if revision is None: return
400
 
        
401
 
        self.avatarsbox.reset()
402
 
        
 
403
 
403
404
        self._revision = revision
404
405
        if revision.committer is not None:
405
406
            self.committer.set_text(revision.committer)
406
 
            self.avatarsbox.add(revision.committer, "committer")
407
407
        else:
408
408
            self.committer.set_text("")
409
 
            self.avatarsbox.hide()
410
409
        author = revision.properties.get('author', '')
411
 
        self.avatarsbox.merge(revision.get_apparent_authors(), "author")
412
410
        if author != '':
413
411
            self.author.set_text(author)
414
412
            self.author.show()
470
468
        self._add_tags()
471
469
 
472
470
    def _update_signature(self, widget, param):
473
 
        if not has_seahorse:
474
 
            return
475
471
        if self.get_current_page() == PAGE_SIGNATURE:
476
472
            self.signature_table.set_revision(self._revision)
477
473
 
486
482
                                      self.children_table)
487
483
 
488
484
    def _switch_page_cb(self, notebook, page, page_num):
489
 
        if not has_seahorse:
490
 
            return
491
485
        if page_num == PAGE_SIGNATURE:
492
486
            self.signature_table.set_revision(self._revision)
493
487
 
527
521
        table.resize(max(len(revids), 1), 2)
528
522
 
529
523
        for idx, revid in enumerate(revids):
530
 
            align = Gtk.Alignment.new(0.0, 0.0, 1, 1)
 
524
            align = gtk.Alignment(0.0, 0.0, 1, 1)
531
525
            widgets.append(align)
532
526
            table.attach(align, 1, 2, idx, idx + 1,
533
 
                                      Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
527
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
534
528
            align.show()
535
529
 
536
 
            hbox = Gtk.HBox(homogeneous=False, spacing=6)
 
530
            hbox = gtk.HBox(False, spacing=6)
537
531
            align.add(hbox)
538
532
            hbox.show()
539
533
 
540
 
            image = Gtk.Image()
 
534
            image = gtk.Image()
541
535
            image.set_from_stock(
542
 
                Gtk.STOCK_FIND, Gtk.IconSize.SMALL_TOOLBAR)
 
536
                gtk.STOCK_FIND, gtk.ICON_SIZE_SMALL_TOOLBAR)
543
537
            image.show()
544
538
 
545
539
            if self._show_callback is not None:
546
 
                button = Gtk.Button()
 
540
                button = gtk.Button()
547
541
                button.add(image)
548
542
                button.connect("clicked", self._show_clicked_cb,
549
543
                               self._revision.revision_id, revid)
550
 
                hbox.pack_start(button, False, True, 0)
 
544
                hbox.pack_start(button, expand=False, fill=True)
551
545
                button.show()
552
546
 
553
 
            button = Gtk.Button()
554
 
            revid_label = Gtk.Label(label=str(revid))
555
 
            revid_label.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
547
            button = gtk.Button()
 
548
            revid_label = gtk.Label(str(revid))
 
549
            revid_label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
556
550
            revid_label.set_alignment(0.0, 0.5)
557
551
            button.add(revid_label)
558
552
            button.connect("clicked",
559
 
                    lambda w, r: self.set_revision(
560
 
                        self._repository.get_revision(r)), revid)
 
553
                    lambda w, r: self.set_revision(self._repository.get_revision(r)), revid)
561
554
            button.set_use_underline(False)
562
 
            hbox.pack_start(button, True, True, 0)
 
555
            hbox.pack_start(button, expand=True, fill=True)
563
556
            button.show_all()
564
557
 
565
558
    def _create_general(self):
566
 
        vbox = Gtk.VBox(homogeneous=False, spacing=6)
 
559
        vbox = gtk.VBox(False, 6)
567
560
        vbox.set_border_width(6)
568
 
        vbox.pack_start(self._create_headers(), False, True, 0)
569
 
        vbox.pack_start(self._create_message_view(), True, True, 0)
570
 
        self.append_page(vbox, Gtk.Label(label="General"))
 
561
        vbox.pack_start(self._create_headers(), expand=False, fill=True)
 
562
        vbox.pack_start(self._create_message_view())
 
563
        self.append_page(vbox, tab_label=gtk.Label("General"))
571
564
        vbox.show()
572
565
 
573
566
    def _create_relations(self):
574
 
        vbox = Gtk.VBox(homogeneous=False, spacing=6)
 
567
        vbox = gtk.VBox(False, 6)
575
568
        vbox.set_border_width(6)
576
 
        vbox.pack_start(self._create_parents(), False, True, 0)
577
 
        vbox.pack_start(self._create_children(), False, True, 0)
578
 
        self.append_page(vbox, Gtk.Label(label="Relations"))
 
569
        vbox.pack_start(self._create_parents(), expand=False, fill=True)
 
570
        vbox.pack_start(self._create_children(), expand=False, fill=True)
 
571
        self.append_page(vbox, tab_label=gtk.Label("Relations"))
579
572
        vbox.show()
580
573
 
581
574
    def _create_signature(self):
582
575
        self.signature_table = SignatureTab(self._repository)
583
 
        self.append_page(
584
 
            self.signature_table, Gtk.Label(label='Signature'))
 
576
        self.append_page(self.signature_table, tab_label=gtk.Label('Signature'))
585
577
        self.connect_after('notify::revision', self._update_signature)
586
578
 
587
579
    def _create_headers(self):
588
 
        self.avatarsbox = AvatarsBox()
589
 
        
590
 
        self.table = Gtk.Table(rows=5, columns=2)
 
580
        self.table = gtk.Table(rows=5, columns=2)
591
581
        self.table.set_row_spacings(6)
592
582
        self.table.set_col_spacings(6)
593
583
        self.table.show()
594
 
        
595
 
        self.avatarsbox.pack_start(self.table, True, True, 0)
596
 
        self.avatarsbox.show()
597
584
 
598
585
        row = 0
599
586
 
600
 
        label = Gtk.Label()
 
587
        label = gtk.Label()
601
588
        label.set_alignment(1.0, 0.5)
602
589
        label.set_markup("<b>Revision Id:</b>")
603
 
        self.table.attach(label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
590
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
604
591
        label.show()
605
592
 
606
 
        revision_id = Gtk.Label()
607
 
        revision_id.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
593
        revision_id = gtk.Label()
 
594
        revision_id.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
608
595
        revision_id.set_alignment(0.0, 0.5)
609
596
        revision_id.set_selectable(True)
610
597
        self.connect('notify::revision', 
611
598
                lambda w, p: revision_id.set_text(self._revision.revision_id))
612
 
        self.table.attach(revision_id, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
599
        self.table.attach(revision_id, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
613
600
        revision_id.show()
614
601
 
615
602
        row += 1
616
 
        self.author_label = Gtk.Label()
 
603
        self.author_label = gtk.Label()
617
604
        self.author_label.set_alignment(1.0, 0.5)
618
605
        self.author_label.set_markup("<b>Author:</b>")
619
 
        self.table.attach(self.author_label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
606
        self.table.attach(self.author_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
620
607
        self.author_label.show()
621
608
 
622
 
        self.author = Gtk.Label()
623
 
        self.author.set_ellipsize(Pango.EllipsizeMode.END)
 
609
        self.author = gtk.Label()
 
610
        self.author.set_ellipsize(pango.ELLIPSIZE_END)
624
611
        self.author.set_alignment(0.0, 0.5)
625
612
        self.author.set_selectable(True)
626
 
        self.table.attach(self.author, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
613
        self.table.attach(self.author, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
627
614
        self.author.show()
628
615
        self.author.hide()
629
616
 
630
617
        row += 1
631
 
        label = Gtk.Label()
 
618
        label = gtk.Label()
632
619
        label.set_alignment(1.0, 0.5)
633
620
        label.set_markup("<b>Committer:</b>")
634
 
        self.table.attach(label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
621
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
635
622
        label.show()
636
623
 
637
 
        self.committer = Gtk.Label()
638
 
        self.committer.set_ellipsize(Pango.EllipsizeMode.END)
 
624
        self.committer = gtk.Label()
 
625
        self.committer.set_ellipsize(pango.ELLIPSIZE_END)
639
626
        self.committer.set_alignment(0.0, 0.5)
640
627
        self.committer.set_selectable(True)
641
 
        self.table.attach(self.committer, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
628
        self.table.attach(self.committer, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
642
629
        self.committer.show()
643
630
 
644
631
        row += 1
645
 
        self.branchnick_label = Gtk.Label()
 
632
        self.branchnick_label = gtk.Label()
646
633
        self.branchnick_label.set_alignment(1.0, 0.5)
647
634
        self.branchnick_label.set_markup("<b>Branch nick:</b>")
648
 
        self.table.attach(self.branchnick_label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
635
        self.table.attach(self.branchnick_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
649
636
        self.branchnick_label.show()
650
637
 
651
 
        self.branchnick = Gtk.Label()
652
 
        self.branchnick.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
638
        self.branchnick = gtk.Label()
 
639
        self.branchnick.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
653
640
        self.branchnick.set_alignment(0.0, 0.5)
654
641
        self.branchnick.set_selectable(True)
655
 
        self.table.attach(self.branchnick, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
642
        self.table.attach(self.branchnick, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
656
643
        self.branchnick.show()
657
644
 
658
645
        row += 1
659
 
        label = Gtk.Label()
 
646
        label = gtk.Label()
660
647
        label.set_alignment(1.0, 0.5)
661
648
        label.set_markup("<b>Timestamp:</b>")
662
 
        self.table.attach(label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
649
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
663
650
        label.show()
664
651
 
665
 
        self.timestamp = Gtk.Label()
666
 
        self.timestamp.set_ellipsize(Pango.EllipsizeMode.END)
 
652
        self.timestamp = gtk.Label()
 
653
        self.timestamp.set_ellipsize(pango.ELLIPSIZE_END)
667
654
        self.timestamp.set_alignment(0.0, 0.5)
668
655
        self.timestamp.set_selectable(True)
669
 
        self.table.attach(self.timestamp, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
656
        self.table.attach(self.timestamp, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
670
657
        self.timestamp.show()
671
658
 
672
659
        row += 1
673
 
        self.tags_label = Gtk.Label()
 
660
        self.tags_label = gtk.Label()
674
661
        self.tags_label.set_alignment(1.0, 0.5)
675
662
        self.tags_label.set_markup("<b>Tags:</b>")
676
 
        self.table.attach(self.tags_label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
663
        self.table.attach(self.tags_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
677
664
        self.tags_label.show()
678
665
 
679
 
        self.tags_list = Gtk.Label()
680
 
        self.tags_list.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
666
        self.tags_list = gtk.Label()
 
667
        self.tags_list.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
681
668
        self.tags_list.set_alignment(0.0, 0.5)
682
 
        self.table.attach(self.tags_list, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
669
        self.table.attach(self.tags_list, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
683
670
        self.tags_list.show()
684
671
 
685
672
        self.connect('notify::revision', self._add_tags)
686
673
 
687
 
        return self.avatarsbox
 
674
        return self.table
688
675
    
689
676
    def _create_parents(self):
690
 
        hbox = Gtk.HBox(homogeneous=True, spacing=3)
 
677
        hbox = gtk.HBox(True, 3)
691
678
        
692
679
        self.parents_table = self._create_parents_or_children_table(
693
680
            "<b>Parents:</b>")
694
681
        self.parents_widgets = []
695
 
        hbox.pack_start(self.parents_table, True, True, 0)
 
682
        hbox.pack_start(self.parents_table)
696
683
 
697
684
        hbox.show()
698
685
        return hbox
699
686
 
700
687
    def _create_children(self):
701
 
        hbox = Gtk.HBox(homogeneous=True, spacing=3)
 
688
        hbox = gtk.HBox(True, 3)
702
689
        self.children_table = self._create_parents_or_children_table(
703
690
            "<b>Children:</b>")
704
691
        self.children_widgets = []
705
 
        hbox.pack_start(self.children_table, True, True, 0)
 
692
        hbox.pack_start(self.children_table)
706
693
        hbox.show()
707
694
        return hbox
708
695
        
709
696
    def _create_parents_or_children_table(self, text):
710
 
        table = Gtk.Table(rows=1, columns=2)
 
697
        table = gtk.Table(rows=1, columns=2)
711
698
        table.set_row_spacings(3)
712
699
        table.set_col_spacings(6)
713
700
        table.show()
714
701
 
715
 
        label = Gtk.Label()
 
702
        label = gtk.Label()
716
703
        label.set_markup(text)
717
 
        align = Gtk.Alignment.new(0.0, 0.5, 0, 0)
 
704
        align = gtk.Alignment(0.0, 0.5)
718
705
        align.add(label)
719
 
        table.attach(align, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
706
        table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
720
707
        label.show()
721
708
        align.show()
722
709
 
723
710
        return table
724
711
 
725
712
    def _create_message_view(self):
726
 
        msg_buffer = Gtk.TextBuffer()
 
713
        msg_buffer = gtk.TextBuffer()
727
714
        self.connect('notify::revision',
728
715
                lambda w, p: msg_buffer.set_text(self._revision.message))
729
 
        window = Gtk.ScrolledWindow()
730
 
        window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
731
 
        window.set_shadow_type(Gtk.ShadowType.IN)
732
 
        tv = Gtk.TextView(buffer=msg_buffer)
 
716
        window = gtk.ScrolledWindow()
 
717
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
 
718
        window.set_shadow_type(gtk.SHADOW_IN)
 
719
        tv = gtk.TextView(msg_buffer)
733
720
        tv.set_editable(False)
734
 
        tv.set_wrap_mode(Gtk.WrapMode.WORD)
 
721
        tv.set_wrap_mode(gtk.WRAP_WORD)
735
722
 
736
 
        tv.modify_font(Pango.FontDescription("Monospace"))
 
723
        tv.modify_font(pango.FontDescription("Monospace"))
737
724
        tv.show()
738
725
        window.add(tv)
739
726
        window.show()
742
729
    def _create_bugs(self):
743
730
        self.bugs_page = BugsTab()
744
731
        self.connect_after('notify::revision', self._update_bugs) 
745
 
        self.append_page(self.bugs_page, Gtk.Label(label='Bugs'))
 
732
        self.append_page(self.bugs_page, tab_label=gtk.Label('Bugs'))
746
733
 
747
734
    def _create_file_info_view(self):
748
 
        self.file_info_box = Gtk.VBox(homogeneous=False, spacing=6)
 
735
        self.file_info_box = gtk.VBox(False, 6)
749
736
        self.file_info_box.set_border_width(6)
750
 
        self.file_info_buffer = Gtk.TextBuffer()
751
 
        window = Gtk.ScrolledWindow()
752
 
        window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
753
 
        window.set_shadow_type(Gtk.ShadowType.IN)
754
 
        tv = Gtk.TextView(buffer=self.file_info_buffer)
 
737
        self.file_info_buffer = gtk.TextBuffer()
 
738
        window = gtk.ScrolledWindow()
 
739
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
 
740
        window.set_shadow_type(gtk.SHADOW_IN)
 
741
        tv = gtk.TextView(self.file_info_buffer)
755
742
        tv.set_editable(False)
756
 
        tv.set_wrap_mode(Gtk.WrapMode.WORD)
757
 
        tv.modify_font(Pango.FontDescription("Monospace"))
 
743
        tv.set_wrap_mode(gtk.WRAP_WORD)
 
744
        tv.modify_font(pango.FontDescription("Monospace"))
758
745
        tv.show()
759
746
        window.add(tv)
760
747
        window.show()
761
 
        self.file_info_box.pack_start(window, True, True, 0)
 
748
        self.file_info_box.pack_start(window)
762
749
        self.file_info_box.hide() # Only shown when there are per-file messages
763
 
        self.append_page(self.file_info_box, Gtk.Label(label='Per-file'))
 
750
        self.append_page(self.file_info_box, tab_label=gtk.Label('Per-file'))
764
751