File: gmodule_plugin_howto

package info (click to toggle)
gedit 0.5.4-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,388 kB
  • ctags: 1,622
  • sloc: ansic: 10,760; sh: 4,975; makefile: 463; sed: 93
file content (77 lines) | stat: -rw-r--r-- 2,431 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
This is a new plugin interface which uses shared libraries that are
dynamically loaded into the running gEdit process when they are
required.

You need to configure gEdit with the `--with-gmodule-plugins' option
to use this new plugin interface. It will not affect your old plugins,
you can still use them. This is only designed for new plugins.

Plugin Description Files
========================

Plugins are installed in $(libexecdir)/gedit/plugins - to keep track of
dependencies you need to put some plugin description files into this
directories.

This files must have a `.plugin' suffix and have the same format than
any "normal" GNOME configuration file.

There must be one section called `Plugin' in each of the files.

The following keys are recogniced:

  name - The name of the Plugin as it appears in the Plugins Menu.

  library_name - Name of the shared library containing the plugin. This
    may be either an absolute or a relative filename if the library is
    in the same directory.

  deplib_<number> - Additional libraries which must be loaded first.
    <number> is any number, libraries are loaded in the order given
    by their number.

Example:
-------

[Plugin]
name=GDB Source Editor
library_name=libsource_edit.so
deplib_0=/home/baulig/INSTALL/lib/libORBitutil.so
deplib_1=/home/baulig/INSTALL/lib/libIIOP.so
deplib_2=/home/baulig/INSTALL/lib/libORBit.so

Writing your own plugins
========================

First, you need to include <gE_plugin.h>. This header file is used both
in gEdit and in all plugins since they share some data structures.

There is a `gE_Plugin_Info' type declared in this header file which is
used to store information about your plugin:

	typedef void (*gE_Plugin_InitFunc)	(gE_Plugin_Object *);

	struct _gE_Plugin_Info
	{
		gchar *plugin_name;
		gE_Plugin_InitFunc init_func;
	};

You need to declare a global, initialized variable of this type in your
plugin and call it "gedit_plugin_info".

This structure currently has the following fields:

  plugin_name - The name of your plugin (currently unused).

  init_func - Pointer to a custom initialization function, if this is not
    NULL it is called with a pointer to the gE_Plugin_Object when the
    plugin is loaded.

This is the first version of this plugin interface - so it may change
in future ...

Martin <martin@home-of-linux.org>

Btw: To see a working example, have a look at GNOME GDB in the `ggdb' module !