Adding Peter Thatcher to the owners file.
[chromium-blink-merge.git] / third_party / libsecret / secret-item.h
blobe02c8717377b5a89c2e5f445dc99b77ca209f710
1 /* libsecret - GLib wrapper for Secret Service
3 * Copyright 2012 Red Hat Inc.
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.
10 * See the included COPYING file for more information.
12 * Author: Stef Walter <stefw@gnome.org>
15 #if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
16 #error "Only <libsecret/secret.h> can be included directly."
17 #endif
19 #ifndef __SECRET_ITEM_H__
20 #define __SECRET_ITEM_H__
22 #include <gio/gio.h>
24 #include "secret-collection.h"
25 #include "secret-item.h"
26 #include "secret-service.h"
27 #include "secret-value.h"
29 G_BEGIN_DECLS
31 typedef enum {
32 SECRET_ITEM_NONE,
33 SECRET_ITEM_LOAD_SECRET = 1 << 1
34 } SecretItemFlags;
36 typedef enum {
37 SECRET_ITEM_CREATE_NONE = 0,
38 SECRET_ITEM_CREATE_REPLACE = 1 << 1
39 } SecretItemCreateFlags;
41 #define SECRET_TYPE_ITEM (secret_item_get_type ())
42 #define SECRET_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_ITEM, SecretItem))
43 #define SECRET_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_ITEM, SecretItemClass))
44 #define SECRET_IS_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_ITEM))
45 #define SECRET_IS_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_ITEM))
46 #define SECRET_ITEM_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_ITEM, SecretItemClass))
48 typedef struct _SecretItemClass SecretItemClass;
49 typedef struct _SecretItemPrivate SecretItemPrivate;
51 struct _SecretItem {
52 GDBusProxy parent_instance;
54 /*< private >*/
55 SecretItemPrivate *pv;
58 struct _SecretItemClass {
59 GDBusProxyClass parent_class;
61 /*< private >*/
62 gpointer padding[4];
65 GType secret_item_get_type (void) G_GNUC_CONST;
67 void secret_item_refresh (SecretItem *self);
69 void secret_item_create (SecretCollection *collection,
70 const SecretSchema *schema,
71 GHashTable *attributes,
72 const gchar *label,
73 SecretValue *value,
74 SecretItemCreateFlags flags,
75 GCancellable *cancellable,
76 GAsyncReadyCallback callback,
77 gpointer user_data);
79 SecretItem * secret_item_create_finish (GAsyncResult *result,
80 GError **error);
82 SecretItem * secret_item_create_sync (SecretCollection *collection,
83 const SecretSchema *schema,
84 GHashTable *attributes,
85 const gchar *label,
86 SecretValue *value,
87 SecretItemCreateFlags flags,
88 GCancellable *cancellable,
89 GError **error);
91 void secret_item_delete (SecretItem *self,
92 GCancellable *cancellable,
93 GAsyncReadyCallback callback,
94 gpointer user_data);
96 gboolean secret_item_delete_finish (SecretItem *self,
97 GAsyncResult *result,
98 GError **error);
100 gboolean secret_item_delete_sync (SecretItem *self,
101 GCancellable *cancellable,
102 GError **error);
104 SecretItemFlags secret_item_get_flags (SecretItem *self);
106 SecretService * secret_item_get_service (SecretItem *self);
108 SecretValue * secret_item_get_secret (SecretItem *self);
110 void secret_item_load_secret (SecretItem *self,
111 GCancellable *cancellable,
112 GAsyncReadyCallback callback,
113 gpointer user_data);
115 gboolean secret_item_load_secret_finish (SecretItem *self,
116 GAsyncResult *result,
117 GError **error);
119 gboolean secret_item_load_secret_sync (SecretItem *self,
120 GCancellable *cancellable,
121 GError **error);
123 void secret_item_load_secrets (GList *items,
124 GCancellable *cancellable,
125 GAsyncReadyCallback callback,
126 gpointer user_data);
128 gboolean secret_item_load_secrets_finish (GAsyncResult *result,
129 GError **error);
131 gboolean secret_item_load_secrets_sync (GList *items,
132 GCancellable *cancellable,
133 GError **error);
135 void secret_item_set_secret (SecretItem *self,
136 SecretValue *value,
137 GCancellable *cancellable,
138 GAsyncReadyCallback callback,
139 gpointer user_data);
141 gboolean secret_item_set_secret_finish (SecretItem *self,
142 GAsyncResult *result,
143 GError **error);
145 gboolean secret_item_set_secret_sync (SecretItem *self,
146 SecretValue *value,
147 GCancellable *cancellable,
148 GError **error);
150 gchar * secret_item_get_schema_name (SecretItem *self);
152 GHashTable* secret_item_get_attributes (SecretItem *self);
154 void secret_item_set_attributes (SecretItem *self,
155 const SecretSchema *schema,
156 GHashTable *attributes,
157 GCancellable *cancellable,
158 GAsyncReadyCallback callback,
159 gpointer user_data);
161 gboolean secret_item_set_attributes_finish (SecretItem *self,
162 GAsyncResult *result,
163 GError **error);
165 gboolean secret_item_set_attributes_sync (SecretItem *self,
166 const SecretSchema *schema,
167 GHashTable *attributes,
168 GCancellable *cancellable,
169 GError **error);
171 gchar * secret_item_get_label (SecretItem *self);
173 void secret_item_set_label (SecretItem *self,
174 const gchar *label,
175 GCancellable *cancellable,
176 GAsyncReadyCallback callback,
177 gpointer user_data);
179 gboolean secret_item_set_label_finish (SecretItem *self,
180 GAsyncResult *result,
181 GError **error);
183 gboolean secret_item_set_label_sync (SecretItem *self,
184 const gchar *label,
185 GCancellable *cancellable,
186 GError **error);
188 gboolean secret_item_get_locked (SecretItem *self);
190 guint64 secret_item_get_created (SecretItem *self);
192 guint64 secret_item_get_modified (SecretItem *self);
194 G_END_DECLS
196 #endif /* __SECRET_ITEM_H___ */