/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.1.1 by Dan Loda
First working version of xannotate.
1
# Copyright (C) 2005 Dan Loda <danloda@gmail.com>
175 by Jelmer Vernooij
Add very simple gmissing command.
2
# Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
0.1.1 by Dan Loda
First working version of xannotate.
3
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
import pygtk
19
pygtk.require("2.0")
20
import gtk
21
import pango
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
22
import gobject
0.1.1 by Dan Loda
First working version of xannotate.
23
24
from bzrlib.osutils import format_date
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
25
from bzrlib.util import bencode
0.1.1 by Dan Loda
First working version of xannotate.
26
330.3.1 by Daniel Schierbeck
Renamed logview 'revisionview'.
27
class RevisionView(gtk.Notebook):
0.1.1 by Dan Loda
First working version of xannotate.
28
    """ Custom widget for commit log details.
29
30
    A variety of bzr tools may need to implement such a thing. This is a
31
    start.
32
    """
33
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
34
    __gproperties__ = {
35
        'branch': (
36
            gobject.TYPE_PYOBJECT,
37
            'Branch',
38
            'The branch holding the revision being displayed',
39
            gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_WRITABLE
40
        ),
41
42
        'revision': (
43
            gobject.TYPE_PYOBJECT,
44
            'Revision',
45
            'The revision being displayed',
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
46
            gobject.PARAM_READWRITE
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
47
        )
48
    }
49
50
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
51
    def __init__(self, branch=None):
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
52
        gtk.Notebook.__init__(self)
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
53
        self.show_children = False
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
54
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
55
        self._create_general()
56
        self._create_relations()
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
57
        self._create_file_info_view()
324.2.9 by Daniel Schierbeck
Made 'General' the default page of the logview.
58
59
        self.set_current_page(0)
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
60
        
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
61
        self._show_callback = None
148 by Jelmer Vernooij
Clean up interface a bit: don't show diff button when no diff can be accessed, use label instead of button when there is no callback set.
62
        self._go_callback = None
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
63
        self._clicked_callback = None
0.1.1 by Dan Loda
First working version of xannotate.
64
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
65
        self._branch = branch
66
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
67
        if self._branch.supports_tags():
68
            self._tagdict = self._branch.tags.get_reverse_tag_dict()
412.1.3 by Daniel Schierbeck
Fixed problem with branches that do not support tags.
69
        else:
70
            self._tagdict = {}
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
71
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
72
        self.set_file_id(None)
0.1.1 by Dan Loda
First working version of xannotate.
73
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
74
    def do_get_property(self, property):
75
        if property.name == 'branch':
76
            return self._branch
77
        elif property.name == 'revision':
78
            return self._revision
79
        else:
80
            raise AttributeError, 'unknown property %s' % property.name
81
82
    def do_set_property(self, property, value):
83
        if property.name == 'branch':
84
            self._branch = value
85
        elif property.name == 'revision':
86
            self._set_revision(value)
87
        else:
88
            raise AttributeError, 'unknown property %s' % property.name
89
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
90
    def set_show_callback(self, callback):
91
        self._show_callback = callback
92
93
    def set_go_callback(self, callback):
94
        self._go_callback = callback
95
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
96
    def set_file_id(self, file_id):
97
        """Set a specific file id that we want to track.
98
99
        This just effects the display of a per-file commit message.
100
        If it is set to None, then all commit messages will be shown.
101
        """
102
        self._file_id = file_id
103
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
104
    def set_revision(self, revision, children=[]):
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
105
        self.set_property('revision', revision)
106
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
107
    def _set_revision(self, revision, children=[]):
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
108
        if revision is None: return
109
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
110
        self._revision = revision
192 by Jelmer Vernooij
Allow committer to be None.
111
        if revision.committer is not None:
112
            self.committer.set_text(revision.committer)
113
        else:
114
            self.committer.set_text("")
259 by Aaron Bentley
Add author support to gannotate and log viewer
115
        author = revision.properties.get('author', '')
116
        if author != '':
117
            self.author.set_text(author)
118
            self.author.show()
119
            self.author_label.show()
120
        else:
121
            self.author.hide()
122
            self.author_label.hide()
123
197 by Jelmer Vernooij
Fix some warnings when displaying ghost revisions. Reported by John.
124
        if revision.timestamp is not None:
125
            self.timestamp.set_text(format_date(revision.timestamp,
126
                                                revision.timezone))
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
127
        try:
128
            self.branchnick_label.set_text(revision.properties['branch-nick'])
129
        except KeyError:
130
            self.branchnick_label.set_text("")
131
256.2.23 by Gary van der Merwe
Show Children
132
        self._add_parents_or_children(revision.parent_ids,
133
                                      self.parents_widgets,
134
                                      self.parents_table)
135
        
136
        if self.show_children:
137
            self._add_parents_or_children(children,
138
                                          self.children_widgets,
139
                                          self.children_table)
140
        
324.2.10 by Daniel Schierbeck
Reduced overhead by only calculating diff when 'Changes' page is selected.
141
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
142
        file_info = revision.properties.get('file-info', None)
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
143
        if file_info is not None:
278.1.31 by John Arbash Meinel
We can make bencode work again by a simple decode/encode step.
144
            file_info = bencode.bdecode(file_info.encode('UTF-8'))
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
145
146
        if file_info:
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
147
            if self._file_id is None:
148
                text = []
149
                for fi in file_info:
150
                    text.append('%(path)s\n%(message)s' % fi)
151
                self.file_info_buffer.set_text('\n'.join(text))
152
                self.file_info_box.show()
153
            else:
154
                text = []
155
                for fi in file_info:
156
                    if fi['file_id'] == self._file_id:
157
                        text.append(fi['message'])
158
                if text:
159
                    self.file_info_buffer.set_text('\n'.join(text))
160
                    self.file_info_box.show()
161
                else:
162
                    self.file_info_box.hide()
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
163
        else:
164
            self.file_info_box.hide()
165
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
166
    def _show_clicked_cb(self, widget, revid, parentid):
167
        """Callback for when the show button for a parent is clicked."""
168
        self._show_callback(revid, parentid)
169
170
    def _go_clicked_cb(self, widget, revid):
171
        """Callback for when the go button for a parent is clicked."""
172
        self._go_callback(revid)
173
412.1.4 by Daniel Schierbeck
Made tag list smarter.
174
    def _add_tags(self, *args):
175
        if self._tagdict.has_key(self._revision.revision_id):
176
            tags = self._tagdict[self._revision.revision_id]
177
        else:
178
            tags = []
179
            
241 by Jelmer Vernooij
Show tags in bzr viz.
180
        if tags == []:
181
            self.tags_list.hide()
182
            self.tags_label.hide()
183
            return
184
185
        for widget in self.tags_widgets:
186
            self.tags_list.remove(widget)
187
242 by Jelmer Vernooij
Avoid cleanup warning.
188
        self.tags_widgets = []
189
241 by Jelmer Vernooij
Show tags in bzr viz.
190
        for tag in tags:
191
            widget = gtk.Label(tag)
192
            widget.set_selectable(True)
193
            self.tags_widgets.append(widget)
194
            self.tags_list.add(widget)
195
        self.tags_list.show_all()
196
        self.tags_label.show_all()
197
        
256.2.23 by Gary van der Merwe
Show Children
198
    def _add_parents_or_children(self, revids, widgets, table):
199
        while len(widgets) > 0:
200
            widget = widgets.pop()
201
            table.remove(widget)
202
        
203
        table.resize(max(len(revids), 1), 2)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
204
256.2.23 by Gary van der Merwe
Show Children
205
        for idx, revid in enumerate(revids):
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
206
            align = gtk.Alignment(0.0, 0.0)
256.2.23 by Gary van der Merwe
Show Children
207
            widgets.append(align)
208
            table.attach(align, 1, 2, idx, idx + 1,
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
209
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
210
            align.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
211
212
            hbox = gtk.HBox(False, spacing=6)
213
            align.add(hbox)
214
            hbox.show()
215
216
            image = gtk.Image()
217
            image.set_from_stock(
218
                gtk.STOCK_FIND, gtk.ICON_SIZE_SMALL_TOOLBAR)
219
            image.show()
220
148 by Jelmer Vernooij
Clean up interface a bit: don't show diff button when no diff can be accessed, use label instead of button when there is no callback set.
221
            if self._show_callback is not None:
222
                button = gtk.Button()
223
                button.add(image)
224
                button.connect("clicked", self._show_clicked_cb,
256.2.23 by Gary van der Merwe
Show Children
225
                               self._revision.revision_id, revid)
148 by Jelmer Vernooij
Clean up interface a bit: don't show diff button when no diff can be accessed, use label instead of button when there is no callback set.
226
                hbox.pack_start(button, expand=False, fill=True)
227
                button.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
228
148 by Jelmer Vernooij
Clean up interface a bit: don't show diff button when no diff can be accessed, use label instead of button when there is no callback set.
229
            if self._go_callback is not None:
256.2.23 by Gary van der Merwe
Show Children
230
                button = gtk.Button(revid)
231
                button.connect("clicked", self._go_clicked_cb, revid)
148 by Jelmer Vernooij
Clean up interface a bit: don't show diff button when no diff can be accessed, use label instead of button when there is no callback set.
232
            else:
256.2.23 by Gary van der Merwe
Show Children
233
                button = gtk.Label(revid)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
234
            button.set_use_underline(False)
235
            hbox.pack_start(button, expand=False, fill=True)
236
            button.show()
0.1.1 by Dan Loda
First working version of xannotate.
237
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
238
    def _create_general(self):
0.1.1 by Dan Loda
First working version of xannotate.
239
        vbox = gtk.VBox(False, 6)
240
        vbox.set_border_width(6)
241
        vbox.pack_start(self._create_headers(), expand=False, fill=True)
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
242
        vbox.pack_start(self._create_message_view())
243
        self.append_page(vbox, tab_label=gtk.Label("General"))
244
        vbox.show()
245
246
    def _create_relations(self):
247
        vbox = gtk.VBox(False, 6)
248
        vbox.set_border_width(6)
291 by Jelmer Vernooij
Put children widget on a new line.
249
        vbox.pack_start(self._create_parents(), expand=False, fill=True)
250
        if self.show_children:
251
            vbox.pack_start(self._create_children(), expand=False, fill=True)
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
252
        self.append_page(vbox, tab_label=gtk.Label("Relations"))
0.1.1 by Dan Loda
First working version of xannotate.
253
        vbox.show()
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
254
0.1.1 by Dan Loda
First working version of xannotate.
255
    def _create_headers(self):
241 by Jelmer Vernooij
Show tags in bzr viz.
256
        self.table = gtk.Table(rows=5, columns=2)
0.1.1 by Dan Loda
First working version of xannotate.
257
        self.table.set_row_spacings(6)
258
        self.table.set_col_spacings(6)
259
        self.table.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
260
261
        align = gtk.Alignment(1.0, 0.5)
262
        label = gtk.Label()
263
        label.set_markup("<b>Revision Id:</b>")
264
        align.add(label)
265
        self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
266
        align.show()
267
        label.show()
268
269
        align = gtk.Alignment(0.0, 0.5)
412.1.5 by Daniel Schierbeck
Made the revision id label use signals when updating.
270
        revision_id = gtk.Label()
271
        revision_id.set_selectable(True)
272
        self.connect('notify::revision', 
273
                lambda w, p: revision_id.set_text(self._revision.revision_id))
274
        align.add(revision_id)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
275
        self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
276
        align.show()
412.1.5 by Daniel Schierbeck
Made the revision id label use signals when updating.
277
        revision_id.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
278
0.1.1 by Dan Loda
First working version of xannotate.
279
        align = gtk.Alignment(1.0, 0.5)
259 by Aaron Bentley
Add author support to gannotate and log viewer
280
        self.author_label = gtk.Label()
281
        self.author_label.set_markup("<b>Author:</b>")
282
        align.add(self.author_label)
283
        self.table.attach(align, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
284
        align.show()
285
        self.author_label.show()
286
287
        align = gtk.Alignment(0.0, 0.5)
288
        self.author = gtk.Label()
289
        self.author.set_selectable(True)
290
        align.add(self.author)
291
        self.table.attach(align, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
292
        align.show()
293
        self.author.show()
294
        self.author.hide()
295
296
        align = gtk.Alignment(1.0, 0.5)
0.1.1 by Dan Loda
First working version of xannotate.
297
        label = gtk.Label()
298
        label.set_markup("<b>Committer:</b>")
299
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
300
        self.table.attach(align, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
301
        align.show()
302
        label.show()
303
304
        align = gtk.Alignment(0.0, 0.5)
305
        self.committer = gtk.Label()
306
        self.committer.set_selectable(True)
307
        align.add(self.committer)
259 by Aaron Bentley
Add author support to gannotate and log viewer
308
        self.table.attach(align, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
309
        align.show()
310
        self.committer.show()
311
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
312
        align = gtk.Alignment(0.0, 0.5)
313
        label = gtk.Label()
314
        label.set_markup("<b>Branch nick:</b>")
315
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
316
        self.table.attach(align, 0, 1, 3, 4, gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
317
        label.show()
318
        align.show()
319
320
        align = gtk.Alignment(0.0, 0.5)
321
        self.branchnick_label = gtk.Label()
322
        self.branchnick_label.set_selectable(True)
323
        align.add(self.branchnick_label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
324
        self.table.attach(align, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
325
        self.branchnick_label.show()
326
        align.show()
327
0.1.1 by Dan Loda
First working version of xannotate.
328
        align = gtk.Alignment(1.0, 0.5)
329
        label = gtk.Label()
330
        label.set_markup("<b>Timestamp:</b>")
331
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
332
        self.table.attach(align, 0, 1, 4, 5, gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
333
        align.show()
334
        label.show()
335
336
        align = gtk.Alignment(0.0, 0.5)
337
        self.timestamp = gtk.Label()
338
        self.timestamp.set_selectable(True)
339
        align.add(self.timestamp)
259 by Aaron Bentley
Add author support to gannotate and log viewer
340
        self.table.attach(align, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
341
        align.show()
342
        self.timestamp.show()
343
241 by Jelmer Vernooij
Show tags in bzr viz.
344
        align = gtk.Alignment(1.0, 0.5)
345
        self.tags_label = gtk.Label()
346
        self.tags_label.set_markup("<b>Tags:</b>")
347
        align.add(self.tags_label)
348
        align.show()
261 by Aaron Bentley
Fix tags formatting
349
        self.table.attach(align, 0, 1, 5, 6, gtk.FILL, gtk.FILL)
241 by Jelmer Vernooij
Show tags in bzr viz.
350
        self.tags_label.show()
351
352
        align = gtk.Alignment(0.0, 0.5)
353
        self.tags_list = gtk.VBox()
354
        align.add(self.tags_list)
261 by Aaron Bentley
Fix tags formatting
355
        self.table.attach(align, 1, 2, 5, 6, gtk.EXPAND | gtk.FILL, gtk.FILL)
241 by Jelmer Vernooij
Show tags in bzr viz.
356
        align.show()
357
        self.tags_list.show()
358
        self.tags_widgets = []
359
412.1.4 by Daniel Schierbeck
Made tag list smarter.
360
        self.connect('notify::revision', self._add_tags)
361
0.1.1 by Dan Loda
First working version of xannotate.
362
        return self.table
363
256.2.23 by Gary van der Merwe
Show Children
364
    
291 by Jelmer Vernooij
Put children widget on a new line.
365
    def _create_parents(self):
366
        hbox = gtk.HBox(True, 3)
256.2.23 by Gary van der Merwe
Show Children
367
        
368
        self.parents_table = self._create_parents_or_children_table(
369
            "<b>Parents:</b>")
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
370
        self.parents_widgets = []
256.2.23 by Gary van der Merwe
Show Children
371
        hbox.pack_start(self.parents_table)
291 by Jelmer Vernooij
Put children widget on a new line.
372
373
        hbox.show()
374
        return hbox
375
376
    def _create_children(self):
377
        hbox = gtk.HBox(True, 3)
378
        self.children_table = self._create_parents_or_children_table(
379
            "<b>Children:</b>")
380
        self.children_widgets = []
381
        hbox.pack_start(self.children_table)
256.2.23 by Gary van der Merwe
Show Children
382
        hbox.show()
383
        return hbox
384
        
385
    def _create_parents_or_children_table(self, text):
386
        table = gtk.Table(rows=1, columns=2)
387
        table.set_row_spacings(3)
388
        table.set_col_spacings(6)
389
        table.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
390
391
        label = gtk.Label()
256.2.23 by Gary van der Merwe
Show Children
392
        label.set_markup(text)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
393
        align = gtk.Alignment(0.0, 0.5)
394
        align.add(label)
256.2.23 by Gary van der Merwe
Show Children
395
        table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
396
        label.show()
397
        align.show()
398
256.2.23 by Gary van der Merwe
Show Children
399
        return table
400
    
401
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
402
0.1.1 by Dan Loda
First working version of xannotate.
403
    def _create_message_view(self):
412.1.6 by Daniel Schierbeck
Made the message buffer use signals when updating.
404
        msg_buffer = gtk.TextBuffer()
405
        self.connect('notify::revision',
406
                lambda w, p: msg_buffer.set_text(self._revision.message))
324.2.2 by Daniel Schierbeck
Surrounded the commit message textview with a scrolled window and added a shadow.
407
        window = gtk.ScrolledWindow()
408
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
409
        window.set_shadow_type(gtk.SHADOW_IN)
412.1.6 by Daniel Schierbeck
Made the message buffer use signals when updating.
410
        tv = gtk.TextView(msg_buffer)
0.1.1 by Dan Loda
First working version of xannotate.
411
        tv.set_editable(False)
412
        tv.set_wrap_mode(gtk.WRAP_WORD)
413
        tv.modify_font(pango.FontDescription("Monospace"))
414
        tv.show()
324.2.2 by Daniel Schierbeck
Surrounded the commit message textview with a scrolled window and added a shadow.
415
        window.add(tv)
416
        window.show()
417
        return window
0.1.1 by Dan Loda
First working version of xannotate.
418
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
419
    def _create_file_info_view(self):
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
420
        self.file_info_box = gtk.VBox(False, 6)
421
        self.file_info_box.set_border_width(6)
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
422
        self.file_info_buffer = gtk.TextBuffer()
278.1.44 by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages.
423
        window = gtk.ScrolledWindow()
424
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
425
        window.set_shadow_type(gtk.SHADOW_IN)
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
426
        tv = gtk.TextView(self.file_info_buffer)
427
        tv.set_editable(False)
428
        tv.set_wrap_mode(gtk.WRAP_WORD)
429
        tv.modify_font(pango.FontDescription("Monospace"))
430
        tv.show()
278.1.44 by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages.
431
        window.add(tv)
432
        window.show()
433
        self.file_info_box.pack_start(window)
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
434
        self.file_info_box.hide() # Only shown when there are per-file messages
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
435
        self.append_page(self.file_info_box, tab_label=gtk.Label('Per-file'))
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
436