summaryrefslogtreecommitdiff
path: root/gcr/gcr-importer.h
blob: ed366f337089b0a8c823b087abca8e2061ab7804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 * gnome-keyring
 *
 * Copyright (C) 2008 Stefan Walter
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */

#ifndef __GCR_IMPORTER_H__
#define __GCR_IMPORTER_H__

#include "gcr.h"
#include "gcr-parser.h"

#include <glib-object.h>

typedef enum {
	GCR_IMPORTER_PROMPT_NEEDED,
	GCR_IMPORTER_PROMPT_ALWAYS,
	GCR_IMPORTER_PROMPT_NEVER
} GcrImporterPromptBehavior;

#define GCR_TYPE_IMPORTER               (gcr_importer_get_type ())
#define GCR_IMPORTER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_IMPORTER, GcrImporter))
#define GCR_IMPORTER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCR_TYPE_IMPORTER, GcrImporterClass))
#define GCR_IS_IMPORTER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_IMPORTER))
#define GCR_IS_IMPORTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCR_TYPE_IMPORTER))
#define GCR_IMPORTER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCR_TYPE_IMPORTER, GcrImporterClass))

typedef struct _GcrImporter GcrImporter;
typedef struct _GcrImporterClass GcrImporterClass;
typedef struct _GcrImporterPrivate GcrImporterPrivate;

struct _GcrImporter {
	GObject parent;
	GcrImporterPrivate *pv;
};

struct _GcrImporterClass {
	GObjectClass parent_class;

	/* signals */

	void (*imported) (GcrImporter *self, GP11Object *object);
};

GType                     gcr_importer_get_type               (void);

GcrImporter*              gcr_importer_new                    (void);

GcrParser*                gcr_importer_get_parser             (GcrImporter *self);

void                      gcr_importer_set_parser             (GcrImporter *self,
                                                               GcrParser *parser);

struct _GP11Slot*         gcr_importer_get_slot               (GcrImporter *self);

void                      gcr_importer_set_slot               (GcrImporter *self,
                                                               struct _GP11Slot *slot);

GcrImporterPromptBehavior gcr_importer_get_prompt_behavior    (GcrImporter *self);

void                      gcr_importer_set_prompt_behavior    (GcrImporter *self,
                                                               GcrImporterPromptBehavior behavior);

gboolean                  gcr_importer_import                 (GcrImporter *self,
                                                               GInputStream *input,
                                                               GCancellable *cancel,
                                                               GError **error);

void                      gcr_importer_import_async           (GcrImporter *self,
                                                               GInputStream *input,
                                                               GCancellable *cancel,
                                                               GAsyncReadyCallback callback,
                                                               gpointer user_data);

gboolean                  gcr_importer_import_finish          (GcrImporter *self,
                                                               GAsyncResult *res,
                                                               GError **error);

#endif /* __GCR_IMPORTER_H__ */