76
77
_('Bookmark'), None,
77
78
_('Bookmark current location'),
79
('edit_bookmark', gtk.STOCK_EDIT,
81
_('Edit the selected bookmark'),
83
80
('remove_bookmark', gtk.STOCK_REMOVE,
85
82
_('Remove the selected bookmark'),
86
83
self.remove_bookmark),
87
('open_folder', gtk.STOCK_OPEN,
88
_('Open Folder'), None,
89
_('Open bookmark folder in Nautilus'),
91
84
('diff_selected', None,
92
85
_('Selected...'), None,
93
86
_('Show the differences of the selected file'),
132
125
filename = self.comm.get_selected_right()
134
127
if filename is None:
135
error_dialog(_('No file was selected'),
136
_('Please select a file from the list,\nor choose the other option.'))
128
self.dialog.error_dialog(_('No file was selected'),
129
_('Please select a file from the list,\nor choose the other option.'))
140
bzrlib.add.smart_add([directory + '/' + filename])
133
fileops.add([directory + '/' + filename])
141
134
except errors.NotBranchError:
142
error_dialog(_('Directory is not a branch'),
143
_('You can perform this action only in a branch.'))
135
self.dialog.error_dialog(_('Directory is not a branch'),
136
_('You can perform this action only in a branch.'))
146
141
self.comm.refresh_right()
152
147
filename = self.comm.get_selected_right()
154
149
if filename is None:
155
error_dialog(_('No file was selected'),
156
_('Please select a file from the list,\nor choose the other option.'))
150
self.dialog.error_dialog(_('No file was selected'),
151
_('Please select a file from the list,\nor choose the other option.'))
160
wt, path = WorkingTree.open_containing(directory+'/'+filename)
155
fileops.remove([directory + '/' + filename])
163
156
except errors.NotBranchError:
164
error_dialog(_('Directory is not a branch'),
157
self.dialog.error_dialog(_('Directory is not a branch'),
165
158
_('You can perform this action only in a branch.'))
167
160
except errors.NotVersionedError:
168
error_dialog(_('File not versioned'),
161
self.dialog.error_dialog(_('File not versioned'),
169
162
_('The selected file is not versioned.'))
172
self.comm.refresh_right()
174
def open_file(self, action):
175
""" Right context menu -> Open """
176
# Open only the selected file
177
filename = self.comm.get_selected_right()
180
error_dialog(_('No file was selected'),
181
_('Please select a file from the list,\nor choose the other option.'))
185
self.comm.set_path(os.path.split(self.comm.get_path())[0])
187
fullpath = self.comm.get_path() + os.sep + filename
188
if os.path.isdir(fullpath):
189
# selected item is an existant directory
190
self.comm.set_path(fullpath)
194
167
self.comm.refresh_right()
196
169
def commit(self, action):
197
170
""" Right context menu -> Commit """
198
171
from commit import OliveCommit
199
wt, path = WorkingTree.open_containing(self.comm.get_path())
200
commit = OliveCommit(wt, path)
172
commit = OliveCommit(self.gladefile, self.comm, self.dialog)
203
175
def diff(self, action):
204
176
""" Right context menu -> Diff """
205
177
from diff import OliveDiff
206
diff = OliveDiff(self.comm)
178
diff = OliveDiff(self.gladefile, self.comm, self.dialog)
209
181
def bookmark(self, action):
210
182
""" Right context menu -> Bookmark """
211
183
if self.comm.pref.add_bookmark(self.comm.get_path()):
212
info_dialog(_('Bookmark successfully added'),
184
self.dialog.info_dialog(_('Bookmark successfully added'),
213
185
_('The current directory was bookmarked. You can reach\nit by selecting it from the left panel.'))
215
warning_dialog(_('Location already bookmarked'),
187
self.dialog.warning_dialog(_('Location already bookmarked'),
216
188
_('The current directory is already bookmarked.\nSee the left panel for reference.'))
218
190
self.comm.refresh_left()
220
def edit_bookmark(self, action):
221
""" Left context menu -> Edit """
222
from bookmark import OliveBookmark
224
if self.comm.get_selected_left() != None:
225
bookmark = OliveBookmark(self.comm)
228
192
def remove_bookmark(self, action):
229
193
""" Left context menu -> Remove """
194
self.comm.pref.remove_bookmark(self.comm.get_selected_left())
231
if self.comm.get_selected_left() != None:
232
self.comm.pref.remove_bookmark(self.comm.get_selected_left())
233
self.comm.refresh_left()
235
def open_folder(self, action):
236
""" Left context menu -> Open Folder """
237
path = self.comm.get_selected_left()
196
self.comm.refresh_left()
242
198
def diff_selected(self, action):
243
199
""" Diff toolbutton -> Selected... """