This repository has been archived by the owner on Nov 19, 2023. It is now read-only.
Plugins
Paolo Capriotti edited this page Sep 22, 2010
·
2 revisions
Plugins in Kaya are simply classes mixing in the module Plugin
, loaded at application startup.
Every plugin declares an interface. Interfaces can be seen as a contract that the plugin in question promises to comply to. Interfaces need not be specified in code, so you need to refer to the documentation to find out the specific requirements of each interface.
As an example, we show how to create a simple Hello World
plugin. When loaded, 'Hello World' will add an action to the main window that when activated displays a message in the console.
require 'plugins/plugin'
class HelloWorldPlugin
include Plugin
include ActionProvider
plugin :name => 'Hello World',
:interface => :action_provider
def initialize
action(:hello_world,
:text => KDE.i18n('Say &Hello World')) do |parent|
parent.console.append("Hello world")
end
end
def gui
KDE::gui(:hello_world) do |g|
g.menubar do |mb|
mb.menu(:gameMenu) do |m|
m.action :hello_world
end
end
end
end
end