plugin.c File Reference

This file contains all the stuff that is dedicated to plugins (loading, instanciating, initializing and so on). More...

#include <libheraia.h>

Include dependency graph for plugin.c:

Go to the source code of this file.

Functions

static heraia_plugin_tget_plugin_handle (heraia_window_t *main_window, heraia_plugin_t *plugin, const gchar *full_filename, const gchar *filename)
 Here we try to get a handle for the Gmodule referenced by full_filename.
static heraia_plugin_tget_plugin_init_symbol (heraia_window_t *main_window, heraia_plugin_t *plugin)
 If the handle is ok, we want to have the heraia_plugin_init function (to call it) in order to init the plugin (by itself).
static void init_plugin (heraia_window_t *main_window, heraia_plugin_t *plugin, const gchar *filename, guint plugins_nb)
 finalising initialisation : if everything went fine, the plugin is added to the plugin list and a menu entry is created in the Plugins menu
static void load_one_plugin (heraia_window_t *main_window, const gchar *filename, guint plugins_nb)
 Here we manage to load one plugin at a time (and this is really enough !).
gboolean plugin_capable (void)
 Says whether the system can handle plugins (or not).
heraia_plugin_tnew_plugin (void)
 Creates a new empty plugin it may be initialised by the plugin itself !
void free_plugin (heraia_plugin_t *plugin)
 free an unused plugin use with caution
void load_plugins (heraia_window_t *main_window)
 looks at the plugins dir(s) and loads the needed plugins (all ;-) (one at a time !!)
void add_entry_to_plugins_menu (heraia_window_t *main_window, heraia_plugin_t *plugin)
 adds a menu entry to the plugin menu adds a signal handler when the menu is toggled
heraia_plugin_tfind_plugin_by_name (GList *plugins_list, gchar *name)
 Finds the desired plugin by its name and return the plugin structure or NULL.
gboolean load_plugin_glade_xml (heraia_window_t *main_window, heraia_plugin_t *plugin)
 Loads the glade xml file that describes the plugin (.glade suffix) tries the paths found in the location_list.
void refresh_all_plugins (heraia_window_t *main_window)
 To help the main program to send events to the plugins.


Detailed Description

This file contains all the stuff that is dedicated to plugins (loading, instanciating, initializing and so on).

Definition in file plugin.c.


Function Documentation

void add_entry_to_plugins_menu ( heraia_window_t main_window,
heraia_plugin_t plugin 
)

adds a menu entry to the plugin menu adds a signal handler when the menu is toggled

Parameters:
main_window : main structure
plugin : a plugin to add to the plugin's menu

Definition at line 275 of file plugin.c.

References heraia_plugin_t::cmi_entry, heraia_get_widget(), heraia_plugin_t::info, xml_t::main, plugin_info_t::name, heraia_plugin_t::run_proc, and heraia_window_t::xmls.

Referenced by init_plugin().

Here is the call graph for this function:

Here is the caller graph for this function:

heraia_plugin_t* find_plugin_by_name ( GList *  plugins_list,
gchar *  name 
)

Finds the desired plugin by its name and return the plugin structure or NULL.

Parameters:
plugins_list : list of all available plugins
name : plugin's name we're looking for
Returns:
Returns a heraia_plugin_t that correspond to the plugin or NULL if no plugin was found with that name

Definition at line 301 of file plugin.c.

References heraia_plugin_t::info, and plugin_info_t::name.

Referenced by init(), pn_treeview_double_click(), pn_treeview_selection_changed_cb(), and run().

Here is the caller graph for this function:

void free_plugin ( heraia_plugin_t plugin  ) 

static heraia_plugin_t * get_plugin_handle ( heraia_window_t main_window,
heraia_plugin_t plugin,
const gchar *  full_filename,
const gchar *  filename 
) [static]

Here we try to get a handle for the Gmodule referenced by full_filename.

Parameters:
main_window : main structure
plugin : the plugin we try to get a handle for
full_filename : the full filename (includes path) to the compiled plugin
filename : the filename (without the path -> used for fancy log reporting)
Returns:
Returns the modified plugin structure eventually with a handle !

Definition at line 126 of file plugin.c.

References heraia_plugin_t::handle, and log_message().

Referenced by load_one_plugin().

Here is the call graph for this function:

Here is the caller graph for this function:

static heraia_plugin_t * get_plugin_init_symbol ( heraia_window_t main_window,
heraia_plugin_t plugin 
) [static]

If the handle is ok, we want to have the heraia_plugin_init function (to call it) in order to init the plugin (by itself).

Parameters:
main_window : main structure
plugin : the plugin to look for its init function

Definition at line 150 of file plugin.c.

References free_plugin(), heraia_plugin_t::handle, heraia_plugin_init(), and log_message().

Referenced by load_one_plugin().

Here is the call graph for this function:

Here is the caller graph for this function:

static void init_plugin ( heraia_window_t main_window,
heraia_plugin_t plugin,
const gchar *  filename,
guint  plugins_nb 
) [static]

finalising initialisation : if everything went fine, the plugin is added to the plugin list and a menu entry is created in the Plugins menu

Parameters:
main_window : main structure
plugin : the plugin that was initialized
filename : filename of the plugin itself
plugins_nb : a number that will become the id of that plugin

Definition at line 188 of file plugin.c.

References add_entry_to_plugins_menu(), HERAIA_PLUGIN_ACTION, plugin_info_t::id, heraia_plugin_t::info, heraia_plugin_t::init_proc, log_message(), heraia_window_t::plugins_list, and plugin_info_t::type.

Referenced by load_one_plugin().

Here is the call graph for this function:

Here is the caller graph for this function:

static void load_one_plugin ( heraia_window_t main_window,
const gchar *  filename,
guint  plugins_nb 
) [static]

Here we manage to load one plugin at a time (and this is really enough !).

Parameters:
main_window : main structure
filename : filename of the plugin that we want to load
plugins_nb : a number that will be the id of that plugin

Definition at line 211 of file plugin.c.

References heraia_plugin_t::filename, get_plugin_handle(), get_plugin_init_symbol(), init_plugin(), new_plugin(), and heraia_plugin_t::path.

Referenced by load_plugins().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean load_plugin_glade_xml ( heraia_window_t main_window,
heraia_plugin_t plugin 
)

Loads the glade xml file that describes the plugin (.glade suffix) tries the paths found in the location_list.

Parameters:
main_window : main structure
plugin : plugin for whom we want to load it's glade XML definition file
Returns:
Returns TRUE if everything went ok, FALSE otherwise

Definition at line 334 of file plugin.c.

References heraia_plugin_t::info, load_glade_xml_file(), heraia_window_t::location_list, plugin_info_t::name, and heraia_plugin_t::xml.

Referenced by init().

Here is the call graph for this function:

Here is the caller graph for this function:

void load_plugins ( heraia_window_t main_window  ) 

looks at the plugins dir(s) and loads the needed plugins (all ;-) (one at a time !!)

Parameters:
main_window : main structure

Definition at line 242 of file plugin.c.

References load_one_plugin(), and log_message().

Referenced by init_heraia_plugin_system().

Here is the call graph for this function:

Here is the caller graph for this function:

heraia_plugin_t* new_plugin ( void   ) 

Creates a new empty plugin it may be initialised by the plugin itself !

Returns:
Returns a newly created heraia_plugin_t plugin structure

Definition at line 54 of file plugin.c.

References PLUGIN_STATE_NEW, and heraia_plugin_t::state.

Referenced by load_one_plugin().

Here is the caller graph for this function:

gboolean plugin_capable ( void   ) 

Says whether the system can handle plugins (or not).

Returns:
Returns TRUE if the system is able to handle plugins, FALSE otherwise

Definition at line 42 of file plugin.c.

Referenced by init_heraia_plugin_system().

Here is the caller graph for this function:

void refresh_all_plugins ( heraia_window_t main_window  ) 

To help the main program to send events to the plugins.

Parameters:
main_window : main structure

Definition at line 356 of file plugin.c.

References heraia_window_t::plugins_list, and heraia_plugin_t::refresh_proc.

Referenced by refresh_event_handler().

Here is the caller graph for this function:


Generated on Tue Jun 30 23:18:24 2009 for Heraia by  doxygen 1.5.8