Gcr.Importer
Description: Reference for Gcr.Importer

### Interface

# GcrImporter

#### Description [src]

    interface Gcr.Importer : GObject.Object

An interface which allows importing of certificates and keys. Each importer is registered with a set of PKCS#11 attributes to match stuff that it can import.

An importer gets passed a `GcrParser` and accesses the currently parsed item. To create a set of importers that can import the currently parsed item in a parser, use `gcr_importer_create_for_parsed()`. The list of importers returned has the parsed item queued for import.

To queue additional items with a importer use `gcr_importer_queue_for_parsed()`. In addition you can try and queue an additional item with a set of importers using the `gcr_importer_queue_and_filter_for_parsed()`.

To start the import, use `gcr_importer_import()` or its async variants.

#### Prerequisite

In order to implement Importer, your type must inherit from`GObject`.

#### Functions

###### gcr_importer_create_for_parsed

Create a set of importers which can import this parsed item. The parsed item is represented by the state of the GcrParser at the time of calling this method.

###### gcr_importer_queue_and_filter_for_parsed

Queues an additional item to be imported in all compattible importers in the set. The parsed item is represented by the state of the `GcrParser` at the time of calling this method.

###### gcr_importer_register

Register an importer to handle parsed items that match the given attributes.

###### gcr_importer_register_well_known

Register built-in PKCS#11 and GnuPG importers.

#### Instance methods

###### gcr_importer_get_interaction

Get the interaction used to prompt the user when needed by this importer.

###### gcr_importer_import

Import the queued items in the importer. This call will block until the operation completes.

###### gcr_importer_import_async

Import the queued items in the importer. This function returns immediately and completes asynchronously.

###### gcr_importer_import_finish

Complete an asynchronous operation to import queued items.

###### gcr_importer_queue_for_parsed

Queues an additional item to be imported. The parsed item is represented by the state of the `GcrParser` at the time of calling this method.

###### gcr_importer_set_interaction

Set the interaction used to prompt the user when needed by this importer.

#### Properties

###### Gcr.Importer:icon

The icon for the importer.

###### Gcr.Importer:interaction

The interaction for the importer.

###### Gcr.Importer:label

The label for the importer.

###### Gcr.Importer:uri

The URI of the location imported to.

#### Interface structure

    struct GcrImporterIface {
      GTypeInterface parent;
      GList* (* create_for_parsed) (
        GcrParsed* parsed
      );
      gboolean (* queue_for_parsed) (
        GcrImporter* importer,
        GcrParsed* parsed
      );
      gboolean (* import_sync) (
        GcrImporter* importer,
        GCancellable* cancellable,
        GError** error
      );
      void (* import_async) (
        GcrImporter* importer,
        GCancellable* cancellable,
        GAsyncReadyCallback callback,
        gpointer user_data
      );
      gboolean (* import_finish) (
        GcrImporter* importer,
        GAsyncResult* result,
        GError** error
      );

    }

Interface implemented for a `GcrImporter`.

###### Interface members

`parent` |
    GTypeInterface
| Parent interface.
`create_for_parsed` |
    GList* (* create_for_parsed) (
        GcrParsed* parsed
      )
| Implementation of gcr_importer_create_for_parsed(), required.
`queue_for_parsed` |
    gboolean (* queue_for_parsed) (
        GcrImporter* importer,
        GcrParsed* parsed
      )
| Implementation of gcr_importer_queue_for_parsed(), required.
`import_sync` |
    gboolean (* import_sync) (
        GcrImporter* importer,
        GCancellable* cancellable,
        GError** error
      )
| Optional implementation of `gcr_importer_import()`.
`import_async` |
    void (* import_async) (
        GcrImporter* importer,
        GCancellable* cancellable,
        GAsyncReadyCallback callback,
        gpointer user_data
      )
| Implementation of `gcr_importer_import_async()`, required.
`import_finish` |
    gboolean (* import_finish) (
        GcrImporter* importer,
        GAsyncResult* result,
        GError** error
      )
| Implementation of `gcr_importer_import_finish()`.

#### Virtual methods

###### Gcr.Importer.import_async

Import the queued items in the importer. This function returns immediately and completes asynchronously.

###### Gcr.Importer.import_finish

Complete an asynchronous operation to import queued items.

###### Gcr.Importer.import_sync

Optional implementation of `gcr_importer_import()`.

###### Gcr.Importer.queue_for_parsed

Queues an additional item to be imported. The parsed item is represented by the state of the `GcrParser` at the time of calling this method.