summaryrefslogtreecommitdiff
path: root/libsecret/secret-collection.h
blob: f16e62a3947ae976e3292d26df942b5f80f4e1b1 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/* libsecret - GLib wrapper for Secret Service
 *
 * Copyright 2012 Red Hat Inc.
 *
 * 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 licence or (at
 * your option) any later version.
 *
 * See the included COPYING file for more information.
 *
 * Author: Stef Walter <stefw@gnome.org>
 */

#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
#error "Only <libsecret/secret.h> can be included directly."
#endif

#ifndef __SECRET_COLLECTION_H__
#define __SECRET_COLLECTION_H__

#include <gio/gio.h>

#include "secret-schema.h"
#include "secret-service.h"
#include "secret-types.h"

G_BEGIN_DECLS

typedef enum { /*< prefix=SECRET_COLLECTION >*/
	SECRET_COLLECTION_NONE = 0 << 0,
	SECRET_COLLECTION_LOAD_ITEMS = 1 << 1,
} SecretCollectionFlags;

typedef enum { /*< prefix=SECRET_COLLECTION_CREATE >*/
	SECRET_COLLECTION_CREATE_NONE = 0 << 0,
} SecretCollectionCreateFlags;

#define SECRET_TYPE_COLLECTION            (secret_collection_get_type ())
#define SECRET_COLLECTION(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_COLLECTION, SecretCollection))
#define SECRET_COLLECTION_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_COLLECTION, SecretCollectionClass))
#define SECRET_IS_COLLECTION(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_COLLECTION))
#define SECRET_IS_COLLECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_COLLECTION))
#define SECRET_COLLECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_COLLECTION, SecretCollectionClass))

typedef struct _SecretItem              SecretItem;
typedef struct _SecretCollectionClass   SecretCollectionClass;
typedef struct _SecretCollectionPrivate SecretCollectionPrivate;

struct _SecretCollection {
	GDBusProxy parent;

	/*< private >*/
	SecretCollectionPrivate *pv;
};

struct _SecretCollectionClass {
	GDBusProxyClass parent_class;

	/*< private >*/
	gpointer padding[8];
};

GType               secret_collection_get_type                 (void) G_GNUC_CONST;

void                secret_collection_for_alias                (SecretService *service,
                                                                const gchar *alias,
                                                                SecretCollectionFlags flags,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

SecretCollection *  secret_collection_for_alias_finish         (GAsyncResult *result,
                                                                GError **error);

SecretCollection *  secret_collection_for_alias_sync           (SecretService *service,
                                                                const gchar *alias,
                                                                SecretCollectionFlags flags,
                                                                GCancellable *cancellable,
                                                                GError **error);

void                secret_collection_load_items               (SecretCollection *self,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

gboolean            secret_collection_load_items_finish        (SecretCollection *self,
                                                                GAsyncResult *result,
                                                                GError **error);

gboolean            secret_collection_load_items_sync          (SecretCollection *self,
                                                                GCancellable *cancellable,
                                                                GError **error);

void                secret_collection_refresh                  (SecretCollection *self);

void                secret_collection_create                   (SecretService *service,
                                                                const gchar *label,
                                                                const gchar *alias,
                                                                SecretCollectionCreateFlags flags,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

SecretCollection *  secret_collection_create_finish            (GAsyncResult *result,
                                                                GError **error);

SecretCollection *  secret_collection_create_sync              (SecretService *service,
                                                                const gchar *label,
                                                                const gchar *alias,
                                                                SecretCollectionCreateFlags flags,
                                                                GCancellable *cancellable,
                                                                GError **error);

void                secret_collection_search                   (SecretCollection *self,
                                                                const SecretSchema *schema,
                                                                GHashTable *attributes,
                                                                SecretSearchFlags flags,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

GList *             secret_collection_search_finish            (SecretCollection *self,
                                                                GAsyncResult *result,
                                                                GError **error);

GList *             secret_collection_search_sync              (SecretCollection *self,
                                                                const SecretSchema *schema,
                                                                GHashTable *attributes,
                                                                SecretSearchFlags flags,
                                                                GCancellable *cancellable,
                                                                GError **error);

void                secret_collection_delete                   (SecretCollection *self,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

gboolean            secret_collection_delete_finish            (SecretCollection *self,
                                                                GAsyncResult *result,
                                                                GError **error);

gboolean            secret_collection_delete_sync              (SecretCollection *self,
                                                                GCancellable *cancellable,
                                                                GError **error);

SecretService *     secret_collection_get_service              (SecretCollection *self);

SecretCollectionFlags secret_collection_get_flags              (SecretCollection *self);

GList *             secret_collection_get_items                (SecretCollection *self);

gchar *             secret_collection_get_label                (SecretCollection *self);

void                secret_collection_set_label                (SecretCollection *self,
                                                                const gchar *label,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

gboolean            secret_collection_set_label_finish         (SecretCollection *self,
                                                                GAsyncResult *result,
                                                                GError **error);

gboolean            secret_collection_set_label_sync           (SecretCollection *self,
                                                                const gchar *label,
                                                                GCancellable *cancellable,
                                                                GError **error);

gboolean            secret_collection_get_locked               (SecretCollection *self);

guint64             secret_collection_get_created              (SecretCollection *self);

guint64             secret_collection_get_modified             (SecretCollection *self);

G_DEFINE_AUTOPTR_CLEANUP_FUNC (SecretCollection, g_object_unref)

G_END_DECLS

#endif /* __SECRET_COLLECTION_H___ */