## EModule

EModule — A module loader

## Synopsis

    #include <libebackend/libebackend.h>

    struct              EModule;
    EModule *           e_module_new                        (const gchar *filename);
    const gchar *       e_module_get_filename               (EModule *module);
    GList *             e_module_load_all_in_directory      (const gchar *dirname);
    void                (*ETypeFunc)                        (GType type,
                                                             gpointer user_data);
    void                e_type_traverse                     (GType parent_type,
                                                             ETypeFunc func,
                                                             gpointer user_data);

## Object Hierarchy

      GObject
       +----GTypeModule
             +----EModule

## Implemented Interfaces

EModule implements GTypePlugin.

## Properties

      "filename"                 gchar*                : Read / Write / Construct Only

## Description

## Details

### struct EModule

    struct EModule;

Contains only private data that should be read and manipulated using the functions below.

Since 3.4

### e_module_new ()

    EModule *           e_module_new                        (const gchar *filename);

Creates a new EModule that will load the specific shared library when in use.

`filename` : | filename of the shared library module
Returns : | a new EModule for `filename`

Since 3.4

### e_module_get_filename ()

    const gchar *       e_module_get_filename               (EModule *module);

Returns the filename of the shared library for `module`. The string is owned by `module` and should not be modified or freed.

`module` : | an EModule
Returns : | the filename for `module`

Since 3.4

### e_module_load_all_in_directory ()

    GList *             e_module_load_all_in_directory      (const gchar *dirname);

Loads all the modules in the specified directory into memory. If you want to unload them (enabling on-demand loading) you must call `g_type_module_unuse()` on all the modules. Free the returned list with `g_list_free()`.

`dirname` : | pathname for a directory containing modules to load
Returns : | a list of EModules loaded from `dirname`

Since 3.4

### ETypeFunc ()

    void                (*ETypeFunc)                        (GType type,
                                                             gpointer user_data);

Specifies the type of functions passed to `e_type_traverse()`.

`type` : | a GType
`user_data` : | user data passed to `e_type_traverse()`

Since 3.4

### e_type_traverse ()

    void                e_type_traverse                     (GType parent_type,
                                                             ETypeFunc func,
                                                             gpointer user_data);

Calls `func` for all instantiable subtypes of `parent_type`.

This is often useful for extending functionality by way of EModule. A module may register a subtype of `parent_type` in its `e_module_load()` function. Then later on the application will call `e_type_traverse()` to instantiate all registered subtypes of `parent_type`.

`parent_type` : | the root GType to traverse from
`func` : | the function to call for each visited GType
`user_data` : | user data to pass to the function

Since 3.4

## Property Details

### The `"filename"` property

      "filename"                 gchar*                : Read / Write / Construct Only

The filename of the module.

Default value: NULL