Geany  1.23.1
Functions
pluginutils.h File Reference

Plugin utility functions. More...

Functions

void plugin_add_toolbar_item (struct GeanyPlugin *plugin, GtkToolItem *item)
 Inserts a toolbar item before the Quit button, or after the previous plugin toolbar item. More...
 
guint plugin_idle_add (struct GeanyPlugin *plugin, GSourceFunc function, gpointer data)
 Adds a GLib main loop IDLE callback that will be removed when unloading the plugin, preventing it to run after the plugin has been unloaded (which may lead to a segfault). More...
 
void plugin_module_make_resident (struct GeanyPlugin *plugin)
 Ensures that a plugin's module (*.so) will never be unloaded. More...
 
struct GeanyKeyGroupplugin_set_key_group (struct GeanyPlugin *plugin, const gchar *section_name, gsize count, GeanyKeyGroupCallback callback)
 Sets up or resizes a keybinding group for the plugin. More...
 
void plugin_show_configure (struct GeanyPlugin *plugin)
 Shows the plugin's configure dialog. More...
 
void plugin_signal_connect (struct GeanyPlugin *plugin, GObject *object, const gchar *signal_name, gboolean after, GCallback callback, gpointer user_data)
 Connects a signal which will be disconnected on unloading the plugin, to prevent a possible segfault. More...
 
guint plugin_timeout_add (struct GeanyPlugin *plugin, guint interval, GSourceFunc function, gpointer data)
 Adds a GLib main loop timeout callback that will be removed when unloading the plugin, preventing it to run after the plugin has been unloaded (which may lead to a segfault). More...
 
guint plugin_timeout_add_seconds (struct GeanyPlugin *plugin, guint interval, GSourceFunc function, gpointer data)
 Adds a GLib main loop timeout callback that will be removed when unloading the plugin, preventing it to run after the plugin has been unloaded (which may lead to a segfault). More...
 

Detailed Description

Plugin utility functions.

These functions all take the geany_plugin symbol as their first argument.

Function Documentation

void plugin_add_toolbar_item ( GeanyPlugin plugin,
GtkToolItem *  item 
)

Inserts a toolbar item before the Quit button, or after the previous plugin toolbar item.

A separator is added on the first call to this function, and will be shown when item is shown; hidden when item is hidden.

Note
You should still destroy item yourself, usually in plugin_cleanup().
Parameters
pluginMust be geany_plugin.
itemThe item to add.
guint plugin_idle_add ( GeanyPlugin plugin,
GSourceFunc  function,
gpointer  data 
)

Adds a GLib main loop IDLE callback that will be removed when unloading the plugin, preventing it to run after the plugin has been unloaded (which may lead to a segfault).

Parameters
pluginMust be geany_plugin.
functionThe function to call in IDLE time.
dataThe user data passed to the function.
Returns
the ID of the event source (you generally won't need it, or better use g_idle_add() directly if you want to manage this event source manually).
See Also
g_idle_add()
Since
0.21, plugin API 205.
void plugin_module_make_resident ( GeanyPlugin plugin)

Ensures that a plugin's module (*.so) will never be unloaded.

This is necessary if you register new GTypes in your plugin, e.g. when using own classes using the GObject system.

Parameters
pluginMust be geany_plugin.
Since
0.16
struct GeanyKeyGroup* plugin_set_key_group ( GeanyPlugin plugin,
const gchar *  section_name,
gsize  count,
GeanyKeyGroupCallback  callback 
)

Sets up or resizes a keybinding group for the plugin.

You should then call keybindings_set_item() for each keybinding in the group.

Parameters
pluginMust be geany_plugin.
section_nameName used in the configuration file, such as "html_chars".
countNumber of keybindings for the group.
callbackGroup callback, or NULL if you only want individual keybinding callbacks.
Returns
The plugin's keybinding group.
Since
0.19.
void plugin_show_configure ( GeanyPlugin plugin)

Shows the plugin's configure dialog.

The plugin must implement one of the plugin_configure() or plugin_configure_single() symbols.

Parameters
pluginMust be geany_plugin.
Since
0.19.
void plugin_signal_connect ( GeanyPlugin plugin,
GObject *  object,
const gchar *  signal_name,
gboolean  after,
GCallback  callback,
gpointer  user_data 
)

Connects a signal which will be disconnected on unloading the plugin, to prevent a possible segfault.

Parameters
pluginMust be geany_plugin.
objectObject to connect to, or NULL when using Geany signals .
signal_nameThe name of the signal. For a list of available signals, please see the Signal documentation .
afterSet to TRUE to call your handler after the main signal handlers have been called (if supported by signal_name).
callbackThe function to call when the signal is emitted.
user_dataThe user data passed to the signal handler.
See Also
plugin_callbacks.
guint plugin_timeout_add ( GeanyPlugin plugin,
guint  interval,
GSourceFunc  function,
gpointer  data 
)

Adds a GLib main loop timeout callback that will be removed when unloading the plugin, preventing it to run after the plugin has been unloaded (which may lead to a segfault).

Parameters
pluginMust be geany_plugin.
intervalThe time between calls to the function, in milliseconds.
functionThe function to call after the given timeout.
dataThe user data passed to the function.
Returns
the ID of the event source (you generally won't need it, or better use g_timeout_add() directly if you want to manage this event source manually).
See Also
g_timeout_add()
Since
0.21, plugin API 205.
guint plugin_timeout_add_seconds ( GeanyPlugin plugin,
guint  interval,
GSourceFunc  function,
gpointer  data 
)

Adds a GLib main loop timeout callback that will be removed when unloading the plugin, preventing it to run after the plugin has been unloaded (which may lead to a segfault).

Parameters
pluginMust be geany_plugin.
intervalThe time between calls to the function, in seconds.
functionThe function to call after the given timeout.
dataThe user data passed to the function.
Returns
the ID of the event source (you generally won't need it, or better use g_timeout_add_seconds() directly if you want to manage this event source manually).
See Also
g_timeout_add_seconds()
Since
0.21, plugin API 205.