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 <secret/secret.h> or <secret/secret-unstable.h> can be included directly."
19 #ifndef __SECRET_ITEM_H__
20 #define __SECRET_ITEM_H__
24 #include "secret-item.h"
25 #include "secret-service.h"
26 #include "secret-value.h"
32 SECRET_ITEM_LOAD_SECRET = 1 << 1
36 SECRET_ITEM_CREATE_NONE = 0,
37 SECRET_ITEM_CREATE_REPLACE = 1 << 1
38 } SecretItemCreateFlags;
40 #define SECRET_TYPE_ITEM (secret_item_get_type ())
41 #define SECRET_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_ITEM, SecretItem))
42 #define SECRET_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_ITEM, SecretItemClass))
43 #define SECRET_IS_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_ITEM))
44 #define SECRET_IS_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_ITEM))
45 #define SECRET_ITEM_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_ITEM, SecretItemClass))
47 typedef struct _SecretItemClass SecretItemClass;
48 typedef struct _SecretItemPrivate SecretItemPrivate;
51 GDBusProxy parent_instance;
54 SecretItemPrivate *pv;
57 struct _SecretItemClass {
58 GDBusProxyClass parent_class;
64 GType secret_item_get_type (void) G_GNUC_CONST;
66 void secret_item_refresh (SecretItem *self);
68 void secret_item_create (SecretCollection *collection,
69 const SecretSchema *schema,
70 GHashTable *attributes,
73 SecretItemCreateFlags flags,
74 GCancellable *cancellable,
75 GAsyncReadyCallback callback,
78 SecretItem * secret_item_create_finish (GAsyncResult *result,
81 SecretItem * secret_item_create_sync (SecretCollection *collection,
82 const SecretSchema *schema,
83 GHashTable *attributes,
86 SecretItemCreateFlags flags,
87 GCancellable *cancellable,
90 void secret_item_delete (SecretItem *self,
91 GCancellable *cancellable,
92 GAsyncReadyCallback callback,
95 gboolean secret_item_delete_finish (SecretItem *self,
99 gboolean secret_item_delete_sync (SecretItem *self,
100 GCancellable *cancellable,
103 SecretItemFlags secret_item_get_flags (SecretItem *self);
105 SecretService * secret_item_get_service (SecretItem *self);
107 SecretValue * secret_item_get_secret (SecretItem *self);
109 void secret_item_load_secret (SecretItem *self,
110 GCancellable *cancellable,
111 GAsyncReadyCallback callback,
114 gboolean secret_item_load_secret_finish (SecretItem *self,
115 GAsyncResult *result,
118 gboolean secret_item_load_secret_sync (SecretItem *self,
119 GCancellable *cancellable,
122 void secret_item_load_secrets (GList *items,
123 GCancellable *cancellable,
124 GAsyncReadyCallback callback,
127 gboolean secret_item_load_secrets_finish (GAsyncResult *result,
130 gboolean secret_item_load_secrets_sync (GList *items,
131 GCancellable *cancellable,
134 void secret_item_set_secret (SecretItem *self,
136 GCancellable *cancellable,
137 GAsyncReadyCallback callback,
140 gboolean secret_item_set_secret_finish (SecretItem *self,
141 GAsyncResult *result,
144 gboolean secret_item_set_secret_sync (SecretItem *self,
146 GCancellable *cancellable,
149 gchar * secret_item_get_schema_name (SecretItem *self);
151 GHashTable* secret_item_get_attributes (SecretItem *self);
153 void secret_item_set_attributes (SecretItem *self,
154 const SecretSchema *schema,
155 GHashTable *attributes,
156 GCancellable *cancellable,
157 GAsyncReadyCallback callback,
160 gboolean secret_item_set_attributes_finish (SecretItem *self,
161 GAsyncResult *result,
164 gboolean secret_item_set_attributes_sync (SecretItem *self,
165 const SecretSchema *schema,
166 GHashTable *attributes,
167 GCancellable *cancellable,
170 gchar * secret_item_get_label (SecretItem *self);
172 void secret_item_set_label (SecretItem *self,
174 GCancellable *cancellable,
175 GAsyncReadyCallback callback,
178 gboolean secret_item_set_label_finish (SecretItem *self,
179 GAsyncResult *result,
182 gboolean secret_item_set_label_sync (SecretItem *self,
184 GCancellable *cancellable,
187 gboolean secret_item_get_locked (SecretItem *self);
189 guint64 secret_item_get_created (SecretItem *self);
191 guint64 secret_item_get_modified (SecretItem *self);
195 #endif /* __SECRET_ITEM_H___ */