| Gnome Scan Reference Manual | ||||
|---|---|---|---|---|
#define GS_DEFINE_MODULE_TYPE (TN, t_n, T_P) GnomeScanModule; GnomeScanModule* gnome_scan_module_new (gchar *filename);
#define GS_DEFINE_MODULE_TYPE(TN, t_n, T_P)
Convenient macro used to declare a dynamicly registered type.
For example:
GS_DEFINE_MODULE_TYPE (FooBar, foo_bar, G_TYPE_OBJECT)
expands to:
static void foo_bar_init (FooBar *self);
static void foo_bar_class_init (FooBarClass *klass);
static GType foo_bar_type = 0;
GType
foo_bar_get_type ()
{ return foo_bar_type; }
void
foo_bar_register_type (GTypeModule *module)
{
if (!foo_bar_type)
{
static const GTypeInfo type_info =
{
sizeof (FooBarClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) foo_bar_class_init,
NULL,
NULL,
sizeof (FooBar),
0,
(GInstanceInitFunc) foo_bar_init
};
foo_bar_type =
g_type_module_register_type (module, G_TYPE_OBJECT,
g_intern_static_string ("FooBar"), &type_info, 0);
}
}
See: G_DEFINE_TYPE
TN : |
Capitalized type name |
t_n : |
Type function prefix |
T_P : |
Parent GType macro |
typedef struct {
void (* init) (GnomeScanModule *module);
void (* finalize) (GnomeScanModule *module);
} GnomeScanModule;
A GnomeScanModule handle the loading, initialization, finalization
and unloading of a module. If you want to extends Gnome Scan, you
must implement two function, one for init and one for finalize,
called gnome_scan_module_init() and
gnome_scan_module_finalize(). You should prefix function prototypes
with G_MODULE_EXPORT.
GnomeScanModule* gnome_scan_module_new (gchar *filename);
Open and initialize a new module. This function should be used only by GnomeScanModuleManager.
filename : |
The path to shared object |
| Returns : | a new GnomeScanModule |