summaryrefslogtreecommitdiff
path: root/gcr/gcr-importer.c
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-10-04 12:55:21 +0200
committerStef Walter <stefw@collabora.co.uk>2011-10-04 12:55:21 +0200
commitf4ac10720e2998583c60a084ecd6ac8a34300a40 (patch)
tree8384525f4bf74efce2d579f55fe908645fed84ec /gcr/gcr-importer.c
parent393ad5f15b2f7f6bfa000c0871161c81742806e7 (diff)
downloadgcr-f4ac10720e2998583c60a084ecd6ac8a34300a40.tar.gz
gcr: Complete the PKCS#11 import dialog
* Add GcrImportInteraction interface which importers * Hookup between non-GUI importers and import interaction isn't yet completely thought out.
Diffstat (limited to 'gcr/gcr-importer.c')
-rw-r--r--gcr/gcr-importer.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/gcr/gcr-importer.c b/gcr/gcr-importer.c
index d67a96f..cb57285 100644
--- a/gcr/gcr-importer.c
+++ b/gcr/gcr-importer.c
@@ -23,7 +23,7 @@
#include "config.h"
-#include "gcr-base.h"
+#include "gcr-deprecated-base.h"
#include "gcr-importer.h"
#include "gcr-internal.h"
#include "gcr-marshal.h"
@@ -74,7 +74,7 @@
typedef GcrImporterIface GcrImporterInterface;
-G_DEFINE_INTERFACE (GcrImporter, gcr_importer, 0);
+G_DEFINE_INTERFACE (GcrImporter, gcr_importer, G_TYPE_OBJECT);
typedef struct _GcrRegistered {
GckAttributes *attrs;
@@ -109,6 +109,16 @@ gcr_importer_default_init (GcrImporterIface *iface)
g_param_spec_object ("icon", "Icon", "The icon for the importer",
G_TYPE_ICON, G_PARAM_READABLE));
+ /**
+ * GcrImporter:interaction:
+ *
+ * The interaction for the importer.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_object ("interaction", "Interaction",
+ "Interaction for prompts",
+ G_TYPE_TLS_INTERACTION, G_PARAM_READWRITE));
+
g_once_init_leave (&initialized, 1);
}
}
@@ -466,6 +476,46 @@ gcr_importer_import_finish (GcrImporter *importer,
}
/**
+ * gcr_importer_get_interaction:
+ * @importer: the importer
+ *
+ * Get the interaction used to prompt the user when needed by this
+ * importer.
+ *
+ * Returns: (transfer none) (allow-none): the interaction or %NULL
+ */
+GTlsInteraction *
+gcr_importer_get_interaction (GcrImporter *importer)
+{
+ GTlsInteraction *interaction = NULL;
+
+ g_return_val_if_fail (GCR_IS_IMPORTER (importer), NULL);
+
+ g_object_get (importer, "interaction", &interaction, NULL);
+
+ if (interaction != NULL)
+ g_object_unref (interaction);
+
+ return interaction;
+}
+
+/**
+ * gcr_importer_set_interaction:
+ * @importer: the importer
+ * @interaction: the interaction used by the importer
+ *
+ * Set the interaction used to prompt the user when needed by this
+ * importer.
+ */
+void
+gcr_importer_set_interaction (GcrImporter *importer,
+ GTlsInteraction *interaction)
+{
+ g_return_if_fail (GCR_IS_IMPORTER (importer));
+ g_object_set (importer, "interaction", interaction, NULL);
+}
+
+/**
* gcr_importer_register_well_known:
*
* Register built-in PKCS\#11 and GnuPG importers.