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
28G_BEGIN_DECLS
29
30typedef enum {
31 SECRET_COLLECTION_NONE = 0 << 0,
32 SECRET_COLLECTION_LOAD_ITEMS = 1 << 1,
33} SecretCollectionFlags;
34
35typedef enum {
36 SECRET_COLLECTION_CREATE_NONE = 0 << 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
46typedef struct _SecretItem SecretItem;
47typedef struct _SecretCollectionClass SecretCollectionClass;
48typedef struct _SecretCollectionPrivate SecretCollectionPrivate;
49
50struct _SecretCollection {
51 GDBusProxy parent;
52
53 /*< private >*/
54 SecretCollectionPrivate *pv;
55};
56
57struct _SecretCollectionClass {
58 GDBusProxyClass parent_class;
59
60 /*< private >*/
61 gpointer padding[8];
62};
63
64GType secret_collection_get_type (void) G_GNUC_CONST;
65
66void secret_collection_for_alias (SecretService *service,
67 const gchar *alias,
68 SecretCollectionFlags flags,
69 GCancellable *cancellable,
70 GAsyncReadyCallback callback,
71 gpointer user_data);
72
73SecretCollection * secret_collection_for_alias_finish (GAsyncResult *result,
74 GError **error);
75
76SecretCollection * secret_collection_for_alias_sync (SecretService *service,
77 const gchar *alias,
78 SecretCollectionFlags flags,
79 GCancellable *cancellable,
80 GError **error);
81
82void secret_collection_load_items (SecretCollection *self,
83 GCancellable *cancellable,
84 GAsyncReadyCallback callback,
85 gpointer user_data);
86
87gboolean secret_collection_load_items_finish (SecretCollection *self,
88 GAsyncResult *result,
89 GError **error);
90
91gboolean secret_collection_load_items_sync (SecretCollection *self,
92 GCancellable *cancellable,
93 GError **error);
94
95void secret_collection_refresh (SecretCollection *self);
96
97void secret_collection_create (SecretService *service,
98 const gchar *label,
99 const gchar *alias,
100 SecretCollectionCreateFlags flags,
101 GCancellable *cancellable,
102 GAsyncReadyCallback callback,
103 gpointer user_data);
104
105SecretCollection * secret_collection_create_finish (GAsyncResult *result,
106 GError **error);
107
108SecretCollection * secret_collection_create_sync (SecretService *service,
109 const gchar *label,
110 const gchar *alias,
111 SecretCollectionCreateFlags flags,
112 GCancellable *cancellable,
113 GError **error);
114
115void secret_collection_search (SecretCollection *self,
116 const SecretSchema *schema,
117 GHashTable *attributes,
118 SecretSearchFlags flags,
119 GCancellable *cancellable,
120 GAsyncReadyCallback callback,
121 gpointer user_data);
122
123GList * secret_collection_search_finish (SecretCollection *self,
124 GAsyncResult *result,
125 GError **error);
126
127GList * secret_collection_search_sync (SecretCollection *self,
128 const SecretSchema *schema,
129 GHashTable *attributes,
130 SecretSearchFlags flags,
131 GCancellable *cancellable,
132 GError **error);
133
134void secret_collection_delete (SecretCollection *self,
135 GCancellable *cancellable,
136 GAsyncReadyCallback callback,
137 gpointer user_data);
138
139gboolean secret_collection_delete_finish (SecretCollection *self,
140 GAsyncResult *result,
141 GError **error);
142
143gboolean secret_collection_delete_sync (SecretCollection *self,
144 GCancellable *cancellable,
145 GError **error);
146
147SecretService * secret_collection_get_service (SecretCollection *self);
148
149SecretCollectionFlags secret_collection_get_flags (SecretCollection *self);
150
151GList * secret_collection_get_items (SecretCollection *self);
152
153gchar * secret_collection_get_label (SecretCollection *self);
154
155void secret_collection_set_label (SecretCollection *self,
156 const gchar *label,
157 GCancellable *cancellable,
158 GAsyncReadyCallback callback,
159 gpointer user_data);
160
161gboolean secret_collection_set_label_finish (SecretCollection *self,
162 GAsyncResult *result,
163 GError **error);
164
165gboolean secret_collection_set_label_sync (SecretCollection *self,
166 const gchar *label,
167 GCancellable *cancellable,
168 GError **error);
169
170gboolean secret_collection_get_locked (SecretCollection *self);
171
172guint64 secret_collection_get_created (SecretCollection *self);
173
174guint64 secret_collection_get_modified (SecretCollection *self);
175
176G_END_DECLS
177
178#endif /* __SECRET_COLLECTION_H___ */
179