30
30
import bzrlib.errors as errors
 
31
31
from bzrlib.workingtree import WorkingTree
 
33
 
from bzrlib.plugins.gtk import _i18n
 
34
33
from bzrlib.plugins.gtk.dialog import error_dialog, info_dialog, question_dialog, warning_dialog
 
35
34
from bzrlib.plugins.gtk.errors import show_bzr_error
 
36
35
from bzrlib.plugins.gtk.annotate.gannotate import GAnnotateWindow
 
37
36
from bzrlib.plugins.gtk.annotate.config import GAnnotateConfig
 
38
37
from bzrlib.plugins.gtk.diff import DiffWindow
 
39
38
from launch import launch
 
40
 
from bzrlib.plugins.gtk.olive import Preferences
 
 
39
from olive import Preferences
 
43
42
    """ This class is responsible for building the context menus. """
 
 
61
60
        self.actiongroup = gtk.ActionGroup('context')
 
62
61
        self.actiongroup.add_actions([('add', gtk.STOCK_ADD,
 
64
 
                                       _i18n('Add the selected file'),
 
 
63
                                       _('Add the selected file'),
 
66
65
                                      ('remove', gtk.STOCK_REMOVE,
 
67
 
                                       _i18n('Remove'), None,
 
68
 
                                       _i18n('Remove the selected file'),
 
 
67
                                       _('Remove the selected file'),
 
70
69
                                      ('remove_and_delete', gtk.STOCK_REMOVE,
 
71
 
                                       _i18n('Remove and delete'), None,
 
72
 
                                       _i18n('Remove the selected file/dir and delete from disk'),
 
 
70
                                       _('Remove and delete'), None,
 
 
71
                                       _('Remove the selected file/dir and delete from disk'),
 
73
72
                                       self.remove_and_delete_file),
 
75
 
                                       _i18n('Rename'), None,
 
76
 
                                       _i18n('Rename the selected file'),
 
 
75
                                       _('Rename the selected file'),
 
78
77
                                      ('open', gtk.STOCK_OPEN,
 
80
 
                                       _i18n('Open the selected file'),
 
 
79
                                       _('Open the selected file'),
 
83
 
                                       _i18n('Revert'), None,
 
84
 
                                       _i18n('Revert the changes'),
 
 
83
                                       _('Revert the changes'),
 
87
 
                                       _i18n('Commit'), None,
 
88
 
                                       _i18n('Commit the changes'),
 
 
87
                                       _('Commit the changes'),
 
91
 
                                       _i18n('Annotate'), None,
 
92
 
                                       _i18n('Annotate the selected file'),
 
 
91
                                       _('Annotate the selected file'),
 
96
 
                                       _i18n('Show the diff of the file'),
 
 
95
                                       _('Show the diff of the file'),
 
99
 
                                       _i18n('Bookmark'), None,
 
100
 
                                       _i18n('Bookmark current location'),
 
 
99
                                       _('Bookmark current location'),
 
102
101
                                      ('edit_bookmark', gtk.STOCK_EDIT,
 
104
 
                                       _i18n('Edit the selected bookmark'),
 
 
103
                                       _('Edit the selected bookmark'),
 
105
104
                                       self.edit_bookmark),
 
106
105
                                      ('remove_bookmark', gtk.STOCK_REMOVE,
 
107
 
                                       _i18n('Remove'), None,
 
108
 
                                       _i18n('Remove the selected bookmark'),
 
 
107
                                       _('Remove the selected bookmark'),
 
109
108
                                       self.remove_bookmark),
 
110
109
                                      ('open_folder', gtk.STOCK_OPEN,
 
111
 
                                       _i18n('Open Folder'), None,
 
112
 
                                       _i18n('Open bookmark folder in Nautilus'),
 
 
110
                                       _('Open Folder'), None,
 
 
111
                                       _('Open bookmark folder in Nautilus'),
 
113
112
                                       self.open_folder),
 
114
113
                                      ('diff_selected', None,
 
115
 
                                       _i18n('Selected...'), None,
 
116
 
                                       _i18n('Show the differences of the selected file'),
 
 
114
                                       _('Selected...'), None,
 
 
115
                                       _('Show the differences of the selected file'),
 
117
116
                                       self.diff_selected),
 
118
117
                                      ('diff_all', None,
 
119
 
                                       _i18n('All...'), None,
 
120
 
                                       _i18n('Show the differences of all files'),
 
 
119
                                       _('Show the differences of all files'),
 
122
121
                                      ('view_remote', None,
 
123
 
                                       _i18n('View contents'), None,
 
124
 
                                       _i18n('View the contents of the file in a builtin viewer'),
 
 
122
                                       _('View contents'), None,
 
 
123
                                       _('View the contents of the file in a builtin viewer'),
 
125
124
                                       self.view_remote),
 
126
125
                                      ('diff_remote', None,
 
127
 
                                       _i18n('Show differences'), None,
 
128
 
                                       _i18n('Show the differences between two revisions of the file'),
 
 
126
                                       _('Show differences'), None,
 
 
127
                                       _('Show the differences between two revisions of the file'),
 
129
128
                                       self.diff_remote),
 
130
129
                                      ('revert_remote', None,
 
131
 
                                       _i18n('Revert to this revision'), None,
 
132
 
                                       _i18n('Revert the selected file to the selected revision'),
 
 
130
                                       _('Revert to this revision'), None,
 
 
131
                                       _('Revert the selected file to the selected revision'),
 
133
132
                                       self.revert_remote)
 
 
272
271
        wt, path = WorkingTree.open_containing(self.path)
 
273
272
        ret = wt.revert([os.path.join(path, self.selected)])
 
275
 
            warning_dialog(_i18n('Conflicts detected'),
 
276
 
                           _i18n('Please have a look at the working tree before continuing.'))
 
 
274
            warning_dialog(_('Conflicts detected'),
 
 
275
                           _('Please have a look at the working tree before continuing.'))
 
278
 
            info_dialog(_i18n('Revert successful'),
 
279
 
                        _i18n('All files reverted to last revision.'))
 
 
277
            info_dialog(_('Revert successful'),
 
 
278
                        _('All files reverted to last revision.'))
 
280
279
        self.app.refresh_right()       
 
282
281
    def commit(self, action):
 
 
316
311
    def bookmark(self, action):
 
317
312
        """ Right context menu -> Bookmark """
 
318
313
        if self.pref.add_bookmark(self.path):
 
319
 
            info_dialog(_i18n('Bookmark successfully added'),
 
320
 
                        _i18n('The current directory was bookmarked. You can reach\nit by selecting it from the left panel.'))
 
 
314
            info_dialog(_('Bookmark successfully added'),
 
 
315
                        _('The current directory was bookmarked. You can reach\nit by selecting it from the left panel.'))
 
321
316
            self.pref.write()
 
323
 
            warning_dialog(_i18n('Location already bookmarked'),
 
324
 
                           _i18n('The current directory is already bookmarked.\nSee the left panel for reference.'))
 
 
318
            warning_dialog(_('Location already bookmarked'),
 
 
319
                           _('The current directory is already bookmarked.\nSee the left panel for reference.'))
 
326
321
        self.app.refresh_left()