| libhildondesktop Reference Manual | ||||
|---|---|---|---|---|
Plugin Definition MacrosPlugin Definition Macros — Support for the definition of Hildon Desktop plugins. |
#include <libhildondesktop/libhildondesktop.h> #define HD_DEFINE_PLUGIN_MODULE (TN, t_n, T_P) #define HD_DEFINE_PLUGIN_MODULE_EXTENDED (TN, t_n, T_P, CODE, CODE_LOAD, CODE_UNLOAD) #define HD_PLUGIN_MODULE_SYMBOLS (t_n) #define HD_PLUGIN_MODULE_SYMBOLS_CODE (t_n, CODE_LOAD, CODE_UNLOAD)
To define Hildon Desktop plugins the macros HD_DEFINE_PLUGIN() or
HD_DEFINE_PLUGIN_MODULE_EXTENDED() should be used.
They are similar to the G_DEFINE_DYNAMIC_TYPE() macro but adds code to
dynamically register the class on module loading.
Example 1. Using HD_DEFINE_PLUGIN_MODULE() to define a Home widget
#ifndef __EXAMPLE_HOME_APPLET_H__
#define __EXAMPLE_HOME_APPLET_H__
#include <libhildondesktop/libhildondesktop.h>
G_BEGIN_DECLS
typedef struct _ExampleHomeApplet ExampleHomeApplet;
typedef struct _ExampleHomeAppletClass ExampleHomeAppletClass;
struct _ExampleHomeApplet
{
HDHomePluginItem parent;
};
struct _ExampleHomeAppletClass
{
HDHomePluginItemClass parent;
};
GType example_home_applet_get_type (void);
G_END_DECLS
#endif
#include "example-home-applet.h"
HD_DEFINE_PLUGIN_MODULE (ExampleHomeApplet, example_home_applet, HD_TYPE_HOME_PLUGIN_ITEM);
static void
example_home_applet_class_finalize (ExampleHomeAppletClass *klass)
{
}
static void
example_home_applet_class_init (ExampleHomeAppletClass *klass)
{
}
static void
example_home_applet_init (ExampleHomeApplet *applet)
{
}
#define HD_DEFINE_PLUGIN_MODULE(TN, t_n, T_P)
Register an object supplied by a plugin in Hildon Desktop.
See also to G_DEFINE_DYNAMIC_TYPE().
TN : |
The name of the object type, in Camel case. (ex: ObjectType) |
t_n : |
The name of the object type, in lowercase, with words separated by '_'. (ex: object_type) |
T_P : |
The GType of the parent (ex: STATUSBAR_TYPE_ITEM) |
#define HD_DEFINE_PLUGIN_MODULE_EXTENDED(TN, t_n, T_P, CODE, CODE_LOAD, CODE_UNLOAD)
Register an object supplied by a plugin in Hildon Desktop.
See also G_DEFINE_DYNAMIC_TYPE().
TN : |
The name of the object type, in Camel case. (ex: ObjectType) |
t_n : |
The name of the object type, in lowercase, with words separated by '_'. (ex: object_type) |
T_P : |
The GType of the parent (ex: STATUSBAR_TYPE_ITEM) |
CODE : |
Custom code that gets inserted in the *_register_type() function
|
CODE_LOAD : |
code executed when the plugin is loaded. |
CODE_UNLOAD : |
code executed when the plugin is unloaded. |
#define HD_PLUGIN_MODULE_SYMBOLS(t_n)
Defines exported functions to load and unload the modules. It is used by
HD_DEFINE_PLUGIN_MODULE() and should usually not used directly.
t_n : |
The name of the object type, in lowercase, with words separated by '_'. (ex: object_type) |
#define HD_PLUGIN_MODULE_SYMBOLS_CODE(t_n, CODE_LOAD, CODE_UNLOAD)
Defines exported functions to load and unload the modules. It is used by
HD_DEFINE_PLUGIN_MODULE_EXTENDED() and should usually not used directly.
t_n : |
The name of the object type, in lowercase, with words separated by '_'. (ex: object_type) |
CODE_LOAD : |
code executed when the plugin is loaded. |
CODE_UNLOAD : |
code executed when the plugin is unloaded. |