Plugins

Plugins — The Caja-Actions Extension Interface Definition v 1

Synopsis

#include <caja-actions/na-extension.h>

gboolean            na_extension_startup                (GTypeModule *module);
guint               na_extension_get_version            (void);
guint               na_extension_list_types             (const GType **types);
void                na_extension_shutdown               (void);

Description

Caja-Actions™ accepts extensions as dynamically loadable libraries (aka plugins).

As of today, Caja-Actions™ may be extended in the following areas:

  • Storing menus and actions in a specific storage subsystem .  This extension is provided via the public NAIIOProvider interface; it takes care of reading and writing menus and actions to a specific storage subsystem.

  • Exporting menus and actions .  This extension is provided via the public NAIExporter interface; it takes care of exporting menus and actions to the filesystem from the Caja-Actions™ Configuration Tool user interface.

  • Importing menus and actions .  This extension is provided via the public NAIImporter interface; it takes care of importing menus and actions from the filesystem into the Caja-Actions™ Configuration Tool user interface.

In order to be recognized as a valid Caja-Actions™ plugin, the library must at least export the functions described in this extension API.

Developing a Caja-Actions™ plugin

Building the dynamically loadable library

The suggested way of producing a dynamically loadable library is to use autoconf, automake and libtool GNU applications.

In this case, it should be enough to use the -module option in your Makefile.am, as in:

  libna_io_desktop_la_LDFLAGS = -module -no-undefined -avoid-version

Installing the library

At startup time, Caja-Actions™ searches for its candidate libraries in PKGLIBDIR directory, which most often happens to be /usr/lib/caja-actions/ or /usr/lib64/caja-actions/, depending of your system.

Versions historic

Table 1. Historic of the versions of this extension API

Caja-Actions™ version extension API version  
since 2.30 1 current version

Details

na_extension_startup ()

gboolean            na_extension_startup                (GTypeModule *module);

This function is called by the Caja-Actions plugin manager when the plugin library is first loaded in memory. The library may so take advantage of this call by initializing itself, registering its internal GType types, etc.

A Caja-Actions extension must implement this function in order to be considered as a valid candidate to dynamic load.

Example 1. 

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