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