~ubuntu-branches/ubuntu/karmic/zim/karmic

« back to all changes in this revision

Viewing changes to share/zim/doc/Zim/Development/plugins.txt

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Hertzog
  • Date: 2007-12-01 20:50:34 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20071201205034-bpweecgj7wtt9ze2
Tags: 0.23-1
* New upstream version. Closes: #452999
  * Now handles symlinks properly. Closes: #446870
* Add myself to Uploaders.
* Updated dependencies to match new requirements: libfile-basedir-perl 
  (>= 0.03), libfile-desktopentry-perl (>= 0.04)
* Add Vcs-Svn and Vcs-Browser fields to document the SVN repository now used
  to co-maintain the package.
* Add an Homepage field pointing to the upstream website.
* Moved libmodule-build-perl to Build-Depends-Indep as it's needed for the
  clean target.
* Fix some bad permissions detected by lintian.
* Updated debian/menu file to conform to the new menu policy and added an
  icon.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
====== Plugins ======
 
2
 
 
3
See also [[:zim:usage:plugins]]
 
4
 
 
5
**Zim** has a simple plugin system to add extended functionality. Plugins are just perl scripts that are installed in a directory where **zim** can find them. If the user chooses to use the plugin the script is loaded during program initialization.
 
6
 
 
7
At the moment there is not yet a real plugin API, so plugins need to work directly with the internal structures of the program. This means that plugins often need to be updated for newer versions of **zim**.
 
8
 
 
9
==== Locations ====
 
10
Plugin scripts are looked for in ''XDG_DATA_DIR/zim/plugins/'' this means that by default they will be located in ''/usr/share/zim/plugins'' or ''/usr/local/zim/plugins''. Users can install their own plugins in ''~/.local/share/zim/plugins''.
 
11
 
 
12
For more information on this directory scheme have a look at the freedesktop [[http://freedesktop.org/wiki/Standards_2fbasedir_2dspec|basedir specification]].
 
13
 
 
14
==== API ====
 
15
See [[class diagram]] for a description of zim's object structure.
 
16
 
 
17
To get a reference to the main application object in your script use:
 
18
 
 
19
        my $app = Zim::GUI->current();
 
20
 
 
21
To add an object for your plugin you can either load it directly from your plugin script like this:
 
22
 
 
23
        my $object = Foo::Bar->new();
 
24
        $app->add_object(FooBar => $object);
 
25
 
 
26
or you can have it autoloaded when needed like this:
 
27
 
 
28
        $app->add_object(FooBar => 'Foo::Bar');
 
29
 
 
30
or like this :
 
31
 
 
32
        $app->add_object(FooBar => sub { return Foo::Bar->new(@args) });
 
33
 
 
34
In all cases you can get a reference to the object by calling
 
35
 
 
36
        $app->FooBar()
 
37
 
 
38
You can get references to the other objects that make up the application in a similar way.
 
39
 
 
40
==== Menu Items ====
 
41
**Zim** uses ''Gtk2::UIManager'' to load the content of the menubar and toolbar. See the "ui" and "action" functions in [[:man:Zim::GUI::Component|Zim::GUI::Component]].
 
42
 
 
43
Any custom icons you need should be put in ''XDG_DATA_DIR/pixmaps/zim/'', they will be loaded automatically. You can use the basename if the icon file as the stock name for an action.