## EImport EImport |

## Synopsis

    struct              EImport;
    enum                e_import_target_t;
    struct              EImportImporter;
                        EImportFactory;
    struct              EImportTarget;
    void                (*EImportCompleteFunc)              (EImport *ei,
                                                             gpointer data);
    void                (*EImportStatusFunc)                (EImport *ei,
                                                             const gchar *what,
                                                             gint pc,
                                                             gpointer data);
    void                (*EImportFactoryFunc)               (EImport *ei,
                                                             gpointer data);
    void                (*EImportImporterFunc)              (EImportImporter *importer,
                                                             gpointer data);
    gboolean            (*EImportSupportedFunc)             (EImport *ei,
                                                             EImportTarget *Param2,
                                                             EImportImporter *im);
    GtkWidget *         (*EImportWidgetFunc)                (EImport *ei,
                                                             EImportTarget *Param2,
                                                             EImportImporter *im);
    void                (*EImportImportFunc)                (EImport *ei,
                                                             EImportTarget *Param2,
                                                             EImportImporter *im);
    struct              EImportTargetURI;
    struct              EImportTargetHome;
    EImport *           e_import_new                        (const gchar *id);
    void                e_import_class_add_importer         (EImportClass *klass,
                                                             EImportImporter *importer,
                                                             EImportImporterFunc freefunc,
                                                             gpointer data);
    GSList *            e_import_get_importers              (EImport *import,
                                                             EImportTarget *target);
    EImport *           e_import_construct                  (EImport *import,
                                                             const gchar *id);
    void                e_import_import                     (EImport *import,
                                                             EImportTarget *target,
                                                             EImportImporter *importer,
                                                             EImportStatusFunc status,
                                                             EImportCompleteFunc done,
                                                             gpointer data);
    void                e_import_cancel                     (EImport *import,
                                                             EImportTarget *target,
                                                             EImportImporter *importer);
    GtkWidget *         e_import_get_widget                 (EImport *import,
                                                             EImportTarget *target,
                                                             EImportImporter *importer);
    GtkWidget *         e_import_get_preview_widget         (EImport *import,
                                                             EImportTarget *target,
                                                             EImportImporter *im);
    void                e_import_status                     (EImport *import,
                                                             EImportTarget *target,
                                                             const gchar *what,
                                                             gint pc);
    void                e_import_complete                   (EImport *import,
                                                             EImportTarget *target);
    gpointer            e_import_target_new                 (EImport *import,
                                                             gint type,
                                                             gsize size);
    void                e_import_target_free                (EImport *import,
                                                             gpointer target);
    EImportTargetURI *  e_import_target_new_uri             (EImport *import,
                                                             const gchar *uri_src,
                                                             const gchar *uri_dst);
    EImportTargetHome * e_import_target_new_home            (EImport *import);
    struct              EImportHook;
    typedef             EImportHookTargetMap;
    typedef             EImportHookTargetMask;
    struct              EImportHookImporter;
    void                e_import_hook_class_add_target_map  (EImportHookClass *klass,
                                                             const EImportHookTargetMap *map);

## Object Hierarchy

      GObject
       +----EImport

      GObject
       +----EPluginHook
             +----EImportHook

## Description

## Details

### struct EImport

    struct EImport;

### enum e_import_target_t

    enum e_import_target_t {
    	E_IMPORT_TARGET_URI, /* simple file */
    	E_IMPORT_TARGET_HOME, /* a home-directory thing,
    				 * i.e. old applications */
    	E_IMPORT_TARGET_LAST = 256
    };

`E_IMPORT_TARGET_URI` |
`E_IMPORT_TARGET_HOME` |
`E_IMPORT_TARGET_LAST` |

### struct EImportImporter

    struct EImportImporter {
    	enum _e_import_target_t type;

    	gint pri;

    	EImportSupportedFunc supported;
    	EImportWidgetFunc get_widget;
    	EImportImportFunc import;
    	EImportImportFunc cancel;
    	EImportWidgetFunc get_preview;

    	gpointer user_data;

    	/* ?? */
    	gchar *name;
    	gchar *description;
    };

### EImportFactory

    typedef struct _EImportFactory EImportFactory;

### struct EImportTarget

    struct EImportTarget {
    	EImport *import;

    	guint32 type;

    	GData *data;

    	/* implementation fields follow, depends on target type */
    };

### EImportCompleteFunc ()

    void                (*EImportCompleteFunc)              (EImport *ei,
                                                             gpointer data);

### EImportStatusFunc ()

    void                (*EImportStatusFunc)                (EImport *ei,
                                                             const gchar *what,
                                                             gint pc,
                                                             gpointer data);

### EImportFactoryFunc ()

    void                (*EImportFactoryFunc)               (EImport *ei,
                                                             gpointer data);

### EImportImporterFunc ()

    void                (*EImportImporterFunc)              (EImportImporter *importer,
                                                             gpointer data);

### EImportSupportedFunc ()

    gboolean            (*EImportSupportedFunc)             (EImport *ei,
                                                             EImportTarget *Param2,
                                                             EImportImporter *im);

### EImportWidgetFunc ()

    GtkWidget *         (*EImportWidgetFunc)                (EImport *ei,
                                                             EImportTarget *Param2,
                                                             EImportImporter *im);

### EImportImportFunc ()

    void                (*EImportImportFunc)                (EImport *ei,
                                                             EImportTarget *Param2,
                                                             EImportImporter *im);

### struct EImportTargetURI

    struct EImportTargetURI {
    	EImportTarget target;

    	gchar *uri_src;
    	gchar *uri_dest;
    };

### struct EImportTargetHome

    struct EImportTargetHome {
    	EImportTarget target;
    };

### e_import_new ()

    EImport *           e_import_new                        (const gchar *id);

### e_import_class_add_importer ()

    void                e_import_class_add_importer         (EImportClass *klass,
                                                             EImportImporter *importer,
                                                             EImportImporterFunc freefunc,
                                                             gpointer data);

`klass` : | An initialised implementing instance of EImport.
`importer` : | Importer to add.
`freefunc` : | If supplied, called to free the importer node when it is no longer needed.
`data` : | Data for the callback.

### e_import_get_importers ()

    GSList *            e_import_get_importers              (EImport *import,
                                                             EImportTarget *target);

Get a list of importers. If `target` is supplied, then only importers which support the type and location specified by the target are listed. If `target` is NULL, then all importers are listed.

`import` : | an EImport
`target` : | an EImportTarget
Returns : | A list of importers. The list should be freed when no longer needed.

### e_import_construct ()

    EImport *           e_import_construct                  (EImport *import,
                                                             const gchar *id);

Used by implementing classes to initialise base parameters.

`import` : | The instance to initialise.
`id` : | The name of the instance.
Returns : | `ep` is returned.

### e_import_import ()

    void                e_import_import                     (EImport *import,
                                                             EImportTarget *target,
                                                             EImportImporter *importer,
                                                             EImportStatusFunc status,
                                                             EImportCompleteFunc done,
                                                             gpointer data);

Run the import function of the selected importer. Once the importer has finished, it MUST call the `e_import_complete()` function. This allows importers to run in synchronous or asynchronous mode.

When complete, the `done` callback will be called.

`import` : | an EImport
`target` : | Target to import.
`importer` : | Importer to use.
`status` : | Status callback, called with progress information.
`done` : | Complete callback, will always be called once complete.
`data` : | user data for callback functions

### e_import_cancel ()

    void                e_import_cancel                     (EImport *import,
                                                             EImportTarget *target,
                                                             EImportImporter *importer);

### e_import_get_widget ()

    GtkWidget *         e_import_get_widget                 (EImport *import,
                                                             EImportTarget *target,
                                                             EImportImporter *importer);

Gets a widget that the importer uses to configure its destination. This widget should be packed into a container widget. It should not be shown_all.

`import` : | an EImport
`target` : | Target of interest
`importer` : | Importer to get widget of
Returns : | NULL if the importer doesn't support/require a destination.

### e_import_get_preview_widget ()

    GtkWidget *         e_import_get_preview_widget         (EImport *import,
                                                             EImportTarget *target,
                                                             EImportImporter *im);

Gets a widget that the importer uses to preview data to be imported. This widget should be packed into a container widget. It should not be shown_all.

`import` : | an EImport
`target` : | Target of interest
`im` : | Importer to get a preview widget of
Returns : | NULL if the importer doesn't support preview.

### e_import_status ()

    void                e_import_status                     (EImport *import,
                                                             EImportTarget *target,
                                                             const gchar *what,
                                                             gint pc);

### e_import_complete ()

    void                e_import_complete                   (EImport *import,
                                                             EImportTarget *target);

Signify that an import is complete. This must be called by importer implementations when they are done.

`import` : | an EImport
`target` : | Target just completed (unused currently)

### e_import_target_new ()

    gpointer            e_import_target_new                 (EImport *import,
                                                             gint type,
                                                             gsize size);

Allocate a new import target suitable for this class. Implementing classes will define the actual content of the target.

`import` : | an EImport
`type` : | type, up to implementor
`size` : | Size of object to allocate.

### e_import_target_free ()

    void                e_import_target_free                (EImport *import,
                                                             gpointer target);

Free a target. The implementing class can override this method to free custom targets.

`import` : | an EImport
`target` : | the target to free

### e_import_target_new_uri ()

    EImportTargetURI *  e_import_target_new_uri             (EImport *import,
                                                             const gchar *uri_src,
                                                             const gchar *uri_dst);

### e_import_target_new_home ()

    EImportTargetHome * e_import_target_new_home            (EImport *import);

### struct EImportHook

    struct EImportHook;

### EImportHookTargetMap

    typedef struct _EPluginHookTargetMap EImportHookTargetMap;

### EImportHookTargetMask

    typedef struct _EPluginHookTargetKey EImportHookTargetMask;

### struct EImportHookImporter

    struct EImportHookImporter {
    	EImportImporter importer;

    	/* user_data == EImportHook */

    	gchar *supported;
    	gchar *get_widget;
    	gchar *import;
    	gchar *cancel;
    };

### e_import_hook_class_add_target_map ()

    void                e_import_hook_class_add_target_map  (EImportHookClass *klass,
                                                             const EImportHookTargetMap *map);

`class`: The dervied EimportHook class. `map`: A map used to describe a single EImportTarget type for this class.

Add a targe tmap to a concrete derived class of EImport. The target map enumates the target types available for the implenting class.