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/plugins/acronyms_expander.py

    r9792 r9821  
    2020 
    2121:author: Mateusz Biliński <mateusz@bilinski.it> 
    22 :since: 06/10/2008 
     22:since: 9th June 2008 
    2323:copyright: Copyright (2008) Mateusz Biliński <mateusz@bilinski.it> 
    2424:license: GPL 
     
    4040        homepage = u'http://blog.bilinski.it' 
    4141 
    42         @log_calls('AcronymsExpanderPlugin') 
    43         def __init__(self): 
    44                 super(AcronymsExpanderPlugin, self).__init__() 
    45  
     42        #@log_calls('AcronymsExpanderPlugin') 
     43        #def __init__(self): 
     44                #super(AcronymsExpanderPlugin, self).__init__() 
     45                 
     46        def init(self): 
    4647                self.gui_extension_points = { 
    4748                        'chat_control_base' : (self.connect_with_chat_control_base, 
     
    5758                                                 'GW-' : 'http://trac.gajim.org/', 
    5859                                                 'GTS-' : 'http://trac.gajim.org/report' 
    59                                                 } 
     60                                                }                
    6061 
    6162        @log_calls('AcronymsExpanderPlugin') 
     
    100101                tv.get_buffer().disconnect(d['h_id']) 
    101102                 
     103