/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

  • Committer: Jelmer Vernooij
  • Date: 2006-05-20 19:54:10 UTC
  • mto: This revision was merged to the branch mainline in revision 80.
  • Revision ID: jelmer@samba.org-20060520195410-88bd7ceb34fc2024
Adapt to bzr-gtk's API changes, add 'Clone' dialog

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
load_plugins()
9
9
 
10
10
try:
11
 
    from bzrlib.plugins.gtk.viz import cmd_visualise
12
 
    from bzrlib.plugins.gtk.annotate import cmd_gannotate
 
11
    from bzrlib.plugins.gtk import cmd_visualise, cmd_gannotate
13
12
    have_gtkplugin = True
14
13
except ImportError:
15
14
    have_gtkplugin = False
44
43
        except NotBranchError:
45
44
            return
46
45
 
 
46
        #FIXME
 
47
 
47
48
        return
48
49
 
49
50
    def unignore_cb(self, menu, vfs_file):
57
58
        except NotBranchError:
58
59
            return
59
60
 
 
61
        #FIXME
 
62
 
60
63
        return
61
64
 
62
65
    def diff_cb(self, menu, vfs_file):
89
92
            tree, path = WorkingTree.open_containing(file)
90
93
        except NotBranchError:
91
94
            BzrDir.create_branch_and_repo(file)
92
 
            return
93
 
 
94
 
        return
95
95
 
96
96
    def remove_cb(self, menu, vfs_file):
97
97
        # We can only cope with local files
106
106
 
107
107
        tree.remove(path)
108
108
 
109
 
        return
110
 
 
111
109
    def annotate_cb(self, menu, vfs_file):
112
110
        # We can only cope with local files
113
111
        if vfs_file.get_uri_scheme() != 'file':
117
115
 
118
116
        vis = cmd_gannotate()
119
117
        vis.run(file)
 
118
 
 
119
    def clone_cb(self, menu, vfs_file=None):
 
120
        # We can only cope with local files
 
121
        if vfs_file.get_uri_scheme() != 'file':
 
122
            return
 
123
 
 
124
        file = vfs_file.get_uri()
 
125
        try:
 
126
            tree, path = WorkingTree.open_containing(file)
 
127
        except NotBranchError:
 
128
            return
 
129
 
 
130
        from bzrlib.plugins.gtk.clone import CloneDialog
 
131
        dialog = CloneDialog(file)
 
132
        if dialog.run() != gtk.RESPONSE_CANCEL:
 
133
            bzrdir = BzrDir.open(dialog.url)
 
134
            bzrdir.sprout(dialog.dest_path)
120
135
 
121
136
    def commit_cb(self, menu, vfs_file=None):
122
137
        # We can only cope with local files
129
144
        except NotBranchError:
130
145
            return
131
146
 
132
 
        from bzrlib.plugins.gtk.commit.gcommit import GCommitDialog
 
147
        from bzrlib.plugins.gtk.commit import GCommitDialog
133
148
        dialog = GCommitDialog(tree)
134
149
        dialog.set_title(path + " - Commit")
135
150
        if dialog.run() != gtk.RESPONSE_CANCEL:
163
178
                                 'Create new Bazaar tree',
164
179
                                 'Create new Bazaar tree in this folder')
165
180
            item.connect('activate', self.newtree_cb, vfs_file)
166
 
            return item
 
181
            items.append(item)
 
182
 
 
183
            item = nautilus.MenuItem('BzrNautilus::clone',
 
184
                                 'Checkout',
 
185
                                 'Checkout Existing Bazaar Branch')
 
186
            item.connect('activate', self.clone_cb, vfs_file)
 
187
            items.append(item)
 
188
 
 
189
            return items
167
190
 
168
191
        items = []
169
192
        if have_gtkplugin: