diff --git a/configure.ac b/configure.ac index 5e10dd0..3b7f750 100644 --- a/configure.ac +++ b/configure.ac @@ -34,7 +34,10 @@ AM_GLIB_GNU_GETTEXT # GLib # -PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28.0 gio-2.0 >= 2.28.0 gthread-2.0 >= 2.16.0) +PKG_CHECK_MODULES(GLIB, + glib-2.0 >= 2.30.0 + gio-2.0 >= 2.30.0 + gio-unix-2.0) LIBS="$LIBS $GLIB_LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS" diff --git a/library/Makefile.am b/library/Makefile.am index 5ce70d8..3a121a9 100644 --- a/library/Makefile.am +++ b/library/Makefile.am @@ -11,11 +11,15 @@ module_flags = \ lib_LTLIBRARIES = libgsecret.la +BUILT_SOURCES = \ + gsecret-dbus-generated.c gsecret-dbus-generated.h + libgsecret_la_SOURCES = \ gsecret-value.h gsecret-value.c \ gsecret-item.h gsecret-item.c \ gsecret-service.h gsecret-service.c \ gsecret-util.c \ + $(BUILT_SOURCES) \ $(NULL) libgsecret_la_CFLAGS = \ @@ -24,4 +28,15 @@ libgsecret_la_CFLAGS = \ libgsecret_la_LIBADD = \ $(top_builddir)/egg/libegg.la \ $(LIBGCRYPT_LIBS) \ - $(LIBS) \ No newline at end of file + $(LIBS) + +DBUS_XML_DEFINITIONS = \ + org.freedesktop.Secrets.xml + +gsecret-dbus-generated.c: $(DBUS_XML_DEFINITIONS) Makefile.am + $(AM_V_GEN) gdbus-codegen --interface-prefix org.freedesktop.Secret. \ + --generate-c-code gsecret-dbus-generated --c-namespace GSecretGen \ + $(DBUS_XML_DEFINITIONS) + $(AM_V_GEN) sed -i -e 's/gsecret_gen_/_gsecret_gen_/g' gsecret-dbus-generated.[ch] + +gsecret-dbus-generated.h: gsecret-dbus-generated.c diff --git a/library/gsecret-dbus-generated.c b/library/gsecret-dbus-generated.c new file mode 100644 index 0000000..2c34440 --- /dev/null +++ b/library/gsecret-dbus-generated.c @@ -0,0 +1,3125 @@ +/* + * Generated by gdbus-codegen 2.30.1. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gsecret-dbus-generated.h" + +#ifdef G_OS_UNIX +# include +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + ret = (g_value_get_double (a) == g_value_get_double (b)); + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.Secret.Service + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:GSecretGenService + * @title: GSecretGenService + * @short_description: Generated C code for the org.freedesktop.Secret.Service D-Bus interface + * + * This section contains code for working with the org.freedesktop.Secret.Service D-Bus interface in C. + */ + +/* ---- Introspection data for org.freedesktop.Secret.Service ---- */ + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_open_session_IN_ARG_algorithm = +{ + { + -1, + "algorithm", + "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_open_session_IN_ARG_input = +{ + { + -1, + "input", + "v", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_open_session_IN_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_open_session_IN_ARG_algorithm, + &__gsecret_gen_service_method_info_open_session_IN_ARG_input, + NULL +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_open_session_OUT_ARG_output = +{ + { + -1, + "output", + "v", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_open_session_OUT_ARG_result = +{ + { + -1, + "result", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_open_session_OUT_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_open_session_OUT_ARG_output, + &__gsecret_gen_service_method_info_open_session_OUT_ARG_result, + NULL +}; + +static const _ExtendedGDBusMethodInfo __gsecret_gen_service_method_info_open_session = +{ + { + -1, + "OpenSession", + (GDBusArgInfo **) &__gsecret_gen_service_method_info_open_session_IN_ARG_pointers, + (GDBusArgInfo **) &__gsecret_gen_service_method_info_open_session_OUT_ARG_pointers, + NULL + }, + "handle-open-session", + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_create_collection_IN_ARG_properties = +{ + { + -1, + "properties", + "a{sv}", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_create_collection_IN_ARG_alias = +{ + { + -1, + "alias", + "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_create_collection_IN_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_create_collection_IN_ARG_properties, + &__gsecret_gen_service_method_info_create_collection_IN_ARG_alias, + NULL +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_create_collection_OUT_ARG_collection = +{ + { + -1, + "collection", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_create_collection_OUT_ARG_prompt = +{ + { + -1, + "prompt", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_create_collection_OUT_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_create_collection_OUT_ARG_collection, + &__gsecret_gen_service_method_info_create_collection_OUT_ARG_prompt, + NULL +}; + +static const _ExtendedGDBusMethodInfo __gsecret_gen_service_method_info_create_collection = +{ + { + -1, + "CreateCollection", + (GDBusArgInfo **) &__gsecret_gen_service_method_info_create_collection_IN_ARG_pointers, + (GDBusArgInfo **) &__gsecret_gen_service_method_info_create_collection_OUT_ARG_pointers, + NULL + }, + "handle-create-collection", + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_search_items_IN_ARG_attributes = +{ + { + -1, + "attributes", + "a{ss}", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_search_items_IN_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_search_items_IN_ARG_attributes, + NULL +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_search_items_OUT_ARG_unlocked = +{ + { + -1, + "unlocked", + "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_search_items_OUT_ARG_locked = +{ + { + -1, + "locked", + "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_search_items_OUT_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_search_items_OUT_ARG_unlocked, + &__gsecret_gen_service_method_info_search_items_OUT_ARG_locked, + NULL +}; + +static const _ExtendedGDBusMethodInfo __gsecret_gen_service_method_info_search_items = +{ + { + -1, + "SearchItems", + (GDBusArgInfo **) &__gsecret_gen_service_method_info_search_items_IN_ARG_pointers, + (GDBusArgInfo **) &__gsecret_gen_service_method_info_search_items_OUT_ARG_pointers, + NULL + }, + "handle-search-items", + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_unlock_IN_ARG_objects = +{ + { + -1, + "objects", + "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_unlock_IN_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_unlock_IN_ARG_objects, + NULL +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_unlock_OUT_ARG_unlocked = +{ + { + -1, + "unlocked", + "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_unlock_OUT_ARG_prompt = +{ + { + -1, + "prompt", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_unlock_OUT_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_unlock_OUT_ARG_unlocked, + &__gsecret_gen_service_method_info_unlock_OUT_ARG_prompt, + NULL +}; + +static const _ExtendedGDBusMethodInfo __gsecret_gen_service_method_info_unlock = +{ + { + -1, + "Unlock", + (GDBusArgInfo **) &__gsecret_gen_service_method_info_unlock_IN_ARG_pointers, + (GDBusArgInfo **) &__gsecret_gen_service_method_info_unlock_OUT_ARG_pointers, + NULL + }, + "handle-unlock", + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_lock_IN_ARG_objects = +{ + { + -1, + "objects", + "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_lock_IN_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_lock_IN_ARG_objects, + NULL +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_lock_OUT_ARG_locked = +{ + { + -1, + "locked", + "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_lock_OUT_ARG_Prompt = +{ + { + -1, + "Prompt", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_lock_OUT_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_lock_OUT_ARG_locked, + &__gsecret_gen_service_method_info_lock_OUT_ARG_Prompt, + NULL +}; + +static const _ExtendedGDBusMethodInfo __gsecret_gen_service_method_info_lock = +{ + { + -1, + "Lock", + (GDBusArgInfo **) &__gsecret_gen_service_method_info_lock_IN_ARG_pointers, + (GDBusArgInfo **) &__gsecret_gen_service_method_info_lock_OUT_ARG_pointers, + NULL + }, + "handle-lock", + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_get_secrets_IN_ARG_items = +{ + { + -1, + "items", + "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_get_secrets_IN_ARG_session = +{ + { + -1, + "session", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_get_secrets_IN_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_get_secrets_IN_ARG_items, + &__gsecret_gen_service_method_info_get_secrets_IN_ARG_session, + NULL +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_get_secrets_OUT_ARG_secrets = +{ + { + -1, + "secrets", + "a{o(oayays)}", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_get_secrets_OUT_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_get_secrets_OUT_ARG_secrets, + NULL +}; + +static const _ExtendedGDBusMethodInfo __gsecret_gen_service_method_info_get_secrets = +{ + { + -1, + "GetSecrets", + (GDBusArgInfo **) &__gsecret_gen_service_method_info_get_secrets_IN_ARG_pointers, + (GDBusArgInfo **) &__gsecret_gen_service_method_info_get_secrets_OUT_ARG_pointers, + NULL + }, + "handle-get-secrets", + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_read_alias_IN_ARG_name = +{ + { + -1, + "name", + "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_read_alias_IN_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_read_alias_IN_ARG_name, + NULL +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_read_alias_OUT_ARG_collection = +{ + { + -1, + "collection", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_read_alias_OUT_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_read_alias_OUT_ARG_collection, + NULL +}; + +static const _ExtendedGDBusMethodInfo __gsecret_gen_service_method_info_read_alias = +{ + { + -1, + "ReadAlias", + (GDBusArgInfo **) &__gsecret_gen_service_method_info_read_alias_IN_ARG_pointers, + (GDBusArgInfo **) &__gsecret_gen_service_method_info_read_alias_OUT_ARG_pointers, + NULL + }, + "handle-read-alias", + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_set_alias_IN_ARG_name = +{ + { + -1, + "name", + "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_method_info_set_alias_IN_ARG_collection = +{ + { + -1, + "collection", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_method_info_set_alias_IN_ARG_pointers[] = +{ + &__gsecret_gen_service_method_info_set_alias_IN_ARG_name, + &__gsecret_gen_service_method_info_set_alias_IN_ARG_collection, + NULL +}; + +static const _ExtendedGDBusMethodInfo __gsecret_gen_service_method_info_set_alias = +{ + { + -1, + "SetAlias", + (GDBusArgInfo **) &__gsecret_gen_service_method_info_set_alias_IN_ARG_pointers, + NULL, + NULL + }, + "handle-set-alias", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const __gsecret_gen_service_method_info_pointers[] = +{ + &__gsecret_gen_service_method_info_open_session, + &__gsecret_gen_service_method_info_create_collection, + &__gsecret_gen_service_method_info_search_items, + &__gsecret_gen_service_method_info_unlock, + &__gsecret_gen_service_method_info_lock, + &__gsecret_gen_service_method_info_get_secrets, + &__gsecret_gen_service_method_info_read_alias, + &__gsecret_gen_service_method_info_set_alias, + NULL +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_signal_info_collection_created_ARG_collection = +{ + { + -1, + "collection", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_signal_info_collection_created_ARG_pointers[] = +{ + &__gsecret_gen_service_signal_info_collection_created_ARG_collection, + NULL +}; + +static const _ExtendedGDBusSignalInfo __gsecret_gen_service_signal_info_collection_created = +{ + { + -1, + "CollectionCreated", + (GDBusArgInfo **) &__gsecret_gen_service_signal_info_collection_created_ARG_pointers, + NULL + }, + "collection-created" +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_signal_info_collection_deleted_ARG_collection = +{ + { + -1, + "collection", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_signal_info_collection_deleted_ARG_pointers[] = +{ + &__gsecret_gen_service_signal_info_collection_deleted_ARG_collection, + NULL +}; + +static const _ExtendedGDBusSignalInfo __gsecret_gen_service_signal_info_collection_deleted = +{ + { + -1, + "CollectionDeleted", + (GDBusArgInfo **) &__gsecret_gen_service_signal_info_collection_deleted_ARG_pointers, + NULL + }, + "collection-deleted" +}; + +static const _ExtendedGDBusArgInfo __gsecret_gen_service_signal_info_collection_changed_ARG_collection = +{ + { + -1, + "collection", + "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const __gsecret_gen_service_signal_info_collection_changed_ARG_pointers[] = +{ + &__gsecret_gen_service_signal_info_collection_changed_ARG_collection, + NULL +}; + +static const _ExtendedGDBusSignalInfo __gsecret_gen_service_signal_info_collection_changed = +{ + { + -1, + "CollectionChanged", + (GDBusArgInfo **) &__gsecret_gen_service_signal_info_collection_changed_ARG_pointers, + NULL + }, + "collection-changed" +}; + +static const _ExtendedGDBusSignalInfo * const __gsecret_gen_service_signal_info_pointers[] = +{ + &__gsecret_gen_service_signal_info_collection_created, + &__gsecret_gen_service_signal_info_collection_deleted, + &__gsecret_gen_service_signal_info_collection_changed, + NULL +}; + +static const _ExtendedGDBusPropertyInfo __gsecret_gen_service_property_info_collections = +{ + { + -1, + "Collections", + "ao", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "collections", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const __gsecret_gen_service_property_info_pointers[] = +{ + &__gsecret_gen_service_property_info_collections, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo __gsecret_gen_service_interface_info = +{ + { + -1, + "org.freedesktop.Secret.Service", + (GDBusMethodInfo **) &__gsecret_gen_service_method_info_pointers, + (GDBusSignalInfo **) &__gsecret_gen_service_signal_info_pointers, + (GDBusPropertyInfo **) &__gsecret_gen_service_property_info_pointers, + NULL + }, + "service", +}; + + +/** + * _gsecret_gen_service_interface_info: + * + * Gets a machine-readable description of the org.freedesktop.Secret.Service D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +_gsecret_gen_service_interface_info (void) +{ + return (GDBusInterfaceInfo *) &__gsecret_gen_service_interface_info; +} + +/** + * _gsecret_gen_service_override_properties: + * @klass: The class structure for a #GObject-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #GSecretGenService interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +_gsecret_gen_service_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "collections"); + return property_id_begin - 1; +} + + + +/** + * GSecretGenService: + * + * Abstract interface type for the D-Bus interface org.freedesktop.Secret.Service. + */ + +/** + * GSecretGenServiceIface: + * @parent_iface: The parent interface. + * @handle_create_collection: Handler for the #GSecretGenService::handle-create-collection signal. + * @handle_get_secrets: Handler for the #GSecretGenService::handle-get-secrets signal. + * @handle_lock: Handler for the #GSecretGenService::handle-lock signal. + * @handle_open_session: Handler for the #GSecretGenService::handle-open-session signal. + * @handle_read_alias: Handler for the #GSecretGenService::handle-read-alias signal. + * @handle_search_items: Handler for the #GSecretGenService::handle-search-items signal. + * @handle_set_alias: Handler for the #GSecretGenService::handle-set-alias signal. + * @handle_unlock: Handler for the #GSecretGenService::handle-unlock signal. + * @get_collections: Getter for the #GSecretGenService:collections property. + * @collection_changed: Handler for the #GSecretGenService::collection-changed signal. + * @collection_created: Handler for the #GSecretGenService::collection-created signal. + * @collection_deleted: Handler for the #GSecretGenService::collection-deleted signal. + * + * Virtual table for the D-Bus interface org.freedesktop.Secret.Service. + */ + +static void +_gsecret_gen_service_default_init (GSecretGenServiceIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * GSecretGenService::handle-open-session: + * @object: A #GSecretGenService. + * @invocation: A #GDBusMethodInvocation. + * @arg_algorithm: Argument passed by remote caller. + * @arg_input: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the OpenSession() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call _gsecret_gen_service_complete_open_session() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-open-session", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, handle_open_session), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 3, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_VARIANT); + + /** + * GSecretGenService::handle-create-collection: + * @object: A #GSecretGenService. + * @invocation: A #GDBusMethodInvocation. + * @arg_properties: Argument passed by remote caller. + * @arg_alias: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the CreateCollection() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call _gsecret_gen_service_complete_create_collection() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-create-collection", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, handle_create_collection), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 3, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_STRING); + + /** + * GSecretGenService::handle-search-items: + * @object: A #GSecretGenService. + * @invocation: A #GDBusMethodInvocation. + * @arg_attributes: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the SearchItems() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call _gsecret_gen_service_complete_search_items() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-search-items", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, handle_search_items), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); + + /** + * GSecretGenService::handle-unlock: + * @object: A #GSecretGenService. + * @invocation: A #GDBusMethodInvocation. + * @arg_objects: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the Unlock() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call _gsecret_gen_service_complete_unlock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-unlock", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, handle_unlock), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRV); + + /** + * GSecretGenService::handle-lock: + * @object: A #GSecretGenService. + * @invocation: A #GDBusMethodInvocation. + * @arg_objects: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the Lock() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call _gsecret_gen_service_complete_lock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-lock", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, handle_lock), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRV); + + /** + * GSecretGenService::handle-get-secrets: + * @object: A #GSecretGenService. + * @invocation: A #GDBusMethodInvocation. + * @arg_items: Argument passed by remote caller. + * @arg_session: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the GetSecrets() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call _gsecret_gen_service_complete_get_secrets() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-secrets", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, handle_get_secrets), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 3, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRV, G_TYPE_STRING); + + /** + * GSecretGenService::handle-read-alias: + * @object: A #GSecretGenService. + * @invocation: A #GDBusMethodInvocation. + * @arg_name: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the ReadAlias() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call _gsecret_gen_service_complete_read_alias() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-read-alias", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, handle_read_alias), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * GSecretGenService::handle-set-alias: + * @object: A #GSecretGenService. + * @invocation: A #GDBusMethodInvocation. + * @arg_name: Argument passed by remote caller. + * @arg_collection: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the SetAlias() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call _gsecret_gen_service_complete_set_alias() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-alias", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, handle_set_alias), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 3, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); + + /* GObject signals for received D-Bus signals: */ + /** + * GSecretGenService::collection-created: + * @object: A #GSecretGenService. + * @arg_collection: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "CollectionCreated" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("collection-created", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, collection_created), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * GSecretGenService::collection-deleted: + * @object: A #GSecretGenService. + * @arg_collection: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "CollectionDeleted" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("collection-deleted", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, collection_deleted), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * GSecretGenService::collection-changed: + * @object: A #GSecretGenService. + * @arg_collection: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "CollectionChanged" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("collection-changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GSecretGenServiceIface, collection_changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /* GObject properties for D-Bus properties: */ + /** + * GSecretGenService:collections: + * + * Represents the D-Bus property "Collections". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boxed ("collections", "Collections", "Collections", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +typedef GSecretGenServiceIface GSecretGenServiceInterface; +G_DEFINE_INTERFACE (GSecretGenService, _gsecret_gen_service, G_TYPE_OBJECT); + +/** + * _gsecret_gen_service_get_collections: (skip) + * @object: A #GSecretGenService. + * + * Gets the value of the "Collections" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use _gsecret_gen_service_dup_collections() if on another thread. + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar *const * +_gsecret_gen_service_get_collections (GSecretGenService *object) +{ + return GSECRET_GEN_SERVICE_GET_IFACE (object)->get_collections (object); +} + +/** + * _gsecret_gen_service_dup_collections: (skip) + * @object: A #GSecretGenService. + * + * Gets a copy of the "Collections" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). + */ +gchar ** +_gsecret_gen_service_dup_collections (GSecretGenService *object) +{ + gchar **value; + g_object_get (G_OBJECT (object), "collections", &value, NULL); + return value; +} + +/** + * _gsecret_gen_service_set_collections: (skip) + * @object: A #GSecretGenService. + * @value: The value to set. + * + * Sets the "Collections" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +_gsecret_gen_service_set_collections (GSecretGenService *object, const gchar *const *value) +{ + g_object_set (G_OBJECT (object), "collections", value, NULL); +} + +/** + * _gsecret_gen_service_emit_collection_created: + * @object: A #GSecretGenService. + * @arg_collection: Argument to pass with the signal. + * + * Emits the "CollectionCreated" D-Bus signal. + */ +void +_gsecret_gen_service_emit_collection_created ( + GSecretGenService *object, + const gchar *arg_collection) +{ + g_signal_emit_by_name (object, "collection-created", arg_collection); +} + +/** + * _gsecret_gen_service_emit_collection_deleted: + * @object: A #GSecretGenService. + * @arg_collection: Argument to pass with the signal. + * + * Emits the "CollectionDeleted" D-Bus signal. + */ +void +_gsecret_gen_service_emit_collection_deleted ( + GSecretGenService *object, + const gchar *arg_collection) +{ + g_signal_emit_by_name (object, "collection-deleted", arg_collection); +} + +/** + * _gsecret_gen_service_emit_collection_changed: + * @object: A #GSecretGenService. + * @arg_collection: Argument to pass with the signal. + * + * Emits the "CollectionChanged" D-Bus signal. + */ +void +_gsecret_gen_service_emit_collection_changed ( + GSecretGenService *object, + const gchar *arg_collection) +{ + g_signal_emit_by_name (object, "collection-changed", arg_collection); +} + +/** + * _gsecret_gen_service_call_open_session: + * @proxy: A #GSecretGenServiceProxy. + * @arg_algorithm: Argument to pass with the method invocation. + * @arg_input: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the OpenSession() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_call_open_session_finish() to get the result of the operation. + * + * See _gsecret_gen_service_call_open_session_sync() for the synchronous, blocking version of this method. + */ +void +_gsecret_gen_service_call_open_session ( + GSecretGenService *proxy, + const gchar *arg_algorithm, + GVariant *arg_input, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "OpenSession", + g_variant_new ("(s@v)", + arg_algorithm, + arg_input), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * _gsecret_gen_service_call_open_session_finish: + * @proxy: A #GSecretGenServiceProxy. + * @out_output: (out): Return location for return parameter or %NULL to ignore. + * @out_result: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_call_open_session(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with _gsecret_gen_service_call_open_session(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_open_session_finish ( + GSecretGenService *proxy, + GVariant **out_output, + gchar **out_result, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@vo)", + out_output, + out_result); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_open_session_sync: + * @proxy: A #GSecretGenServiceProxy. + * @arg_algorithm: Argument to pass with the method invocation. + * @arg_input: Argument to pass with the method invocation. + * @out_output: (out): Return location for return parameter or %NULL to ignore. + * @out_result: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the OpenSession() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_call_open_session() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_open_session_sync ( + GSecretGenService *proxy, + const gchar *arg_algorithm, + GVariant *arg_input, + GVariant **out_output, + gchar **out_result, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "OpenSession", + g_variant_new ("(s@v)", + arg_algorithm, + arg_input), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@vo)", + out_output, + out_result); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_create_collection: + * @proxy: A #GSecretGenServiceProxy. + * @arg_properties: Argument to pass with the method invocation. + * @arg_alias: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the CreateCollection() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_call_create_collection_finish() to get the result of the operation. + * + * See _gsecret_gen_service_call_create_collection_sync() for the synchronous, blocking version of this method. + */ +void +_gsecret_gen_service_call_create_collection ( + GSecretGenService *proxy, + GVariant *arg_properties, + const gchar *arg_alias, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "CreateCollection", + g_variant_new ("(@a{sv}s)", + arg_properties, + arg_alias), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * _gsecret_gen_service_call_create_collection_finish: + * @proxy: A #GSecretGenServiceProxy. + * @out_collection: (out): Return location for return parameter or %NULL to ignore. + * @out_prompt: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_call_create_collection(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with _gsecret_gen_service_call_create_collection(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_create_collection_finish ( + GSecretGenService *proxy, + gchar **out_collection, + gchar **out_prompt, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(oo)", + out_collection, + out_prompt); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_create_collection_sync: + * @proxy: A #GSecretGenServiceProxy. + * @arg_properties: Argument to pass with the method invocation. + * @arg_alias: Argument to pass with the method invocation. + * @out_collection: (out): Return location for return parameter or %NULL to ignore. + * @out_prompt: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the CreateCollection() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_call_create_collection() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_create_collection_sync ( + GSecretGenService *proxy, + GVariant *arg_properties, + const gchar *arg_alias, + gchar **out_collection, + gchar **out_prompt, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "CreateCollection", + g_variant_new ("(@a{sv}s)", + arg_properties, + arg_alias), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(oo)", + out_collection, + out_prompt); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_search_items: + * @proxy: A #GSecretGenServiceProxy. + * @arg_attributes: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the SearchItems() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_call_search_items_finish() to get the result of the operation. + * + * See _gsecret_gen_service_call_search_items_sync() for the synchronous, blocking version of this method. + */ +void +_gsecret_gen_service_call_search_items ( + GSecretGenService *proxy, + GVariant *arg_attributes, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SearchItems", + g_variant_new ("(@a{ss})", + arg_attributes), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * _gsecret_gen_service_call_search_items_finish: + * @proxy: A #GSecretGenServiceProxy. + * @out_unlocked: (out): Return location for return parameter or %NULL to ignore. + * @out_locked: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_call_search_items(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with _gsecret_gen_service_call_search_items(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_search_items_finish ( + GSecretGenService *proxy, + gchar ***out_unlocked, + gchar ***out_locked, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao^ao)", + out_unlocked, + out_locked); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_search_items_sync: + * @proxy: A #GSecretGenServiceProxy. + * @arg_attributes: Argument to pass with the method invocation. + * @out_unlocked: (out): Return location for return parameter or %NULL to ignore. + * @out_locked: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the SearchItems() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_call_search_items() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_search_items_sync ( + GSecretGenService *proxy, + GVariant *arg_attributes, + gchar ***out_unlocked, + gchar ***out_locked, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SearchItems", + g_variant_new ("(@a{ss})", + arg_attributes), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao^ao)", + out_unlocked, + out_locked); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_unlock: + * @proxy: A #GSecretGenServiceProxy. + * @arg_objects: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the Unlock() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_call_unlock_finish() to get the result of the operation. + * + * See _gsecret_gen_service_call_unlock_sync() for the synchronous, blocking version of this method. + */ +void +_gsecret_gen_service_call_unlock ( + GSecretGenService *proxy, + const gchar *const *arg_objects, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Unlock", + g_variant_new ("(^ao)", + arg_objects), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * _gsecret_gen_service_call_unlock_finish: + * @proxy: A #GSecretGenServiceProxy. + * @out_unlocked: (out): Return location for return parameter or %NULL to ignore. + * @out_prompt: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_call_unlock(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with _gsecret_gen_service_call_unlock(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_unlock_finish ( + GSecretGenService *proxy, + gchar ***out_unlocked, + gchar **out_prompt, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^aoo)", + out_unlocked, + out_prompt); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_unlock_sync: + * @proxy: A #GSecretGenServiceProxy. + * @arg_objects: Argument to pass with the method invocation. + * @out_unlocked: (out): Return location for return parameter or %NULL to ignore. + * @out_prompt: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Unlock() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_call_unlock() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_unlock_sync ( + GSecretGenService *proxy, + const gchar *const *arg_objects, + gchar ***out_unlocked, + gchar **out_prompt, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Unlock", + g_variant_new ("(^ao)", + arg_objects), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^aoo)", + out_unlocked, + out_prompt); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_lock: + * @proxy: A #GSecretGenServiceProxy. + * @arg_objects: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the Lock() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_call_lock_finish() to get the result of the operation. + * + * See _gsecret_gen_service_call_lock_sync() for the synchronous, blocking version of this method. + */ +void +_gsecret_gen_service_call_lock ( + GSecretGenService *proxy, + const gchar *const *arg_objects, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Lock", + g_variant_new ("(^ao)", + arg_objects), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * _gsecret_gen_service_call_lock_finish: + * @proxy: A #GSecretGenServiceProxy. + * @out_locked: (out): Return location for return parameter or %NULL to ignore. + * @out_Prompt: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_call_lock(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with _gsecret_gen_service_call_lock(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_lock_finish ( + GSecretGenService *proxy, + gchar ***out_locked, + gchar **out_Prompt, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^aoo)", + out_locked, + out_Prompt); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_lock_sync: + * @proxy: A #GSecretGenServiceProxy. + * @arg_objects: Argument to pass with the method invocation. + * @out_locked: (out): Return location for return parameter or %NULL to ignore. + * @out_Prompt: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Lock() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_call_lock() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_lock_sync ( + GSecretGenService *proxy, + const gchar *const *arg_objects, + gchar ***out_locked, + gchar **out_Prompt, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Lock", + g_variant_new ("(^ao)", + arg_objects), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^aoo)", + out_locked, + out_Prompt); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_get_secrets: + * @proxy: A #GSecretGenServiceProxy. + * @arg_items: Argument to pass with the method invocation. + * @arg_session: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the GetSecrets() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_call_get_secrets_finish() to get the result of the operation. + * + * See _gsecret_gen_service_call_get_secrets_sync() for the synchronous, blocking version of this method. + */ +void +_gsecret_gen_service_call_get_secrets ( + GSecretGenService *proxy, + const gchar *const *arg_items, + const gchar *arg_session, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSecrets", + g_variant_new ("(^aoo)", + arg_items, + arg_session), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * _gsecret_gen_service_call_get_secrets_finish: + * @proxy: A #GSecretGenServiceProxy. + * @out_secrets: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_call_get_secrets(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with _gsecret_gen_service_call_get_secrets(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_get_secrets_finish ( + GSecretGenService *proxy, + GVariant **out_secrets, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@a{o(oayays)})", + out_secrets); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_get_secrets_sync: + * @proxy: A #GSecretGenServiceProxy. + * @arg_items: Argument to pass with the method invocation. + * @arg_session: Argument to pass with the method invocation. + * @out_secrets: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the GetSecrets() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_call_get_secrets() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_get_secrets_sync ( + GSecretGenService *proxy, + const gchar *const *arg_items, + const gchar *arg_session, + GVariant **out_secrets, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSecrets", + g_variant_new ("(^aoo)", + arg_items, + arg_session), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@a{o(oayays)})", + out_secrets); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_read_alias: + * @proxy: A #GSecretGenServiceProxy. + * @arg_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the ReadAlias() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_call_read_alias_finish() to get the result of the operation. + * + * See _gsecret_gen_service_call_read_alias_sync() for the synchronous, blocking version of this method. + */ +void +_gsecret_gen_service_call_read_alias ( + GSecretGenService *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "ReadAlias", + g_variant_new ("(s)", + arg_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * _gsecret_gen_service_call_read_alias_finish: + * @proxy: A #GSecretGenServiceProxy. + * @out_collection: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_call_read_alias(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with _gsecret_gen_service_call_read_alias(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_read_alias_finish ( + GSecretGenService *proxy, + gchar **out_collection, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_collection); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_read_alias_sync: + * @proxy: A #GSecretGenServiceProxy. + * @arg_name: Argument to pass with the method invocation. + * @out_collection: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the ReadAlias() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_call_read_alias() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_read_alias_sync ( + GSecretGenService *proxy, + const gchar *arg_name, + gchar **out_collection, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "ReadAlias", + g_variant_new ("(s)", + arg_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_collection); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_set_alias: + * @proxy: A #GSecretGenServiceProxy. + * @arg_name: Argument to pass with the method invocation. + * @arg_collection: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the SetAlias() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_call_set_alias_finish() to get the result of the operation. + * + * See _gsecret_gen_service_call_set_alias_sync() for the synchronous, blocking version of this method. + */ +void +_gsecret_gen_service_call_set_alias ( + GSecretGenService *proxy, + const gchar *arg_name, + const gchar *arg_collection, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetAlias", + g_variant_new ("(so)", + arg_name, + arg_collection), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * _gsecret_gen_service_call_set_alias_finish: + * @proxy: A #GSecretGenServiceProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_call_set_alias(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with _gsecret_gen_service_call_set_alias(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_set_alias_finish ( + GSecretGenService *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_call_set_alias_sync: + * @proxy: A #GSecretGenServiceProxy. + * @arg_name: Argument to pass with the method invocation. + * @arg_collection: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the SetAlias() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_call_set_alias() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +_gsecret_gen_service_call_set_alias_sync ( + GSecretGenService *proxy, + const gchar *arg_name, + const gchar *arg_collection, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetAlias", + g_variant_new ("(so)", + arg_name, + arg_collection), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * _gsecret_gen_service_complete_open_session: + * @object: A #GSecretGenService. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @output: Parameter to return. + * @result: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the OpenSession() D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +_gsecret_gen_service_complete_open_session ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + GVariant *output, + const gchar *result) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(@vo)", + output, + result)); +} + +/** + * _gsecret_gen_service_complete_create_collection: + * @object: A #GSecretGenService. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @collection: Parameter to return. + * @prompt: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the CreateCollection() D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +_gsecret_gen_service_complete_create_collection ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *collection, + const gchar *prompt) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(oo)", + collection, + prompt)); +} + +/** + * _gsecret_gen_service_complete_search_items: + * @object: A #GSecretGenService. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @unlocked: Parameter to return. + * @locked: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the SearchItems() D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +_gsecret_gen_service_complete_search_items ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *const *unlocked, + const gchar *const *locked) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao^ao)", + unlocked, + locked)); +} + +/** + * _gsecret_gen_service_complete_unlock: + * @object: A #GSecretGenService. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @unlocked: Parameter to return. + * @prompt: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the Unlock() D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +_gsecret_gen_service_complete_unlock ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *const *unlocked, + const gchar *prompt) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^aoo)", + unlocked, + prompt)); +} + +/** + * _gsecret_gen_service_complete_lock: + * @object: A #GSecretGenService. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @locked: Parameter to return. + * @Prompt: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the Lock() D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +_gsecret_gen_service_complete_lock ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *const *locked, + const gchar *Prompt) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^aoo)", + locked, + Prompt)); +} + +/** + * _gsecret_gen_service_complete_get_secrets: + * @object: A #GSecretGenService. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @secrets: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the GetSecrets() D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +_gsecret_gen_service_complete_get_secrets ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + GVariant *secrets) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(@a{o(oayays)})", + secrets)); +} + +/** + * _gsecret_gen_service_complete_read_alias: + * @object: A #GSecretGenService. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @collection: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the ReadAlias() D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +_gsecret_gen_service_complete_read_alias ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *collection) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + collection)); +} + +/** + * _gsecret_gen_service_complete_set_alias: + * @object: A #GSecretGenService. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the SetAlias() D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +_gsecret_gen_service_complete_set_alias ( + GSecretGenService *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * GSecretGenServiceProxy: + * + * The #GSecretGenServiceProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * GSecretGenServiceProxyClass: + * @parent_class: The parent class. + * + * Class structure for #GSecretGenServiceProxy. + */ + +struct _GSecretGenServiceProxyPrivate +{ + GData *qdata; +}; + +static void _gsecret_gen_service_proxy_iface_init (GSecretGenServiceIface *iface); + +G_DEFINE_TYPE_WITH_CODE (GSecretGenServiceProxy, _gsecret_gen_service_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (GSECRET_GEN_TYPE_SERVICE, _gsecret_gen_service_proxy_iface_init)); + +static void +_gsecret_gen_service_proxy_finalize (GObject *object) +{ + GSecretGenServiceProxy *proxy = GSECRET_GEN_SERVICE_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (_gsecret_gen_service_proxy_parent_class)->finalize (object); +} + +static void +_gsecret_gen_service_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 1); + info = __gsecret_gen_service_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +_gsecret_gen_service_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + error = NULL; + if (!g_dbus_proxy_call_finish (proxy, res, &error)) + { + g_warning ("Error setting property `%s' on interface org.freedesktop.Secret.Service: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } +} + +static void +_gsecret_gen_service_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 1); + info = __gsecret_gen_service_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.freedesktop.Secret.Service", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) _gsecret_gen_service_proxy_set_property_cb, (gpointer) info); + g_variant_unref (variant); +} + +static void +_gsecret_gen_service_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &__gsecret_gen_service_interface_info, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], GSECRET_GEN_TYPE_SERVICE); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, GSECRET_GEN_TYPE_SERVICE); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +_gsecret_gen_service_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + GSecretGenServiceProxy *proxy = GSECRET_GEN_SERVICE_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &__gsecret_gen_service_interface_info, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &__gsecret_gen_service_interface_info, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static const gchar *const * +_gsecret_gen_service_proxy_get_collections (GSecretGenService *object) +{ + GSecretGenServiceProxy *proxy = GSECRET_GEN_SERVICE_PROXY (object); + GVariant *variant; + const gchar *const *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Collections"); + if (variant != NULL) + { + value = g_variant_get_objv (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static void +_gsecret_gen_service_proxy_init (GSecretGenServiceProxy *proxy) +{ + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GSECRET_GEN_TYPE_SERVICE_PROXY, GSecretGenServiceProxyPrivate); + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), _gsecret_gen_service_interface_info ()); +} + +static void +_gsecret_gen_service_proxy_class_init (GSecretGenServiceProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + g_type_class_add_private (klass, sizeof (GSecretGenServiceProxyPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = _gsecret_gen_service_proxy_finalize; + gobject_class->get_property = _gsecret_gen_service_proxy_get_property; + gobject_class->set_property = _gsecret_gen_service_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = _gsecret_gen_service_proxy_g_signal; + proxy_class->g_properties_changed = _gsecret_gen_service_proxy_g_properties_changed; + + + _gsecret_gen_service_override_properties (gobject_class, 1); +} + +static void +_gsecret_gen_service_proxy_iface_init (GSecretGenServiceIface *iface) +{ + iface->get_collections = _gsecret_gen_service_proxy_get_collections; +} + +/** + * _gsecret_gen_service_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.freedesktop.Secret.Service. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_proxy_new_finish() to get the result of the operation. + * + * See _gsecret_gen_service_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +_gsecret_gen_service_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (GSECRET_GEN_TYPE_SERVICE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Secret.Service", NULL); +} + +/** + * _gsecret_gen_service_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with _gsecret_gen_service_proxy_new(). + * + * Returns: (transfer full) (type GSecretGenServiceProxy): The constructed proxy object or %NULL if @error is set. + */ +GSecretGenService * +_gsecret_gen_service_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return GSECRET_GEN_SERVICE (ret); + else + return NULL; +} + +/** + * _gsecret_gen_service_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.freedesktop.Secret.Service. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type GSecretGenServiceProxy): The constructed proxy object or %NULL if @error is set. + */ +GSecretGenService * +_gsecret_gen_service_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (GSECRET_GEN_TYPE_SERVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Secret.Service", NULL); + if (ret != NULL) + return GSECRET_GEN_SERVICE (ret); + else + return NULL; +} + + +/** + * _gsecret_gen_service_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like _gsecret_gen_service_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call _gsecret_gen_service_proxy_new_for_bus_finish() to get the result of the operation. + * + * See _gsecret_gen_service_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +_gsecret_gen_service_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (GSECRET_GEN_TYPE_SERVICE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Secret.Service", NULL); +} + +/** + * _gsecret_gen_service_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to _gsecret_gen_service_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with _gsecret_gen_service_proxy_new_for_bus(). + * + * Returns: (transfer full) (type GSecretGenServiceProxy): The constructed proxy object or %NULL if @error is set. + */ +GSecretGenService * +_gsecret_gen_service_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return GSECRET_GEN_SERVICE (ret); + else + return NULL; +} + +/** + * _gsecret_gen_service_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like _gsecret_gen_service_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See _gsecret_gen_service_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type GSecretGenServiceProxy): The constructed proxy object or %NULL if @error is set. + */ +GSecretGenService * +_gsecret_gen_service_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (GSECRET_GEN_TYPE_SERVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Secret.Service", NULL); + if (ret != NULL) + return GSECRET_GEN_SERVICE (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * GSecretGenServiceSkeleton: + * + * The #GSecretGenServiceSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * GSecretGenServiceSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #GSecretGenServiceSkeleton. + */ + +struct _GSecretGenServiceSkeletonPrivate +{ + GValueArray *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex *lock; +}; + +static void +__gsecret_gen_service_skeleton_handle_method_call ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = {0}; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], GSECRET_GEN_TYPE_SERVICE); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, GSECRET_GEN_TYPE_SERVICE); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +__gsecret_gen_service_skeleton_handle_get_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (user_data); + GValue value = {0}; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &__gsecret_gen_service_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +__gsecret_gen_service_skeleton_handle_set_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (user_data); + GValue value = {0}; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &__gsecret_gen_service_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable __gsecret_gen_service_skeleton_vtable = +{ + __gsecret_gen_service_skeleton_handle_method_call, + __gsecret_gen_service_skeleton_handle_get_property, + __gsecret_gen_service_skeleton_handle_set_property +}; + +static GDBusInterfaceInfo * +_gsecret_gen_service_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton) +{ + return _gsecret_gen_service_interface_info (); +} + +static GDBusInterfaceVTable * +_gsecret_gen_service_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton) +{ + return (GDBusInterfaceVTable *) &__gsecret_gen_service_skeleton_vtable; +} + +static GVariant * +_gsecret_gen_service_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (__gsecret_gen_service_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; __gsecret_gen_service_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = __gsecret_gen_service_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = __gsecret_gen_service_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Secret.Service", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean __gsecret_gen_service_emit_changed (gpointer user_data); + +static void +_gsecret_gen_service_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (skeleton->priv->lock); + + if (emit_changed) + __gsecret_gen_service_emit_changed (skeleton); +} + +static void +__gsecret_gen_service_on_signal_collection_created ( + GSecretGenService *object, + const gchar *arg_collection) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (object); + GDBusConnection *connection = g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)); + if (connection == NULL) + return; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Secret.Service", "CollectionCreated", + g_variant_new ("(o)", + arg_collection), NULL); +} + +static void +__gsecret_gen_service_on_signal_collection_deleted ( + GSecretGenService *object, + const gchar *arg_collection) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (object); + GDBusConnection *connection = g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)); + if (connection == NULL) + return; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Secret.Service", "CollectionDeleted", + g_variant_new ("(o)", + arg_collection), NULL); +} + +static void +__gsecret_gen_service_on_signal_collection_changed ( + GSecretGenService *object, + const gchar *arg_collection) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (object); + GDBusConnection *connection = g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)); + if (connection == NULL) + return; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Secret.Service", "CollectionChanged", + g_variant_new ("(o)", + arg_collection), NULL); +} + +static void _gsecret_gen_service_skeleton_iface_init (GSecretGenServiceIface *iface); +G_DEFINE_TYPE_WITH_CODE (GSecretGenServiceSkeleton, _gsecret_gen_service_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (GSECRET_GEN_TYPE_SERVICE, _gsecret_gen_service_skeleton_iface_init)); + +static void +_gsecret_gen_service_skeleton_finalize (GObject *object) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (object); + g_value_array_free (skeleton->priv->properties); + g_list_foreach (skeleton->priv->changed_properties, (GFunc) _changed_property_free, NULL); + g_list_free (skeleton->priv->changed_properties); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + if (skeleton->priv->context != NULL) + g_main_context_unref (skeleton->priv->context); + g_mutex_free (skeleton->priv->lock); + G_OBJECT_CLASS (_gsecret_gen_service_skeleton_parent_class)->finalize (object); +} + +static void +_gsecret_gen_service_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 1); + g_mutex_lock (skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties->values[prop_id - 1], value); + g_mutex_unlock (skeleton->priv->lock); +} + +static gboolean +__gsecret_gen_service_emit_changed (gpointer user_data) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties->values[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + g_dbus_connection_emit_signal (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + g_variant_new ("(sa{sv}as)", + "org.freedesktop.Secret.Service", + &builder, &invalidated_builder), + NULL); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_foreach (skeleton->priv->changed_properties, (GFunc) _changed_property_free, NULL); + g_list_free (skeleton->priv->changed_properties); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (skeleton->priv->lock); + return FALSE; +} + +static void +__gsecret_gen_service_schedule_emit_changed (GSecretGenServiceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +_gsecret_gen_service_skeleton_notify (GObject *object, + GParamSpec *pspec) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (object); + g_mutex_lock (skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, __gsecret_gen_service_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (skeleton->priv->lock); +} + +static void +_gsecret_gen_service_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 1); + g_mutex_lock (skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties->values[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + __gsecret_gen_service_schedule_emit_changed (skeleton, __gsecret_gen_service_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties->values[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties->values[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +_gsecret_gen_service_skeleton_init (GSecretGenServiceSkeleton *skeleton) +{ + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GSECRET_GEN_TYPE_SERVICE_SKELETON, GSecretGenServiceSkeletonPrivate); + skeleton->priv->lock = g_mutex_new (); + skeleton->priv->context = g_main_context_get_thread_default (); + if (skeleton->priv->context != NULL) + g_main_context_ref (skeleton->priv->context); + skeleton->priv->properties = g_value_array_new (1); + g_value_array_append (skeleton->priv->properties, NULL); + g_value_init (&skeleton->priv->properties->values[0], G_TYPE_STRV); +} + +static const gchar *const * +_gsecret_gen_service_skeleton_get_collections (GSecretGenService *object) +{ + GSecretGenServiceSkeleton *skeleton = GSECRET_GEN_SERVICE_SKELETON (object); + const gchar *const *value; + g_mutex_lock (skeleton->priv->lock); + value = g_value_get_boxed (&(skeleton->priv->properties->values[0])); + g_mutex_unlock (skeleton->priv->lock); + return value; +} + +static void +_gsecret_gen_service_skeleton_class_init (GSecretGenServiceSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + g_type_class_add_private (klass, sizeof (GSecretGenServiceSkeletonPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = _gsecret_gen_service_skeleton_finalize; + gobject_class->get_property = _gsecret_gen_service_skeleton_get_property; + gobject_class->set_property = _gsecret_gen_service_skeleton_set_property; + gobject_class->notify = _gsecret_gen_service_skeleton_notify; + + + _gsecret_gen_service_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = _gsecret_gen_service_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = _gsecret_gen_service_skeleton_dbus_interface_get_properties; + skeleton_class->flush = _gsecret_gen_service_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = _gsecret_gen_service_skeleton_dbus_interface_get_vtable; +} + +static void +_gsecret_gen_service_skeleton_iface_init (GSecretGenServiceIface *iface) +{ + iface->collection_created = __gsecret_gen_service_on_signal_collection_created; + iface->collection_deleted = __gsecret_gen_service_on_signal_collection_deleted; + iface->collection_changed = __gsecret_gen_service_on_signal_collection_changed; + iface->get_collections = _gsecret_gen_service_skeleton_get_collections; +} + +/** + * _gsecret_gen_service_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.freedesktop.Secret.Service. + * + * Returns: (transfer full) (type GSecretGenServiceSkeleton): The skeleton object. + */ +GSecretGenService * +_gsecret_gen_service_skeleton_new (void) +{ + return GSECRET_GEN_SERVICE (g_object_new (GSECRET_GEN_TYPE_SERVICE_SKELETON, NULL)); +} + diff --git a/library/gsecret-dbus-generated.h b/library/gsecret-dbus-generated.h new file mode 100644 index 0000000..edbacb8 --- /dev/null +++ b/library/gsecret-dbus-generated.h @@ -0,0 +1,444 @@ +/* + * Generated by gdbus-codegen 2.30.1. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __GSECRET_DBUS_GENERATED_H__ +#define __GSECRET_DBUS_GENERATED_H__ + +#include + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.Secret.Service */ + +#define GSECRET_GEN_TYPE_SERVICE (_gsecret_gen_service_get_type ()) +#define GSECRET_GEN_SERVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSECRET_GEN_TYPE_SERVICE, GSecretGenService)) +#define GSECRET_GEN_IS_SERVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSECRET_GEN_TYPE_SERVICE)) +#define GSECRET_GEN_SERVICE_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), GSECRET_GEN_TYPE_SERVICE, GSecretGenServiceIface)) + +struct _GSecretGenService; +typedef struct _GSecretGenService GSecretGenService; +typedef struct _GSecretGenServiceIface GSecretGenServiceIface; + +struct _GSecretGenServiceIface +{ + GTypeInterface parent_iface; + + + + gboolean (*handle_create_collection) ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + GVariant *arg_properties, + const gchar *arg_alias); + + gboolean (*handle_get_secrets) ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *const *arg_items, + const gchar *arg_session); + + gboolean (*handle_lock) ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *const *arg_objects); + + gboolean (*handle_open_session) ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *arg_algorithm, + GVariant *arg_input); + + gboolean (*handle_read_alias) ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *arg_name); + + gboolean (*handle_search_items) ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + GVariant *arg_attributes); + + gboolean (*handle_set_alias) ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *arg_name, + const gchar *arg_collection); + + gboolean (*handle_unlock) ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *const *arg_objects); + + const gchar *const * (*get_collections) (GSecretGenService *object); + + void (*collection_changed) ( + GSecretGenService *object, + const gchar *arg_collection); + + void (*collection_created) ( + GSecretGenService *object, + const gchar *arg_collection); + + void (*collection_deleted) ( + GSecretGenService *object, + const gchar *arg_collection); + +}; + +GType _gsecret_gen_service_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *_gsecret_gen_service_interface_info (void); +guint _gsecret_gen_service_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void _gsecret_gen_service_complete_open_session ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + GVariant *output, + const gchar *result); + +void _gsecret_gen_service_complete_create_collection ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *collection, + const gchar *prompt); + +void _gsecret_gen_service_complete_search_items ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *const *unlocked, + const gchar *const *locked); + +void _gsecret_gen_service_complete_unlock ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *const *unlocked, + const gchar *prompt); + +void _gsecret_gen_service_complete_lock ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *const *locked, + const gchar *Prompt); + +void _gsecret_gen_service_complete_get_secrets ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + GVariant *secrets); + +void _gsecret_gen_service_complete_read_alias ( + GSecretGenService *object, + GDBusMethodInvocation *invocation, + const gchar *collection); + +void _gsecret_gen_service_complete_set_alias ( + GSecretGenService *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus signal emissions functions: */ +void _gsecret_gen_service_emit_collection_created ( + GSecretGenService *object, + const gchar *arg_collection); + +void _gsecret_gen_service_emit_collection_deleted ( + GSecretGenService *object, + const gchar *arg_collection); + +void _gsecret_gen_service_emit_collection_changed ( + GSecretGenService *object, + const gchar *arg_collection); + + + +/* D-Bus method calls: */ +void _gsecret_gen_service_call_open_session ( + GSecretGenService *proxy, + const gchar *arg_algorithm, + GVariant *arg_input, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean _gsecret_gen_service_call_open_session_finish ( + GSecretGenService *proxy, + GVariant **out_output, + gchar **out_result, + GAsyncResult *res, + GError **error); + +gboolean _gsecret_gen_service_call_open_session_sync ( + GSecretGenService *proxy, + const gchar *arg_algorithm, + GVariant *arg_input, + GVariant **out_output, + gchar **out_result, + GCancellable *cancellable, + GError **error); + +void _gsecret_gen_service_call_create_collection ( + GSecretGenService *proxy, + GVariant *arg_properties, + const gchar *arg_alias, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean _gsecret_gen_service_call_create_collection_finish ( + GSecretGenService *proxy, + gchar **out_collection, + gchar **out_prompt, + GAsyncResult *res, + GError **error); + +gboolean _gsecret_gen_service_call_create_collection_sync ( + GSecretGenService *proxy, + GVariant *arg_properties, + const gchar *arg_alias, + gchar **out_collection, + gchar **out_prompt, + GCancellable *cancellable, + GError **error); + +void _gsecret_gen_service_call_search_items ( + GSecretGenService *proxy, + GVariant *arg_attributes, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean _gsecret_gen_service_call_search_items_finish ( + GSecretGenService *proxy, + gchar ***out_unlocked, + gchar ***out_locked, + GAsyncResult *res, + GError **error); + +gboolean _gsecret_gen_service_call_search_items_sync ( + GSecretGenService *proxy, + GVariant *arg_attributes, + gchar ***out_unlocked, + gchar ***out_locked, + GCancellable *cancellable, + GError **error); + +void _gsecret_gen_service_call_unlock ( + GSecretGenService *proxy, + const gchar *const *arg_objects, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean _gsecret_gen_service_call_unlock_finish ( + GSecretGenService *proxy, + gchar ***out_unlocked, + gchar **out_prompt, + GAsyncResult *res, + GError **error); + +gboolean _gsecret_gen_service_call_unlock_sync ( + GSecretGenService *proxy, + const gchar *const *arg_objects, + gchar ***out_unlocked, + gchar **out_prompt, + GCancellable *cancellable, + GError **error); + +void _gsecret_gen_service_call_lock ( + GSecretGenService *proxy, + const gchar *const *arg_objects, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean _gsecret_gen_service_call_lock_finish ( + GSecretGenService *proxy, + gchar ***out_locked, + gchar **out_Prompt, + GAsyncResult *res, + GError **error); + +gboolean _gsecret_gen_service_call_lock_sync ( + GSecretGenService *proxy, + const gchar *const *arg_objects, + gchar ***out_locked, + gchar **out_Prompt, + GCancellable *cancellable, + GError **error); + +void _gsecret_gen_service_call_get_secrets ( + GSecretGenService *proxy, + const gchar *const *arg_items, + const gchar *arg_session, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean _gsecret_gen_service_call_get_secrets_finish ( + GSecretGenService *proxy, + GVariant **out_secrets, + GAsyncResult *res, + GError **error); + +gboolean _gsecret_gen_service_call_get_secrets_sync ( + GSecretGenService *proxy, + const gchar *const *arg_items, + const gchar *arg_session, + GVariant **out_secrets, + GCancellable *cancellable, + GError **error); + +void _gsecret_gen_service_call_read_alias ( + GSecretGenService *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean _gsecret_gen_service_call_read_alias_finish ( + GSecretGenService *proxy, + gchar **out_collection, + GAsyncResult *res, + GError **error); + +gboolean _gsecret_gen_service_call_read_alias_sync ( + GSecretGenService *proxy, + const gchar *arg_name, + gchar **out_collection, + GCancellable *cancellable, + GError **error); + +void _gsecret_gen_service_call_set_alias ( + GSecretGenService *proxy, + const gchar *arg_name, + const gchar *arg_collection, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean _gsecret_gen_service_call_set_alias_finish ( + GSecretGenService *proxy, + GAsyncResult *res, + GError **error); + +gboolean _gsecret_gen_service_call_set_alias_sync ( + GSecretGenService *proxy, + const gchar *arg_name, + const gchar *arg_collection, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +const gchar *const *_gsecret_gen_service_get_collections (GSecretGenService *object); +gchar **_gsecret_gen_service_dup_collections (GSecretGenService *object); +void _gsecret_gen_service_set_collections (GSecretGenService *object, const gchar *const *value); + + +/* ---- */ + +#define GSECRET_GEN_TYPE_SERVICE_PROXY (_gsecret_gen_service_proxy_get_type ()) +#define GSECRET_GEN_SERVICE_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSECRET_GEN_TYPE_SERVICE_PROXY, GSecretGenServiceProxy)) +#define GSECRET_GEN_SERVICE_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSECRET_GEN_TYPE_SERVICE_PROXY, GSecretGenServiceProxyClass)) +#define GSECRET_GEN_SERVICE_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSECRET_GEN_TYPE_SERVICE_PROXY, GSecretGenServiceProxyClass)) +#define GSECRET_GEN_IS_SERVICE_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSECRET_GEN_TYPE_SERVICE_PROXY)) +#define GSECRET_GEN_IS_SERVICE_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSECRET_GEN_TYPE_SERVICE_PROXY)) + +typedef struct _GSecretGenServiceProxy GSecretGenServiceProxy; +typedef struct _GSecretGenServiceProxyClass GSecretGenServiceProxyClass; +typedef struct _GSecretGenServiceProxyPrivate GSecretGenServiceProxyPrivate; + +struct _GSecretGenServiceProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + GSecretGenServiceProxyPrivate *priv; +}; + +struct _GSecretGenServiceProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType _gsecret_gen_service_proxy_get_type (void) G_GNUC_CONST; + +void _gsecret_gen_service_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GSecretGenService *_gsecret_gen_service_proxy_new_finish ( + GAsyncResult *res, + GError **error); +GSecretGenService *_gsecret_gen_service_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void _gsecret_gen_service_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GSecretGenService *_gsecret_gen_service_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +GSecretGenService *_gsecret_gen_service_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define GSECRET_GEN_TYPE_SERVICE_SKELETON (_gsecret_gen_service_skeleton_get_type ()) +#define GSECRET_GEN_SERVICE_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSECRET_GEN_TYPE_SERVICE_SKELETON, GSecretGenServiceSkeleton)) +#define GSECRET_GEN_SERVICE_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSECRET_GEN_TYPE_SERVICE_SKELETON, GSecretGenServiceSkeletonClass)) +#define GSECRET_GEN_SERVICE_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSECRET_GEN_TYPE_SERVICE_SKELETON, GSecretGenServiceSkeletonClass)) +#define GSECRET_GEN_IS_SERVICE_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSECRET_GEN_TYPE_SERVICE_SKELETON)) +#define GSECRET_GEN_IS_SERVICE_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSECRET_GEN_TYPE_SERVICE_SKELETON)) + +typedef struct _GSecretGenServiceSkeleton GSecretGenServiceSkeleton; +typedef struct _GSecretGenServiceSkeletonClass GSecretGenServiceSkeletonClass; +typedef struct _GSecretGenServiceSkeletonPrivate GSecretGenServiceSkeletonPrivate; + +struct _GSecretGenServiceSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + GSecretGenServiceSkeletonPrivate *priv; +}; + +struct _GSecretGenServiceSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType _gsecret_gen_service_skeleton_get_type (void) G_GNUC_CONST; + +GSecretGenService *_gsecret_gen_service_skeleton_new (void); + + +G_END_DECLS + +#endif /* __GSECRET_DBUS_GENERATED_H__ */ diff --git a/library/gsecret-service.c b/library/gsecret-service.c index 35cf5f5..79054df 100644 --- a/library/gsecret-service.c +++ b/library/gsecret-service.c @@ -12,6 +12,7 @@ #include "config.h" +#include "gsecret-dbus-generated.h" #include "gsecret-private.h" #include "gsecret-service.h" #include "gsecret-types.h" @@ -130,7 +131,7 @@ _gsecret_service_bare_instance (GDBusConnection *connection, service = g_initable_new (GSECRET_TYPE_SERVICE, NULL, &error, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, - "g-interface-info", NULL, /* TODO: */ + "g-interface-info", _gsecret_gen_service_interface_info (), "g-name", bus_name, "g-connection", connection, "g-object-path", GSECRET_SERVICE_PATH, @@ -867,3 +868,134 @@ _gsecret_service_encode_secret (GSecretService *self, g_variant_type_free (type); return result; } + +static GVariant * +_gsecret_util_variant_for_attributes (GHashTable *attributes) +{ + GHashTableIter iter; + GVariantBuilder builder; + const gchar *name; + const gchar *value; + + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ssv)")); + + g_hash_table_iter_init (&iter, attributes); + while (g_hash_table_iter_next (&iter, (gpointer *)&name, (gpointer *)&value)) + g_variant_builder_add (&builder, "(ss)", name, value); + + return g_variant_builder_end (&builder); + +} + +static void +on_search_items_complete (GObject *source, + GAsyncResult *result, + gpointer user_data) +{ + GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); + GError *error = NULL; + GVariant *response; + + response = g_dbus_proxy_call_finish (G_DBUS_PROXY (source), result, &error); + if (error != NULL) + g_simple_async_result_take_error (res, error); + else + g_simple_async_result_set_op_res_gpointer (res, response, + (GDestroyNotify)g_variant_unref); + + g_simple_async_result_complete (res); + g_object_unref (res); +} + +void +gsecret_service_search_paths (GSecretService *self, + GHashTable *attributes, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GSimpleAsyncResult *res; + + g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (attributes != NULL); + g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); + + res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, + gsecret_service_search_paths); + + g_dbus_proxy_call (G_DBUS_PROXY (self), "SearchItems", + _gsecret_util_variant_for_attributes (attributes), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, + on_search_items_complete, g_object_ref (res)); + + g_object_unref (res); +} + +gboolean +gsecret_service_search_paths_finish (GSecretService *self, + GAsyncResult *result, + gchar ***unlocked, + gchar ***locked, + GError **error) +{ + GVariant *response; + GSimpleAsyncResult *res; + gchar **dummy = NULL; + + g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), + gsecret_service_search_paths), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + res = G_SIMPLE_ASYNC_RESULT (result); + if (g_simple_async_result_propagate_error (res, error)) + return FALSE; + + if (unlocked || locked) { + if (!unlocked) + unlocked = &dummy; + else if (!locked) + locked = &dummy; + response = g_simple_async_result_get_op_res_gpointer (res); + g_variant_get (response, "(^ao^ao)", unlocked, locked); + } + + g_strfreev (dummy); + return TRUE; +} + +gboolean +gsecret_service_search_paths_sync (GSecretService *self, + GHashTable *attributes, + GCancellable *cancellable, + gchar ***unlocked, + gchar ***locked, + GError **error) +{ + gchar **dummy = NULL; + GVariant *response; + + g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (attributes != NULL, FALSE); + g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + response = g_dbus_proxy_call_sync (G_DBUS_PROXY (self), "SearchItems", + _gsecret_util_variant_for_attributes (attributes), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + + if (response != NULL) { + if (unlocked || locked) { + if (!unlocked) + unlocked = &dummy; + else if (!locked) + locked = &dummy; + g_variant_get (response, "(^ao^ao)", unlocked, locked); + } + + g_variant_unref (response); + } + + g_strfreev (dummy); + + return response != NULL; +} diff --git a/library/gsecret-service.h b/library/gsecret-service.h index 5f8ec25..6ec832c 100644 --- a/library/gsecret-service.h +++ b/library/gsecret-service.h @@ -108,26 +108,28 @@ gboolean gsecret_service_search_sync (GSecretService *se GList **unlocked, GList **locked, GError **error); +#endif -void gsecret_service_search_for_paths (GSecretService *self, +void gsecret_service_search_paths (GSecretService *self, GHashTable *attributes, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); -gboolean gsecret_service_search_for_paths_finish (GSecretService *self, +gboolean gsecret_service_search_paths_finish (GSecretService *self, GAsyncResult *result, gchar ***unlocked, gchar ***locked, GError **error); -gboolean gsecret_service_search_for_paths_sync (GSecretService *self, +gboolean gsecret_service_search_paths_sync (GSecretService *self, GHashTable *attributes, GCancellable *cancellable, gchar ***unlocked, gchar ***locked, GError **error); +#if 0 void gsecret_service_lock (GSecretService *self, GList *objects, GCancellable *cancellable, diff --git a/library/org.freedesktop.Secrets.xml b/library/org.freedesktop.Secrets.xml new file mode 100644 index 0000000..f9749f8 --- /dev/null +++ b/library/org.freedesktop.Secrets.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/po/gsecret.pot b/po/gsecret.pot index 35d950b..86c4211 100644 --- a/po/gsecret.pot +++ b/po/gsecret.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-09-25 22:56+0200\n" +"POT-Creation-Date: 2011-11-05 20:58+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -22,8 +22,8 @@ msgstr "" msgid "Received invalid secret from the secret storage" msgstr "" -#: ../library/gsecret-service.c:343 ../library/gsecret-service.c:383 -#: ../library/gsecret-service.c:543 +#: ../library/gsecret-service.c:344 ../library/gsecret-service.c:384 +#: ../library/gsecret-service.c:544 #, c-format msgid "Couldn't communicate with the secret storage" msgstr ""