mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 12:48:51 +00:00
Complete the gsecret_item_xxx() functions
This commit is contained in:
parent
72dc330a04
commit
805355e78e
@ -204,46 +204,184 @@ gsecret_item_get_secret_sync (GSecretItem *self,
|
||||
return value;
|
||||
}
|
||||
|
||||
#ifdef UNIMPLEMENTED
|
||||
GHashTable *
|
||||
gsecret_item_get_attributes (GSecretItem *self)
|
||||
{
|
||||
GHashTable *attributes;
|
||||
GVariant *variant;
|
||||
|
||||
GHashTable* gsecret_item_get_attributes (GSecretItem *self);
|
||||
g_return_val_if_fail (GSECRET_IS_ITEM (self), NULL);
|
||||
|
||||
void gsecret_item_set_attributes (GSecretItem *self,
|
||||
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Attributes");
|
||||
g_return_val_if_fail (variant != NULL, NULL);
|
||||
|
||||
attributes = _gsecret_util_attributes_for_variant (variant);
|
||||
g_variant_unref (variant);
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_item_set_attributes (GSecretItem *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gpointer user_data)
|
||||
{
|
||||
GVariant *variant;
|
||||
|
||||
gboolean gsecret_item_set_attributes_finish (GSecretItem *self,
|
||||
g_return_if_fail (GSECRET_IS_ITEM (self));
|
||||
g_return_if_fail (attributes != NULL);
|
||||
|
||||
variant = _gsecret_util_variant_for_attributes (attributes);
|
||||
|
||||
_gsecret_util_set_property (G_DBUS_PROXY (self), "Attributes", variant,
|
||||
gsecret_item_set_attributes, cancellable,
|
||||
callback, user_data);
|
||||
|
||||
g_variant_unref (variant);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_item_set_attributes_finish (GSecretItem *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE);
|
||||
|
||||
void gsecret_item_set_attributes_sync (GSecretItem *self,
|
||||
return _gsecret_util_set_property_finish (G_DBUS_PROXY (self),
|
||||
gsecret_item_set_attributes,
|
||||
result, error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_item_set_attributes_sync (GSecretItem *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GError **error)
|
||||
{
|
||||
GVariant *variant;
|
||||
gboolean ret;
|
||||
|
||||
const gchar* gsecret_item_get_label (GSecretItem *self);
|
||||
g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE);
|
||||
g_return_val_if_fail (attributes != NULL, FALSE);
|
||||
|
||||
void gsecret_item_set_label (GSecretItem *self,
|
||||
variant = _gsecret_util_variant_for_attributes (attributes);
|
||||
|
||||
ret = _gsecret_util_set_property_sync (G_DBUS_PROXY (self), "Attributes",
|
||||
variant, cancellable, error);
|
||||
|
||||
g_variant_unref (variant);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gsecret_item_get_label (GSecretItem *self)
|
||||
{
|
||||
GVariant *variant;
|
||||
gchar *label;
|
||||
|
||||
g_return_val_if_fail (GSECRET_IS_ITEM (self), NULL);
|
||||
|
||||
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Label");
|
||||
g_return_val_if_fail (variant != NULL, NULL);
|
||||
|
||||
label = g_variant_dup_string (variant, NULL);
|
||||
g_variant_unref (variant);
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_item_set_label (GSecretItem *self,
|
||||
const gchar *label,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (GSECRET_IS_ITEM (self));
|
||||
g_return_if_fail (label != NULL);
|
||||
|
||||
gboolean gsecret_item_set_label_finish (GSecretItem *self,
|
||||
_gsecret_util_set_property (G_DBUS_PROXY (self), "Label",
|
||||
g_variant_new_string (label),
|
||||
gsecret_item_set_label,
|
||||
cancellable, callback, user_data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_item_set_label_finish (GSecretItem *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE);
|
||||
|
||||
void gsecret_item_set_label_sync (GSecretItem *self,
|
||||
return _gsecret_util_set_property_finish (G_DBUS_PROXY (self),
|
||||
gsecret_item_set_label,
|
||||
result, error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_item_set_label_sync (GSecretItem *self,
|
||||
const gchar *label,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE);
|
||||
g_return_val_if_fail (label != NULL, FALSE);
|
||||
|
||||
gboolean gsecret_item_get_locked (GSecretItem *self);
|
||||
return _gsecret_util_set_property_sync (G_DBUS_PROXY (self), "Label",
|
||||
g_variant_new_string (label),
|
||||
cancellable, error);
|
||||
}
|
||||
|
||||
guint64 gsecret_item_get_created (GSecretItem *self);
|
||||
gboolean
|
||||
gsecret_item_get_locked (GSecretItem *self)
|
||||
{
|
||||
GVariant *variant;
|
||||
gboolean locked;
|
||||
|
||||
guint64 gsecret_item_get_modified (GSecretItem *self);
|
||||
g_return_val_if_fail (GSECRET_IS_ITEM (self), TRUE);
|
||||
|
||||
#endif /* UNIMPLEMENTED */
|
||||
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Locked");
|
||||
g_return_val_if_fail (variant != NULL, TRUE);
|
||||
|
||||
locked = g_variant_get_boolean (variant);
|
||||
g_variant_unref (variant);
|
||||
|
||||
return locked;
|
||||
}
|
||||
|
||||
guint64
|
||||
gsecret_item_get_created (GSecretItem *self)
|
||||
{
|
||||
GVariant *variant;
|
||||
guint64 created;
|
||||
|
||||
g_return_val_if_fail (GSECRET_IS_ITEM (self), TRUE);
|
||||
|
||||
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Created");
|
||||
g_return_val_if_fail (variant != NULL, 0);
|
||||
|
||||
created = g_variant_get_uint64 (variant);
|
||||
g_variant_unref (variant);
|
||||
|
||||
return created;
|
||||
}
|
||||
|
||||
guint64
|
||||
gsecret_item_get_modified (GSecretItem *self)
|
||||
{
|
||||
GVariant *variant;
|
||||
guint64 modified;
|
||||
|
||||
g_return_val_if_fail (GSECRET_IS_ITEM (self), TRUE);
|
||||
|
||||
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Modified");
|
||||
g_return_val_if_fail (variant != NULL, 0);
|
||||
|
||||
modified = g_variant_get_uint64 (variant);
|
||||
g_variant_unref (variant);
|
||||
|
||||
return modified;
|
||||
}
|
||||
|
@ -42,8 +42,10 @@ struct _GSecretItem {
|
||||
|
||||
GType gsecret_item_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GSecretItem* gsecret_item_instance (GDBusConnection *connection,
|
||||
#if 0
|
||||
GSecretItem * gsecret_item_instance (GDBusConnection *connection,
|
||||
const gchar *object_path);
|
||||
#endif
|
||||
|
||||
void gsecret_item_delete (GSecretItem *self,
|
||||
GCancellable *cancellable,
|
||||
@ -71,8 +73,6 @@ GSecretValue * gsecret_item_get_secret_sync (GSecretItem *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
#if 0
|
||||
|
||||
GHashTable* gsecret_item_get_attributes (GSecretItem *self);
|
||||
|
||||
void gsecret_item_set_attributes (GSecretItem *self,
|
||||
@ -85,12 +85,12 @@ gboolean gsecret_item_set_attributes_finish (GSecretItem *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void gsecret_item_set_attributes_sync (GSecretItem *self,
|
||||
gboolean gsecret_item_set_attributes_sync (GSecretItem *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
const gchar* gsecret_item_get_label (GSecretItem *self);
|
||||
gchar * gsecret_item_get_label (GSecretItem *self);
|
||||
|
||||
void gsecret_item_set_label (GSecretItem *self,
|
||||
const gchar *label,
|
||||
@ -102,7 +102,7 @@ gboolean gsecret_item_set_label_finish (GSecretItem *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void gsecret_item_set_label_sync (GSecretItem *self,
|
||||
gboolean gsecret_item_set_label_sync (GSecretItem *self,
|
||||
const gchar *label,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
@ -113,8 +113,6 @@ guint64 gsecret_item_get_created (GSecretItem *self);
|
||||
|
||||
guint64 gsecret_item_get_modified (GSecretItem *self);
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_ITEM_H___ */
|
||||
|
@ -37,6 +37,8 @@ typedef struct {
|
||||
|
||||
#define GSECRET_PROMPT_SIGNAL_COMPLETED "Completed"
|
||||
|
||||
#define GSECRET_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
|
||||
|
||||
GSecretParams * _gsecret_params_new (GCancellable *cancellable,
|
||||
GVariant *in);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user