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/roster_buttons/plugin.py

    r9803 r9821  
    2020 
    2121:author: Mateusz Biliński <mateusz@bilinski.it> 
    22 :since: 06/10/2008 
     22:since: 14th June 2008 
    2323:copyright: Copyright (2008) Mateusz Biliński <mateusz@bilinski.it> 
    2424:license: GPL 
     
    4545        #def __init__(self): 
    4646                #super(RosterButtonsPlugin, self).__init__() 
     47 
     48        @log_calls('RosterButtonsPlugin')        
     49        def init(self): 
     50                #log.debug('self.__path__==%s'%(self.__path__)) 
     51                self.GLADE_FILE_PATH = self.local_file_path('roster_buttons.glade') 
    4752                 
     53                self.roster_vbox = gajim.interface.roster.xml.get_widget('roster_vbox2') 
     54                self.show_offline_contacts_menuitem = gajim.interface.roster.xml.get_widget('show_offline_contacts_menuitem') 
     55         
    4856        @log_calls('RosterButtonsPlugin') 
    4957        def activate(self): 
    50                 #log.debug('self.__path__==%s'%(self.__path__)) 
    51                 self.GLADE_FILE_PATH = self.local_file_path('roster_buttons.glade') 
    5258                self.xml = gtk.glade.XML(self.GLADE_FILE_PATH, root='roster_buttons_buttonbox', domain=i18n.APP) 
    5359                self.buttonbox = self.xml.get_widget('roster_buttons_buttonbox') 
    5460                 
    55                 self.roster_vbox = gajim.interface.roster.xml.get_widget('roster_vbox2') 
    5661                self.roster_vbox.pack_start(self.buttonbox, expand=False) 
    5762                self.roster_vbox.reorder_child(self.buttonbox, 0) 
    58                  
    59                 self.show_offline_contacts_menuitem = gajim.interface.roster.xml.get_widget('show_offline_contacts_menuitem') 
    60                  
    6163                self.xml.signal_autoconnect(self) 
    62                  
    6364                 
    6465        @log_calls('RosterButtonsPlugin') 
     
    7374                #gajim.interface.roster.on_show_offline_contacts_menuitem_activate(None) 
    7475                self.show_offline_contacts_menuitem.set_active(not self.show_offline_contacts_menuitem.get_active()) 
    75                  
    7676         
    7777        @log_calls('RosterButtonsPlugin')