Properly refer to the fact that multiple passwords may be removed.
[platform/upstream/libsecret.git] / libsecret / secret-collection.h
1 /* libsecret - GLib wrapper for Secret Service
2  *
3  * Copyright 2012 Red Hat Inc.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published
7  * by the Free Software Foundation; either version 2.1 of the licence or (at
8  * your option) any later version.
9  *
10  * See the included COPYING file for more information.
11  *
12  * Author: Stef Walter <stefw@gnome.org>
13  */
14
15 #if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
16 #error "Only <libsecret/secret.h> can be included directly."
17 #endif
18
19 #ifndef __SECRET_COLLECTION_H__
20 #define __SECRET_COLLECTION_H__
21
22 #include <gio/gio.h>
23
24 #include "secret-schema.h"
25 #include "secret-service.h"
26 #include "secret-types.h"
27
28 G_BEGIN_DECLS
29
30 typedef enum {
31         SECRET_COLLECTION_NONE = 0,
32         SECRET_COLLECTION_LOAD_ITEMS = 1 << 1,
33 } SecretCollectionFlags;
34
35 typedef enum {
36         SECRET_COLLECTION_CREATE_NONE = 0,
37 } SecretCollectionCreateFlags;
38
39 #define SECRET_TYPE_COLLECTION            (secret_collection_get_type ())
40 #define SECRET_COLLECTION(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_COLLECTION, SecretCollection))
41 #define SECRET_COLLECTION_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_COLLECTION, SecretCollectionClass))
42 #define SECRET_IS_COLLECTION(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_COLLECTION))
43 #define SECRET_IS_COLLECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_COLLECTION))
44 #define SECRET_COLLECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_COLLECTION, SecretCollectionClass))
45
46 typedef struct _SecretItem              SecretItem;
47 typedef struct _SecretCollection        SecretCollection;
48 typedef struct _SecretCollectionClass   SecretCollectionClass;
49 typedef struct _SecretCollectionPrivate SecretCollectionPrivate;
50
51 struct _SecretCollection {
52         GDBusProxy parent;
53
54         /*< private >*/
55         SecretCollectionPrivate *pv;
56 };
57
58 struct _SecretCollectionClass {
59         GDBusProxyClass parent_class;
60
61         /*< private >*/
62         gpointer padding[8];
63 };
64
65 GType               secret_collection_get_type                 (void) G_GNUC_CONST;
66
67 void                secret_collection_for_alias                (SecretService *service,
68                                                                 const gchar *alias,
69                                                                 GCancellable *cancellable,
70                                                                 GAsyncReadyCallback callback,
71                                                                 gpointer user_data);
72
73 SecretCollection *  secret_collection_for_alias_finish         (GAsyncResult *result,
74                                                                 GError **error);
75
76 SecretCollection *  secret_collection_for_alias_sync           (SecretService *service,
77                                                                 const gchar *alias,
78                                                                 GCancellable *cancellable,
79                                                                 GError **error);
80
81 void                secret_collection_load_items               (SecretCollection *self,
82                                                                 GCancellable *cancellable,
83                                                                 GAsyncReadyCallback callback,
84                                                                 gpointer user_data);
85
86 gboolean            secret_collection_load_items_finish        (SecretCollection *self,
87                                                                 GAsyncResult *result,
88                                                                 GError **error);
89
90 gboolean            secret_collection_load_items_sync          (SecretCollection *self,
91                                                                 GCancellable *cancellable,
92                                                                 GError **error);
93
94 void                secret_collection_refresh                  (SecretCollection *self);
95
96 void                secret_collection_create                   (SecretService *service,
97                                                                 const gchar *label,
98                                                                 const gchar *alias,
99                                                                 SecretCollectionCreateFlags flags,
100                                                                 GCancellable *cancellable,
101                                                                 GAsyncReadyCallback callback,
102                                                                 gpointer user_data);
103
104 SecretCollection *  secret_collection_create_finish            (GAsyncResult *result,
105                                                                 GError **error);
106
107 SecretCollection *  secret_collection_create_sync              (SecretService *service,
108                                                                 const gchar *label,
109                                                                 const gchar *alias,
110                                                                 SecretCollectionCreateFlags flags,
111                                                                 GCancellable *cancellable,
112                                                                 GError **error);
113
114 void                secret_collection_search                   (SecretCollection *self,
115                                                                 const SecretSchema *schema,
116                                                                 GHashTable *attributes,
117                                                                 SecretSearchFlags flags,
118                                                                 GCancellable *cancellable,
119                                                                 GAsyncReadyCallback callback,
120                                                                 gpointer user_data);
121
122 GList *             secret_collection_search_finish            (SecretCollection *self,
123                                                                 GAsyncResult *result,
124                                                                 GError **error);
125
126 GList *             secret_collection_search_sync              (SecretCollection *self,
127                                                                 const SecretSchema *schema,
128                                                                 GHashTable *attributes,
129                                                                 SecretSearchFlags flags,
130                                                                 GCancellable *cancellable,
131                                                                 GError **error);
132
133 void                secret_collection_delete                   (SecretCollection *self,
134                                                                 GCancellable *cancellable,
135                                                                 GAsyncReadyCallback callback,
136                                                                 gpointer user_data);
137
138 gboolean            secret_collection_delete_finish            (SecretCollection *self,
139                                                                 GAsyncResult *result,
140                                                                 GError **error);
141
142 gboolean            secret_collection_delete_sync              (SecretCollection *self,
143                                                                 GCancellable *cancellable,
144                                                                 GError **error);
145
146 SecretService *     secret_collection_get_service              (SecretCollection *self);
147
148 SecretCollectionFlags secret_collection_get_flags              (SecretCollection *self);
149
150 GList *             secret_collection_get_items                (SecretCollection *self);
151
152 gchar *             secret_collection_get_label                (SecretCollection *self);
153
154 void                secret_collection_set_label                (SecretCollection *self,
155                                                                 const gchar *label,
156                                                                 GCancellable *cancellable,
157                                                                 GAsyncReadyCallback callback,
158                                                                 gpointer user_data);
159
160 gboolean            secret_collection_set_label_finish         (SecretCollection *self,
161                                                                 GAsyncResult *result,
162                                                                 GError **error);
163
164 gboolean            secret_collection_set_label_sync           (SecretCollection *self,
165                                                                 const gchar *label,
166                                                                 GCancellable *cancellable,
167                                                                 GError **error);
168
169 gboolean            secret_collection_get_locked               (SecretCollection *self);
170
171 guint64             secret_collection_get_created              (SecretCollection *self);
172
173 guint64             secret_collection_get_modified             (SecretCollection *self);
174
175 G_END_DECLS
176
177 #endif /* __SECRET_COLLECTION_H___ */