## GObject Oriented Panel Plugin Registers Macros

GObject Oriented Panel Plugin Registers Macros — Macros to register panel plugins, written as GObjects.

## Synopsis

    #include <libxfce4panel/libxfce4panel.h>

    typedef             XfcePanelTypeModule;
    #define             XFCE_PANEL_DEFINE_PLUGIN            (TypeName,
                                                             type_name,
                                                             ...)
    #define             XFCE_PANEL_DEFINE_PLUGIN_RESIDENT   (TypeName,
                                                             type_name,
                                                             ...)
    #define             XFCE_PANEL_DEFINE_TYPE              (TypeName,
                                                             type_name,
                                                             TYPE_PARENT)
    #define             XFCE_PANEL_DEFINE_PREINIT_FUNC      (preinit_func)

## Description

Macros to register panel plugin types and custom types inside panel plugins.

## Details

### XfcePanelTypeModule

    typedef GTypeModule XfcePanelTypeModule;

Typedef for GTypeModule for possible future expansion.

Since 4.8

### XFCE_PANEL_DEFINE_PLUGIN()

    #define             XFCE_PANEL_DEFINE_PLUGIN(TypeName, type_name, args...)

Define a new (resident) GObject panel plugin, the parent type of the object should be XFCE_TYPE_PANEL_PLUGIN.

`TypeName` : | The name of the new type, in Camel case.
`type_name` : | The name of the new type, in lowercase, with words separated by '_'.
`...` : | Optional list of *_register_type() function from other objects in the plugin created with XFCE_PANEL_DEFINE_TYPE.

Since 4.8

### XFCE_PANEL_DEFINE_PLUGIN_RESIDENT()

    #define             XFCE_PANEL_DEFINE_PLUGIN_RESIDENT(TypeName, type_name, args...)

Same as XFCE_PANEL_DEFINE_PLUGIN, but if you use special libraries or objects, it is possible the plugin will give problems when unloading the library, a resident plugin will never be unloaded after the first load, avoiding those issues.

`TypeName` : | The name of the new type, in Camel case.
`type_name` : | The name of the new type, in lowercase, with words separated by '_'.
`...` : | Optional list of *_register_type() function from other objects in the plugin created with XFCE_PANEL_DEFINE_TYPE.

Since 4.8

### XFCE_PANEL_DEFINE_TYPE()

    #define             XFCE_PANEL_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT)

A convenient macro of G_DEFINE_DYNAMIC_TYPE for panel plugins. Only difference with G_DEFINE_DYNAMIC_TYPE is that the type name send to `g_type_module_register_type()` is prefixed with "Xfce". This allows you use use shorted structure names in the code, while the real name of the object is a full "Xfce" name.

The _register_type function should be added to the args in XFCE_PANEL_DEFINE_PLUGIN.

`TypeName` : | The name of the new type, in Camel case.
`type_name` : | The name of the new type, in lowercase, with words separated by '_'.
`TYPE_PARENT` : | The GType of the parent type.

Since 4.8

### XFCE_PANEL_DEFINE_PREINIT_FUNC()

    #define             XFCE_PANEL_DEFINE_PREINIT_FUNC(preinit_func)

Registers a pre-init function in the plugin module. This function is called before `gtk_init()` and can be used to initialize special libaries. Downside of this that the plugin cannot run internal. Even if you set X-XFCE-Interal=TRUE in the desktop file, the panel will force the plugin to run inside a wrapper (this because the panel called `gtk_init()` long before it starts to load the plugins).

Note that you can only use this once and it only works in combination with the plugins register/define functions added in 4.8.

`preinit_func` : | name of the function that points to an XfcePanelPluginPreInit function.

Since 4.8