/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: Martin Albisetti
  • Date: 2008-04-04 01:46:01 UTC
  • Revision ID: argentina@gmail.com-20080404014601-hutl46uqxx7psg2o
Removed duplicate code

Show diffs side-by-side

added added

removed removed

Lines of Context:
250
250
            item = nautilus.MenuItem('BzrNautilus::enable',
251
251
                                     'Enable Bazaar Plugin for this Branch',
252
252
                                     'Enable Bazaar plugin for nautilus')
253
 
            item.connect('activate', self.enable_integration, vfs_file)
 
253
            item.connect('activate', self.toggle_integration, 'True', vfs_file)
254
254
            return item,
255
255
        else:
256
256
            item = nautilus.MenuItem('BzrNautilus::disable',
257
257
                                      'Disable Bazaar Plugin for the Branch',
258
258
                                      'Disable Bazaar plugin for nautilus')
259
 
            item.connect('activate', self.disable_integration, vfs_file)
 
259
            item.connect('activate', self.toggle_integration, 'False', vfs_file)
260
260
            items.append(item)
261
261
 
262
262
        item = nautilus.MenuItem('BzrNautilus::log',
436
436
                disabled_flag = config.get_user_option('nautilus_integration')
437
437
        return disabled_flag
438
438
 
439
 
    def enable_integration(self, menu, vfs_file=None):
 
439
    def toggle_integration(self, menu, action, vfs_file=None):
440
440
        try:
441
441
            tree, path = WorkingTree.open_containing(vfs_file.get_uri())
442
442
        except NotBranchError:
448
448
            config = GlobalConfig()
449
449
        else:
450
450
            config = branch.get_config()
451
 
        config.set_user_option('nautilus_integration','True')
 
451
        config.set_user_option('nautilus_integration', action)
452
452
 
453
 
    def disable_integration(self, menu, vfs_file=None):
454
 
        try:
455
 
            tree, path = WorkingTree.open_containing(vfs_file.get_uri())
456
 
        except NotBranchError:
457
 
            return
458
 
        except NoWorkingTree:
459
 
            return   
460
 
        branch = tree.branch
461
 
        if branch is None:
462
 
            config = GlobalConfig()
463
 
        else:
464
 
            config = branch.get_config()
465
 
        config.set_user_option('nautilus_integration','False')