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."
19 #ifndef __SECRET_ITEM_H__
20 #define __SECRET_ITEM_H__
24 #include "secret-collection.h"
25 #include "secret-item.h"
26 #include "secret-service.h"
27 #include "secret-value.h"
33 SECRET_ITEM_LOAD_SECRET
= 1 << 1
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
;
52 GDBusProxy parent_instance
;
55 SecretItemPrivate
*pv
;
58 struct _SecretItemClass
{
59 GDBusProxyClass parent_class
;
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
,
74 SecretItemCreateFlags flags
,
75 GCancellable
*cancellable
,
76 GAsyncReadyCallback callback
,
79 SecretItem
* secret_item_create_finish (GAsyncResult
*result
,
82 SecretItem
* secret_item_create_sync (SecretCollection
*collection
,
83 const SecretSchema
*schema
,
84 GHashTable
*attributes
,
87 SecretItemCreateFlags flags
,
88 GCancellable
*cancellable
,
91 void secret_item_delete (SecretItem
*self
,
92 GCancellable
*cancellable
,
93 GAsyncReadyCallback callback
,
96 gboolean
secret_item_delete_finish (SecretItem
*self
,
100 gboolean
secret_item_delete_sync (SecretItem
*self
,
101 GCancellable
*cancellable
,
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
,
115 gboolean
secret_item_load_secret_finish (SecretItem
*self
,
116 GAsyncResult
*result
,
119 gboolean
secret_item_load_secret_sync (SecretItem
*self
,
120 GCancellable
*cancellable
,
123 void secret_item_load_secrets (GList
*items
,
124 GCancellable
*cancellable
,
125 GAsyncReadyCallback callback
,
128 gboolean
secret_item_load_secrets_finish (GAsyncResult
*result
,
131 gboolean
secret_item_load_secrets_sync (GList
*items
,
132 GCancellable
*cancellable
,
135 void secret_item_set_secret (SecretItem
*self
,
137 GCancellable
*cancellable
,
138 GAsyncReadyCallback callback
,
141 gboolean
secret_item_set_secret_finish (SecretItem
*self
,
142 GAsyncResult
*result
,
145 gboolean
secret_item_set_secret_sync (SecretItem
*self
,
147 GCancellable
*cancellable
,
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
,
161 gboolean
secret_item_set_attributes_finish (SecretItem
*self
,
162 GAsyncResult
*result
,
165 gboolean
secret_item_set_attributes_sync (SecretItem
*self
,
166 const SecretSchema
*schema
,
167 GHashTable
*attributes
,
168 GCancellable
*cancellable
,
171 gchar
* secret_item_get_label (SecretItem
*self
);
173 void secret_item_set_label (SecretItem
*self
,
175 GCancellable
*cancellable
,
176 GAsyncReadyCallback callback
,
179 gboolean
secret_item_set_label_finish (SecretItem
*self
,
180 GAsyncResult
*result
,
183 gboolean
secret_item_set_label_sync (SecretItem
*self
,
185 GCancellable
*cancellable
,
188 gboolean
secret_item_get_locked (SecretItem
*self
);
190 guint64
secret_item_get_created (SecretItem
*self
);
192 guint64
secret_item_get_modified (SecretItem
*self
);
196 #endif /* __SECRET_ITEM_H___ */