Show
Ignore:
Timestamp:
06/18/08 22:45:22 (6 months ago)
Author:
vardo
Message:

Added new 'init' method to Plugin class that plugins can implement to make actions that need to be done only once - when plugin is added (not activated) to Gajim. In this method plugins should declare handlers for GUI extension points. This was created so that init method doesn't have to be reimplemented in specific way (create config, load config) - it is all done by init in Plugin class. If init is reimplemented, it must call Plugin init (eg. using super() ) to plugin work properly.

Example plug-ins were modified to use init() instead of init().

Added new category in configuration - 'plugins'. It only holds one option for each plugin - 'active', which determines whether plugin should be activated on startup.

Now, Gajim remembers which plugins are active on exit, and activates them on next startup.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/plugin-system/src/plugins/plugin.py

    r9803 r9821  
    2020 
    2121:author: Mateusz Biliński <mateusz@bilinski.it> 
    22 :since: 06/01/2008 
     22:since: 1st June 2008 
    2323:copyright: Copyright (2008) Mateusz Biliński <mateusz@bilinski.it> 
    2424:license: GPL 
     
    105105                :type: `plugins.plugin.Config` 
    106106                ''' 
    107                  
    108                 self._load_config() 
     107                self.load_config() 
     108                self.init() 
    109109         
    110110        @log_calls('GajimPlugin') 
    111         def _save_config(self): 
     111        def save_config(self): 
    112112                pass 
    113113         
    114114        @log_calls('GajimPlugin')        
    115         def _load_config(self): 
     115        def load_config(self): 
    116116                pass 
    117117         
     
    123123        def local_file_path(self, file_name): 
    124124                return os.path.join(self.__path__, file_name) 
     125 
     126        @log_calls('GajimPlugin') 
     127        def init(self): 
     128                pass 
    125129         
    126130        @log_calls('GajimPlugin')