GVariant *retval;
gchar *path;
- retval = secret_service_prompt_finish (self, result, G_VARIANT_TYPE ("ao"), &error);
+ retval = secret_service_prompt_finish (self, result, &error);
if (error != NULL)
g_simple_async_result_take_error (res, error);
} else {
closure->prompt = _secret_prompt_instance (self, prompt);
- secret_service_prompt (self, closure->prompt, closure->cancellable,
- on_xlock_prompted, g_object_ref (res));
+ secret_service_prompt (self, closure->prompt, G_VARIANT_TYPE ("ao"),
+ closure->cancellable, on_xlock_prompted, g_object_ref (res));
}
g_strfreev (xlocked);
GVariant *retval;
retval = secret_service_prompt_finish (SECRET_SERVICE (source), result,
- NULL, &error);
+ &error);
if (error == NULL)
closure->deleted = TRUE;
} else {
closure->prompt = _secret_prompt_instance (self, prompt_path);
- secret_service_prompt (self, closure->prompt,
+ secret_service_prompt (self, closure->prompt, NULL,
closure->cancellable,
on_delete_prompted,
g_object_ref (res));
GError *error = NULL;
GVariant *value;
- value = secret_service_prompt_finish (SECRET_SERVICE (source), result,
- G_VARIANT_TYPE ("o"), &error);
+ value = secret_service_prompt_finish (SECRET_SERVICE (source), result, &error);
if (error != NULL)
g_simple_async_result_take_error (res, error);
if (value != NULL) {
g_variant_get (retval, "(&o&o)", &collection_path, &prompt_path);
if (!_secret_util_empty_path (prompt_path)) {
closure->prompt = _secret_prompt_instance (self, prompt_path);
- secret_service_prompt (self, closure->prompt,
+ secret_service_prompt (self, closure->prompt, G_VARIANT_TYPE ("o"),
closure->cancellable, on_create_collection_prompt,
g_object_ref (res));
GError *error = NULL;
GVariant *value;
- value = secret_service_prompt_finish (SECRET_SERVICE (source), result,
- G_VARIANT_TYPE ("o"), &error);
+ value = secret_service_prompt_finish (SECRET_SERVICE (source), result, &error);
if (error != NULL)
g_simple_async_result_take_error (res, error);
if (value != NULL) {
g_variant_get (retval, "(&o&o)", &item_path, &prompt_path);
if (!_secret_util_empty_path (prompt_path)) {
closure->prompt = _secret_prompt_instance (self, prompt_path);
- secret_service_prompt (self, closure->prompt,
+ secret_service_prompt (self, closure->prompt, G_VARIANT_TYPE ("o"),
closure->cancellable, on_create_item_prompt,
g_object_ref (res));
* secret_service_prompt_at_dbus_path:
* @self: the secret service
* @prompt_path: the D-Bus object path of the prompt
+ * @return_type: (allow-none): the variant type of the prompt result
* @cancellable: optional cancellation object
* @callback: called when the operation completes
* @user_data: data to be passed to the callback
void
secret_service_prompt_at_dbus_path (SecretService *self,
const gchar *prompt_path,
+ const GVariantType *return_type,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
prompt = _secret_prompt_instance (self, prompt_path);
- secret_service_prompt (self, prompt, cancellable, callback, user_data);
+ secret_service_prompt (self, prompt, return_type, cancellable, callback, user_data);
g_object_unref (prompt);
}
* secret_service_prompt_at_dbus_path_finish:
* @self: the secret service
* @result: the asynchronous result passed to the callback
- * @return_type: the variant type of the prompt result
* @error: location to place an error on failure
*
* Complete asynchronous operation to perform prompting for a #SecretPrompt.
GVariant *
secret_service_prompt_at_dbus_path_finish (SecretService *self,
GAsyncResult *result,
- const GVariantType *return_type,
GError **error)
{
g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- return secret_service_prompt_finish (self, result, return_type, error);
+ return secret_service_prompt_finish (self, result, error);
}
void secret_service_prompt_at_dbus_path (SecretService *self,
const gchar *prompt_path,
+ const GVariantType *return_type,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GVariant * secret_service_prompt_at_dbus_path_finish (SecretService *self,
GAsyncResult *result,
- const GVariantType *return_type,
GError **error);
void secret_service_delete_item_dbus_path (SecretService *self,
closure = g_new0 (RunClosure, 1);
closure->loop = g_main_loop_new (context, FALSE);
- secret_prompt_perform (self, window_id, cancellable,
+ secret_prompt_perform (self, window_id, return_type, cancellable,
on_prompt_run_complete, closure);
g_main_loop_run (closure->loop);
- retval = secret_prompt_perform_finish (self, closure->result, return_type, error);
+ retval = secret_prompt_perform_finish (self, closure->result, error);
g_main_loop_unref (closure->loop);
g_object_unref (closure->result);
GVariant *result;
guint signal;
guint watch;
+ GVariantType *return_type;
} PerformClosure;
static void
g_object_unref (closure->connection);
if (closure->result)
g_variant_unref (closure->result);
+ if (closure->return_type)
+ g_variant_type_free (closure->return_type);
g_assert (closure->signal == 0);
g_assert (closure->watch == 0);
g_slice_free (PerformClosure, closure);
* secret_prompt_perform:
* @self: a prompt
* @window_id: XWindow id for parent window to be transient for
+ * @return_type: the variant type of the prompt result
* @cancellable: optional cancellation object
* @callback: called when the operation completes
* @user_data: data to be passed to the callback
void
secret_prompt_perform (SecretPrompt *self,
gulong window_id,
+ const GVariantType *return_type,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
closure->connection = g_object_ref (g_dbus_proxy_get_connection (proxy));
closure->call_cancellable = g_cancellable_new ();
closure->async_cancellable = cancellable ? g_object_ref (cancellable) : NULL;
+ closure->return_type = return_type ? g_variant_type_copy (return_type) : NULL;
g_simple_async_result_set_op_res_gpointer (res, closure, perform_closure_free);
if (window_id == 0)
* secret_prompt_perform_finish:
* @self: a prompt
* @result: the asynchronous result passed to the callback
- * @return_type: the variant type of the prompt result
* @error: location to place an error on failure
*
* Complete asynchronous operation to run a prompt and perform the prompting.
GVariant *
secret_prompt_perform_finish (SecretPrompt *self,
GAsyncResult *result,
- const GVariantType *return_type,
GError **error)
{
PerformClosure *closure;
closure = g_simple_async_result_get_op_res_gpointer (res);
if (closure->result == NULL)
return NULL;
- if (return_type != NULL && !g_variant_is_of_type (closure->result, return_type)) {
- string = g_variant_type_dup_string (return_type);
+ if (closure->return_type != NULL && !g_variant_is_of_type (closure->result, closure->return_type)) {
+ string = g_variant_type_dup_string (closure->return_type);
g_warning ("received unexpected result type %s from Completed signal instead of expected %s",
g_variant_get_type_string (closure->result), string);
g_free (string);
void secret_prompt_perform (SecretPrompt *self,
gulong window_id,
+ const GVariantType *return_type,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GVariant * secret_prompt_perform_finish (SecretPrompt *self,
GAsyncResult *result,
- const GVariantType *return_type,
GError **error);
G_END_DECLS
GError *error = NULL;
GVariant *retval;
- retval = secret_prompt_perform_finish (SECRET_PROMPT (source), result, NULL, &error);
+ retval = secret_prompt_perform_finish (SECRET_PROMPT (source), result, &error);
if (retval != NULL)
g_simple_async_result_set_op_res_gpointer (res, retval, (GDestroyNotify)g_variant_unref);
if (error != NULL)
static void
secret_service_real_prompt_async (SecretService *self,
SecretPrompt *prompt,
+ const GVariantType *return_type,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
secret_service_real_prompt_async);
- secret_prompt_perform (prompt, 0, cancellable,
+ secret_prompt_perform (prompt, 0, return_type, cancellable,
on_real_prompt_completed,
g_object_ref (res));
static GVariant *
secret_service_real_prompt_finish (SecretService *self,
GAsyncResult *result,
- const GVariantType *return_type,
GError **error)
{
GSimpleAsyncResult *res;
GVariant *retval;
- gchar *string;
g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self),
secret_service_real_prompt_async), NULL);
if (retval == NULL)
return NULL;
- if (return_type != NULL && !g_variant_is_of_type (retval, return_type)) {
- string = g_variant_type_dup_string (return_type);
- g_warning ("received unexpected result type %s from prompt's Completed signal instead of expected %s",
- g_variant_get_type_string (retval), string);
- g_free (string);
- return NULL;
- }
-
return g_variant_ref (retval);
}
* secret_service_prompt:
* @self: the secret service
* @prompt: the prompt
+ * @return_type: (allow-none): the variant type of the prompt result
* @cancellable: optional cancellation object
* @callback: called when the operation completes
* @user_data: data to be passed to the callback
void
secret_service_prompt (SecretService *self,
SecretPrompt *prompt,
+ const GVariantType *return_type,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
klass = SECRET_SERVICE_GET_CLASS (self);
g_return_if_fail (klass->prompt_async != NULL);
- (klass->prompt_async) (self, prompt, cancellable, callback, user_data);
+ (klass->prompt_async) (self, prompt, return_type, cancellable, callback, user_data);
}
/**
* secret_service_prompt_finish:
* @self: the secret service
* @result: the asynchronous result passed to the callback
- * @return_type: the variant type of the prompt result
* @error: location to place an error on failure
*
* Complete asynchronous operation to perform prompting for a #SecretPrompt.
GVariant *
secret_service_prompt_finish (SecretService *self,
GAsyncResult *result,
- const GVariantType *return_type,
GError **error)
{
SecretServiceClass *klass;
klass = SECRET_SERVICE_GET_CLASS (self);
g_return_val_if_fail (klass->prompt_finish != NULL, NULL);
- return (klass->prompt_finish) (self, result, return_type, error);
+ return (klass->prompt_finish) (self, result, error);
}
/**
void (* prompt_async) (SecretService *self,
SecretPrompt *prompt,
+ const GVariantType *return_type,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GVariant * (* prompt_finish) (SecretService *self,
GAsyncResult *result,
- const GVariantType *return_type,
GError **error);
GType (* get_collection_gtype) (SecretService *self);
void secret_service_prompt (SecretService *self,
SecretPrompt *prompt,
+ const GVariantType *return_type,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GVariant * secret_service_prompt_finish (SecretService *self,
GAsyncResult *result,
- const GVariantType *return_type,
GError **error);
void secret_service_search (SecretService *service,
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
- secret_prompt_perform (prompt, 0, NULL, on_async_result, &result);
+ secret_prompt_perform (prompt, 0, NULL, NULL, on_async_result, &result);
g_assert (result == NULL);
egg_test_wait ();
- retval = secret_prompt_perform_finish (prompt, result, NULL, &error);
+ retval = secret_prompt_perform_finish (prompt, result, &error);
g_assert_no_error (error);
g_assert (retval != NULL);
g_variant_unref (retval);
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/delay");
cancellable = g_cancellable_new ();
- secret_prompt_perform (prompt, 0, cancellable, on_async_result, &result);
+ secret_prompt_perform (prompt, 0, NULL, cancellable, on_async_result, &result);
g_assert (result == NULL);
g_cancellable_cancel (cancellable);
egg_test_wait ();
- retval = secret_prompt_perform_finish (prompt, result, NULL, &error);
+ retval = secret_prompt_perform_finish (prompt, result, &error);
g_assert_no_error (error);
g_assert (retval != NULL);
g_variant_unref (retval);
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
- secret_service_prompt (test->service, prompt, NULL, on_async_result, &result);
+ secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result);
g_assert (result == NULL);
egg_test_wait ();
- retval = secret_service_prompt_finish (test->service, result, NULL, &error);
+ retval = secret_service_prompt_finish (test->service, result, &error);
g_assert_no_error (error);
g_assert (retval != NULL);
g_variant_unref (retval);
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/error");
- secret_service_prompt (test->service, prompt, NULL, on_async_result, &result);
+ secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result);
g_assert (result == NULL);
egg_test_wait ();
- retval = secret_service_prompt_finish (test->service, result, NULL, &error);
+ retval = secret_service_prompt_finish (test->service, result, &error);
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED);
g_assert (retval == NULL);
g_object_unref (result);
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
- secret_service_prompt (test->service, prompt, NULL, on_async_result, &result);
+ secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result);
g_assert (result == NULL);
g_object_unref (prompt);
egg_test_wait ();
- retval = secret_service_prompt_finish (test->service, result, NULL, &error);
+ retval = secret_service_prompt_finish (test->service, result, &error);
g_assert_no_error (error);
g_assert (retval != NULL);
g_variant_unref (retval);