![]() |
![]() |
![]() |
Gcr Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Prerequisites | Properties |
GcrImporter; struct GcrImporterIface; GTlsInteraction * gcr_importer_get_interaction (GcrImporter *importer
); void gcr_importer_set_interaction (GcrImporter *importer
,GTlsInteraction *interaction
); gboolean gcr_importer_import (GcrImporter *importer
,GCancellable *cancellable
,GError **error
); void gcr_importer_import_async (GcrImporter *importer
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean gcr_importer_import_finish (GcrImporter *importer
,GAsyncResult *result
,GError **error
); void gcr_importer_register (GType importer_type
,GckAttributes *attrs
); void gcr_importer_register_well_known (void
); GList * gcr_importer_create_for_parsed (GcrParsed *parsed
); gboolean gcr_importer_queue_for_parsed (GcrImporter *importer
,GcrParsed *parsed
); GList * gcr_importer_queue_and_filter_for_parsed (GList *importers
,GcrParsed *parsed
); void gcr_import_interaction_supplement_prep (GcrImportInteraction *interaction
,GckBuilder *builder
); GTlsInteractionResult gcr_import_interaction_supplement (GcrImportInteraction *interaction
,GckBuilder *builder
,GCancellable *cancellable
,GError **error
); void gcr_import_interaction_supplement_async (GcrImportInteraction *interaction
,GckBuilder *builder
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); GTlsInteractionResult gcr_import_interaction_supplement_finish (GcrImportInteraction *interaction
,GAsyncResult *result
,GError **error
);
"icon" GIcon* : Read "interaction" GTlsInteraction* : Read / Write "label" gchar* : Read "uri" gchar* : Read
An interface which allows importing of certificates and keys. Each GcrImporter 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 GcrParser, 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 the async variants.
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.
parent interface | |
implementation of gcr_importer_create_for_parsed() , required |
|
implementation of gcr_importer_queue_for_parsed() , required |
|
optional implemantionon of gcr_importer_import()
|
|
implementation of gcr_importer_import_async() , required |
|
implementation of gcr_importer_import_finish()
|
GTlsInteraction * gcr_importer_get_interaction (GcrImporter *importer
);
Get the interaction used to prompt the user when needed by this importer.
|
the importer |
Returns : |
the interaction or NULL . [transfer none][allow-none]
|
void gcr_importer_set_interaction (GcrImporter *importer
,GTlsInteraction *interaction
);
Set the interaction used to prompt the user when needed by this importer.
|
the importer |
|
the interaction used by the importer |
gboolean gcr_importer_import (GcrImporter *importer
,GCancellable *cancellable
,GError **error
);
Import the queued items in the importer. This call will block until the operation completes.
void gcr_importer_import_async (GcrImporter *importer
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Import the queued items in the importer. This function returns immediately and completes asynchronously.
|
the importer |
|
a GCancellable, or NULL
|
|
called when the operation completes |
|
data to be passed to the callback |
gboolean gcr_importer_import_finish (GcrImporter *importer
,GAsyncResult *result
,GError **error
);
Complete an asynchronous operation to import queued items.
|
the importer |
|
an asynchronous result |
|
the location to place an error on failure, or NULL
|
Returns : |
whether the import succeeded or failed |
void gcr_importer_register (GType importer_type
,GckAttributes *attrs
);
Register an importer to handle parsed items that match the given attributes.
|
the GType of the importer being registered |
|
the attributes that this importer is compatible with |
void gcr_importer_register_well_known (void
);
Register built-in PKCS#11 and GnuPG importers.
GList * gcr_importer_create_for_parsed (GcrParsed *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.
|
a parser with a parsed item to import |
Returns : |
a list of importers
which can import the parsed item, which should be freed with
g_object_unref() , or NULL if no types of importers can be created. [element-type Gcr.Importer][transfer full]
|
gboolean gcr_importer_queue_for_parsed (GcrImporter *importer
,GcrParsed *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.
If the parsed item is incompatible with the importer, then this will fail and the item will not be queued.
|
an importer to add additional items to |
|
a parsed item to import |
Returns : |
whether the item was queued or not |
GList * gcr_importer_queue_and_filter_for_parsed (GList *importers
,GcrParsed *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.
If the parsed item is incompatible with an importer, then that the item will not be queued on that importer.
|
a set of importers. [element-type Gcr.Importer] |
|
a parsed item |
Returns : |
a new set of importers
that queued the item, which should be freed with gck_list_unref_free() . [transfer full][element-type Gcr.Importer]
|
void gcr_import_interaction_supplement_prep (GcrImportInteraction *interaction
,GckBuilder *builder
);
Prepare for supplementing the given attributes before import. This means prompting the user for things like labels and the like. The attributes will contain attributes for values that the importer needs, either empty or prefilled with suggested values.
This method does not prompt the user, but rather just prepares the interaction that these are the attributes that are needed.
|
the interaction |
|
attributes to supplement |
GTlsInteractionResult gcr_import_interaction_supplement (GcrImportInteraction *interaction
,GckBuilder *builder
,GCancellable *cancellable
,GError **error
);
Supplement attributes before import. This means prompting the user for
things like labels and the like. The needed attributes will have been passed
to gcr_import_interaction_supplement_prep()
.
This method prompts the user and fills in the attributes. If the user or
cancellable cancels the operation the error should be set with G_IO_ERROR_CANCELLED
.
|
the interaction |
|
supplemented attributes |
|
optional cancellable object |
|
location to store error on failure |
Returns : |
G_TLS_INTERACTION_HANDLED if successful or G_TLS_INTERACTION_FAILED
|
void gcr_import_interaction_supplement_async (GcrImportInteraction *interaction
,GckBuilder *builder
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously supplement attributes before import. This means prompting the
user for things like labels and the like. The needed attributes will have
been passed to gcr_import_interaction_supplement_prep()
.
This method prompts the user and fills in the attributes.
|
the interaction |
|
supplemented attributes |
|
optional cancellable object |
|
called when the operation completes |
|
data to be passed to the callback |
GTlsInteractionResult gcr_import_interaction_supplement_finish (GcrImportInteraction *interaction
,GAsyncResult *result
,GError **error
);
Complete operation to asynchronously supplement attributes before import.
If the user or cancellable cancels the operation the error should be set
with G_IO_ERROR_CANCELLED
.
|
the interaction |
|
the asynchronous result |
|
location to place an error on failure |
Returns : |
G_TLS_INTERACTION_HANDLED if successful or G_TLS_INTERACTION_FAILED
|