/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 nautilus-bzr.py

[merge] Jelmer

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
    from bzrlib.plugins.bzrk import cmd_visualise
9
9
    have_bzrk = True
10
10
except ImportError:
11
 
    pass
 
11
    have_bzrk = False
 
12
 
 
13
try:
 
14
    from bzrlib.plugins.gannotate import cmd_gannotate
 
15
    have_gannotate = True
 
16
except ImportError:
 
17
    have_gannotate = False
12
18
 
13
19
class BzrExtension(nautilus.MenuProvider):
14
20
    def __init__(self):
112
118
 
113
119
        return
114
120
 
 
121
    def annotate_cb(self, menu, vfs_file):
 
122
        # We can only cope with local files
 
123
        if vfs_file.get_uri_scheme() != 'file':
 
124
            return
 
125
 
 
126
        file = vfs_file.get_uri()
 
127
 
 
128
        vis = cmd_gannotate()
 
129
        vis.run(file)
 
130
 
 
131
        return
 
132
 
 
133
 
115
134
    def visualise_cb(self, menu, vfs_file):
116
135
        # We can only cope with local files
117
136
        if vfs_file.get_uri_scheme() != 'file':
209
228
                                     'Remove this file from versioning')
210
229
                item.connect('activate', self.remove_cb, vfs_file)
211
230
                items.append(item)
 
231
 
 
232
                if have_gannotate:
 
233
                    item = nautilus.MenuItem('BzrNautilus::annotate',
 
234
                                 'Annotate',
 
235
                                 'Annotate File Data')
 
236
                    item.connect('activate', self.annotate_cb, vfs_file)
 
237
                    items.append(item)
212
238
    
213
239
        return items