
import os 

from gi.repository import GObject
from gi.repository import Peas 

def main(argv = []):
    engine = Peas.Engine.get_default() 
    cwd = os.getcwd()
    engine.enable_loader('python')
    engine.add_search_path('.', None)
    engine.rescan_plugins()
    s = Peas.ExtensionSet.new(engine, Peas.Activatable, {'test': 'test'})

    for p in engine.get_plugin_list():

        if p.is_loaded():
            print "Skipping Already Loaded plugin", p.get_name()
            continue 

        if not engine.load_plugin(p):
            print "FAILED TO LOAD PLUGIN", p.get_name()
            continue

        print "plugin loaded", p.get_name()

if __name__ == '__main__': 
    import sys
    main(sys.argv)
