RPlugin

RPlugin —

Synopsis




#define     R_PLUGIN_TYPE
            RPluginPrivate;
void        (*RPluginInit)                  (RPlugin *plugin);
            RPluginAction;
            RPlugin;
RPlugin*    r_plugin_new                    (void);
void        r_plugin_free                   (RPlugin *plugin);
gboolean    r_plugin_load                   (RPlugin *plugin,
                                             const gchar *file);
void        r_plugin_set_obj                (RPlugin *plugin,
                                             gpointer obj);
gpointer    r_plugin_get_obj                (RPlugin *plugin);
void        r_plugin_add_action             (RPlugin *plugin,
                                             RPluginAction *action);
void        r_plugin_add_filter             (RPlugin *plugin,
                                             RFilter *filter);
gpointer    r_plugin_get_handle             (RPlugin *plugin,
                                             gchar *name);
GList*      r_plugin_get_filters            (RPlugin *plugin);
gchar*      r_plugin_get_name               (RPlugin *plugin);
gchar*      r_plugin_get_info               (RPlugin *plugin);
gchar*      r_plugin_get_file_name          (RPlugin *plugin);
gboolean    r_plugin_is_configurable        (RPlugin *plugin);
void        r_plugin_run_configure_gui      (RPlugin *plugin);

Description

Details

R_PLUGIN_TYPE

#define R_PLUGIN_TYPE            (r_plugin_get_type())


RPluginPrivate

typedef struct _RPluginPrivate RPluginPrivate;


RPluginInit ()

void        (*RPluginInit)                  (RPlugin *plugin);

plugin :

RPluginAction

typedef struct {
  gchar* name; 
  gchar* handle;  
} RPluginAction;

RPluginAction is used to manage the action that a plugin can make

examples (from rubrica's plugin): action->name = g_strdup("read"); action->handle = (gpointer) r_rubrica_open_file;

gchar *name; gchar*, the action's name
gchar *handle; gchar*, handle to a function.

RPlugin

typedef struct {
  GObject parent;

  RPluginPrivate* private; 
} RPlugin;


r_plugin_new ()

RPlugin*    r_plugin_new                    (void);

create a new RPlugin

Returns : a new RPlugin

r_plugin_free ()

void        r_plugin_free                   (RPlugin *plugin);

free the object

plugin : a RPlugin

r_plugin_load ()

gboolean    r_plugin_load                   (RPlugin *plugin,
                                             const gchar *file);

load the plugin from the given file

plugin : a RPlugin
file : a gchar*
Returns : TRUE if plugin is successfully loaded, FALSE otherwise

r_plugin_set_obj ()

void        r_plugin_set_obj                (RPlugin *plugin,
                                             gpointer obj);

use this function to set the real plugin. This function is called by the plugin (see rubrica, csv, vcard plugins source) during initialization. The obj is returned by a g_object_new call and is the object that makes work.

plugin : a RPlugin
obj : a gpointer

r_plugin_get_obj ()

gpointer    r_plugin_get_obj                (RPlugin *plugin);

Get the real plugin (a gobject)

plugin : a RPlugin
Returns : a gpointer

r_plugin_add_action ()

void        r_plugin_add_action             (RPlugin *plugin,
                                             RPluginAction *action);

add a RPluginAction to the plugin.

plugin : a RPlugin
action : a RPluginAction

r_plugin_add_filter ()

void        r_plugin_add_filter             (RPlugin *plugin,
                                             RFilter *filter);

Add a RFilter to the plugin

plugin : a RPlugin
filter : a RFilter

r_plugin_get_handle ()

gpointer    r_plugin_get_handle             (RPlugin *plugin,
                                             gchar *name);

Get the handle with the given name

plugin : a RPlugin
name :
Returns : a pointer to the requested function or NULL if function was not found

r_plugin_get_filters ()

GList*      r_plugin_get_filters            (RPlugin *plugin);

Get the plugin's file filters

plugin : a RPlugin
Returns : a GList of RFilter

r_plugin_get_name ()

gchar*      r_plugin_get_name               (RPlugin *plugin);

Get the plugin's name

plugin : a RPlugin
Returns : a gchar*

r_plugin_get_info ()

gchar*      r_plugin_get_info               (RPlugin *plugin);

Get info about the plugin

plugin : a RPlugin
Returns : a gchar*

r_plugin_get_file_name ()

gchar*      r_plugin_get_file_name          (RPlugin *plugin);

Get the plugin's file name

plugin : a RPlugin
Returns : a gchar*

r_plugin_is_configurable ()

gboolean    r_plugin_is_configurable        (RPlugin *plugin);

Check if the plugin is configurable

plugin : a RPlugin
Returns : TRUE if plugin is configurable, FALSE otherwise

r_plugin_run_configure_gui ()

void        r_plugin_run_configure_gui      (RPlugin *plugin);

if plugin is configurable, user can run the configuration gui that the plugin installs

plugin : a RPlugin