/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: jbailey at ubuntu
  • Date: 2006-05-14 14:54:33 UTC
  • mto: (0.5.10 nautilus-bzr)
  • mto: This revision was merged to the branch mainline in revision 80.
  • Revision ID: jbailey@ubuntu.com-20060514145433-21dabbd6f477b455
Add hook for creating new bzr trees.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
 
76
76
        return
77
77
 
 
78
    def newtree_cb(self, menu, vfs_file):
 
79
        # We can only cope with local files
 
80
        if vfs_file.get_uri_scheme() != 'file':
 
81
            return
 
82
 
 
83
        file = vfs_file.get_uri()
 
84
 
 
85
        # We only want to continue here if we get a NotBranchError
 
86
        try:
 
87
            tree, path = WorkingTree.open_containing(file)
 
88
        except NotBranchError:
 
89
            return
 
90
 
 
91
        return
 
92
 
78
93
    def remove_cb(self, menu, vfs_file):
79
94
        # We can only cope with local files
80
95
        if vfs_file.get_uri_scheme() != 'file':
90
105
 
91
106
        return
92
107
 
 
108
    def get_background_items(self, window, vfs_file):
 
109
        file = vfs_file.get_uri()
 
110
        try:
 
111
            tree, path = WorkingTree.open_containing(file)
 
112
        except NotBranchError:
 
113
            item = nautilus.MenuItem('BzrNautilus::newtree',
 
114
                                 'Create new Bazaar tree',
 
115
                                 'Create new Bazaar tree in this folder')
 
116
            item.connect('activate', self.newtree_cb, vfs_file)
 
117
            return item,
 
118
        return
 
119
 
 
120
 
93
121
    def get_file_items(self, window, files):
94
122
        items = []
95
123
 
102
130
            try:
103
131
                tree, path = WorkingTree.open_containing(file)
104
132
            except NotBranchError:
105
 
                return
 
133
                if not vfs_file.is_directory():
 
134
                    return
 
135
                item = nautilus.MenuItem('BzrNautilus::newtree',
 
136
                                     'Create new Bazaar tree',
 
137
                                     'Create new Bazaar tree in %s' % vfs_file.get_name())
 
138
                item.connect('activate', self.newtree_cb, vfs_file)
 
139
                return item,
106
140
 
107
141
            file_class = tree.file_class(path)
108
142