1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
9 require 'plugins/plugin'
25 loader = PluginLoader.new
26 plugin = loader.get_all_matching(:engine).find do |e|
27 e.data(:protocol) == data[:protocol]
29 fact = lambda do |color, match|
30 plugin.new(@path, @name, color, match,
36 @game = Game.get(data[:game])
37 @protocol = data[:protocol]
38 @workdir = data[:workdir]
42 def self.load(name, group)
44 :game => group.read_entry('game').to_sym,
45 :path => group.read_entry('path'),
46 :protocol => group.read_entry('protocol'),
47 :workdir => group.read_entry('workdir')
51 group.write_entry('game', @game.class.data(:id).to_s)
52 group.write_entry('path', @path)
53 group.write_entry('protocol', @protocol)
54 group.write_entry('workdir', @workdir)
58 plugin :name => 'Default Engine Loader',
59 :interface => :engine_loader
63 config = KDE::Global.config.group("Engines")
64 engine_groups = config.group_list
65 engine_groups.each do |engine_group|
66 entry = Entry.load(engine_group, config.group(engine_group))
67 @entries[entry.name] = entry
71 def update_entries(entries)
72 @entries = entries.dup
74 config = KDE::Global.config.group("Engines")
76 @entries.each do |name, engine|
77 group = config.group(name)
87 def find_by_game(game)
88 @entries.select do |name, e|