mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 04:38:55 +00:00
Merge branch 'fix-deprecated' into 'master'
Fix deprecated-declarations warnings See merge request GNOME/libsecret!93
This commit is contained in:
commit
6f2255fd82
@ -67,9 +67,6 @@ SecretPrompt * _secret_prompt_instance (SecretService *se
|
|||||||
|
|
||||||
void _secret_util_strip_remote_error (GError **error);
|
void _secret_util_strip_remote_error (GError **error);
|
||||||
|
|
||||||
gboolean _secret_util_propagate_error (GSimpleAsyncResult *async,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gchar * _secret_util_parent_path (const gchar *path);
|
gchar * _secret_util_parent_path (const gchar *path);
|
||||||
|
|
||||||
gboolean _secret_util_empty_path (const gchar *path);
|
gboolean _secret_util_empty_path (const gchar *path);
|
||||||
|
@ -232,7 +232,6 @@ secret_prompt_perform_sync (SecretPrompt *self,
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
GCancellable *call_cancellable;
|
GCancellable *call_cancellable;
|
||||||
GCancellable *async_cancellable;
|
|
||||||
gulong cancelled_sig;
|
gulong cancelled_sig;
|
||||||
gboolean prompting;
|
gboolean prompting;
|
||||||
gboolean dismissed;
|
gboolean dismissed;
|
||||||
@ -249,7 +248,6 @@ perform_closure_free (gpointer data)
|
|||||||
{
|
{
|
||||||
PerformClosure *closure = data;
|
PerformClosure *closure = data;
|
||||||
g_object_unref (closure->call_cancellable);
|
g_object_unref (closure->call_cancellable);
|
||||||
g_clear_object (&closure->async_cancellable);
|
|
||||||
g_object_unref (closure->connection);
|
g_object_unref (closure->connection);
|
||||||
if (closure->result)
|
if (closure->result)
|
||||||
g_variant_unref (closure->result);
|
g_variant_unref (closure->result);
|
||||||
@ -261,11 +259,11 @@ perform_closure_free (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
perform_prompt_complete (GSimpleAsyncResult *res,
|
perform_prompt_complete (GTask *task,
|
||||||
gboolean dismissed)
|
gboolean dismissed)
|
||||||
{
|
{
|
||||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
PerformClosure *closure = g_task_get_task_data (task);
|
||||||
|
GCancellable *async_cancellable = g_task_get_cancellable (task);
|
||||||
closure->dismissed = dismissed;
|
closure->dismissed = dismissed;
|
||||||
if (closure->completed)
|
if (closure->completed)
|
||||||
return;
|
return;
|
||||||
@ -280,10 +278,8 @@ perform_prompt_complete (GSimpleAsyncResult *res,
|
|||||||
closure->watch = 0;
|
closure->watch = 0;
|
||||||
|
|
||||||
if (closure->cancelled_sig)
|
if (closure->cancelled_sig)
|
||||||
g_signal_handler_disconnect (closure->async_cancellable, closure->cancelled_sig);
|
g_signal_handler_disconnect (async_cancellable, closure->cancelled_sig);
|
||||||
closure->cancelled_sig = 0;
|
closure->cancelled_sig = 0;
|
||||||
|
|
||||||
g_simple_async_result_complete (res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -295,9 +291,8 @@ on_prompt_completed (GDBusConnection *connection,
|
|||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
GTask *task = G_TASK (user_data);
|
||||||
SecretPrompt *self = SECRET_PROMPT (g_async_result_get_source_object (user_data));
|
PerformClosure *closure = g_task_get_task_data (task);
|
||||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
|
||||||
gboolean dismissed;
|
gboolean dismissed;
|
||||||
|
|
||||||
closure->prompting = FALSE;
|
closure->prompting = FALSE;
|
||||||
@ -305,14 +300,14 @@ on_prompt_completed (GDBusConnection *connection,
|
|||||||
if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(bv)"))) {
|
if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(bv)"))) {
|
||||||
g_warning ("SecretPrompt received invalid %s signal of type %s",
|
g_warning ("SecretPrompt received invalid %s signal of type %s",
|
||||||
signal_name, g_variant_get_type_string (parameters));
|
signal_name, g_variant_get_type_string (parameters));
|
||||||
perform_prompt_complete (res, TRUE);
|
perform_prompt_complete (task, TRUE);
|
||||||
|
g_task_return_boolean (task, TRUE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
g_variant_get (parameters, "(bv)", &dismissed, &closure->result);
|
g_variant_get (parameters, "(bv)", &dismissed, &closure->result);
|
||||||
perform_prompt_complete (res, dismissed);
|
perform_prompt_complete (task, dismissed);
|
||||||
|
g_task_return_boolean (task, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -320,8 +315,8 @@ on_prompt_prompted (GObject *source,
|
|||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
GTask *task = G_TASK (user_data);
|
||||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
PerformClosure *closure = g_task_get_task_data (task);
|
||||||
SecretPrompt *self = SECRET_PROMPT (source);
|
SecretPrompt *self = SECRET_PROMPT (source);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
@ -334,8 +329,8 @@ on_prompt_prompted (GObject *source,
|
|||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
g_simple_async_result_take_error (res, error);
|
g_task_return_error (task, g_steal_pointer (&error));
|
||||||
perform_prompt_complete (res, TRUE);
|
perform_prompt_complete (task, TRUE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
closure->prompting = TRUE;
|
closure->prompting = TRUE;
|
||||||
@ -344,7 +339,7 @@ on_prompt_prompted (GObject *source,
|
|||||||
/* And now we wait for the signal */
|
/* And now we wait for the signal */
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (res);
|
g_clear_object (&task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -352,11 +347,12 @@ on_prompt_vanished (GDBusConnection *connection,
|
|||||||
const gchar *name,
|
const gchar *name,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
GTask *task = G_TASK (user_data);
|
||||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
PerformClosure *closure = g_task_get_task_data (task);
|
||||||
closure->vanished = TRUE;
|
closure->vanished = TRUE;
|
||||||
g_cancellable_cancel (closure->call_cancellable);
|
g_cancellable_cancel (closure->call_cancellable);
|
||||||
perform_prompt_complete (res, TRUE);
|
perform_prompt_complete (task, TRUE);
|
||||||
|
g_task_return_boolean (task, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -364,8 +360,8 @@ on_prompt_dismissed (GObject *source,
|
|||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
GTask *task = G_TASK (user_data);
|
||||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
PerformClosure *closure = g_task_get_task_data (task);
|
||||||
SecretPrompt *self = SECRET_PROMPT (source);
|
SecretPrompt *self = SECRET_PROMPT (source);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
@ -380,29 +376,27 @@ on_prompt_dismissed (GObject *source,
|
|||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
g_simple_async_result_take_error (res, error);
|
perform_prompt_complete (task, TRUE);
|
||||||
perform_prompt_complete (res, TRUE);
|
g_task_return_error (task, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (res);
|
g_clear_object (&task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_prompt_cancelled (GCancellable *cancellable,
|
on_prompt_cancelled (GCancellable *cancellable,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
GTask *task = G_TASK (user_data);
|
||||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
SecretPrompt *self = SECRET_PROMPT (g_task_get_source_object (task));
|
||||||
SecretPrompt *self = SECRET_PROMPT (g_async_result_get_source_object (user_data));
|
PerformClosure *closure = g_task_get_task_data (task);
|
||||||
|
|
||||||
/* Instead of cancelling our dbus calls, we cancel the prompt itself via this dbus call */
|
/* Instead of cancelling our dbus calls, we cancel the prompt itself via this dbus call */
|
||||||
|
|
||||||
g_dbus_proxy_call (G_DBUS_PROXY (self), "Dismiss", g_variant_new ("()"),
|
g_dbus_proxy_call (G_DBUS_PROXY (self), "Dismiss", g_variant_new ("()"),
|
||||||
G_DBUS_CALL_FLAGS_NO_AUTO_START, -1,
|
G_DBUS_CALL_FLAGS_NO_AUTO_START, -1,
|
||||||
closure->call_cancellable,
|
closure->call_cancellable,
|
||||||
on_prompt_dismissed, g_object_ref (res));
|
on_prompt_dismissed, g_object_ref (task));
|
||||||
|
|
||||||
g_object_unref (self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -433,8 +427,9 @@ secret_prompt_perform (SecretPrompt *self,
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *res;
|
GTask *task;
|
||||||
PerformClosure *closure;
|
PerformClosure *closure;
|
||||||
|
GCancellable *async_cancellable;
|
||||||
gchar *owner_name;
|
gchar *owner_name;
|
||||||
const gchar *object_path;
|
const gchar *object_path;
|
||||||
gboolean prompted;
|
gboolean prompted;
|
||||||
@ -451,14 +446,16 @@ secret_prompt_perform (SecretPrompt *self,
|
|||||||
|
|
||||||
proxy = G_DBUS_PROXY (self);
|
proxy = G_DBUS_PROXY (self);
|
||||||
|
|
||||||
res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
|
task = g_task_new (self, cancellable, callback, user_data);
|
||||||
secret_prompt_perform);
|
async_cancellable = g_task_get_cancellable (task);
|
||||||
|
g_task_set_source_tag (task, secret_prompt_perform);
|
||||||
closure = g_slice_new0 (PerformClosure);
|
closure = g_slice_new0 (PerformClosure);
|
||||||
closure->connection = g_object_ref (g_dbus_proxy_get_connection (proxy));
|
closure->connection = g_object_ref (g_dbus_proxy_get_connection (proxy));
|
||||||
closure->call_cancellable = g_cancellable_new ();
|
closure->call_cancellable = g_cancellable_new ();
|
||||||
closure->async_cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
async_cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||||
closure->return_type = return_type ? g_variant_type_copy (return_type) : 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);
|
g_task_set_task_data (task, closure, perform_closure_free);
|
||||||
|
g_task_set_check_cancellable (task, FALSE);
|
||||||
|
|
||||||
if (window_id == NULL)
|
if (window_id == NULL)
|
||||||
window_id = "";
|
window_id = "";
|
||||||
@ -472,26 +469,26 @@ secret_prompt_perform (SecretPrompt *self,
|
|||||||
object_path, NULL,
|
object_path, NULL,
|
||||||
G_DBUS_SIGNAL_FLAGS_NONE,
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
on_prompt_completed,
|
on_prompt_completed,
|
||||||
g_object_ref (res),
|
g_object_ref (task),
|
||||||
g_object_unref);
|
g_object_unref);
|
||||||
|
|
||||||
closure->watch = g_bus_watch_name_on_connection (closure->connection, owner_name,
|
closure->watch = g_bus_watch_name_on_connection (closure->connection, owner_name,
|
||||||
G_BUS_NAME_WATCHER_FLAGS_NONE, NULL,
|
G_BUS_NAME_WATCHER_FLAGS_NONE, NULL,
|
||||||
on_prompt_vanished,
|
on_prompt_vanished,
|
||||||
g_object_ref (res),
|
g_object_ref (task),
|
||||||
g_object_unref);
|
g_object_unref);
|
||||||
|
|
||||||
if (closure->async_cancellable) {
|
if (async_cancellable) {
|
||||||
closure->cancelled_sig = g_cancellable_connect (closure->async_cancellable,
|
closure->cancelled_sig = g_cancellable_connect (async_cancellable,
|
||||||
G_CALLBACK (on_prompt_cancelled),
|
G_CALLBACK (on_prompt_cancelled),
|
||||||
res, NULL);
|
g_object_ref (task), g_object_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_dbus_proxy_call (proxy, "Prompt", g_variant_new ("(s)", window_id),
|
g_dbus_proxy_call (proxy, "Prompt", g_variant_new ("(s)", window_id),
|
||||||
G_DBUS_CALL_FLAGS_NO_AUTO_START, -1,
|
G_DBUS_CALL_FLAGS_NO_AUTO_START, -1,
|
||||||
closure->call_cancellable, on_prompt_prompted, g_object_ref (res));
|
closure->call_cancellable, on_prompt_prompted, g_object_ref (task));
|
||||||
|
|
||||||
g_object_unref (res);
|
g_clear_object (&task);
|
||||||
g_free (owner_name);
|
g_free (owner_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,20 +513,19 @@ secret_prompt_perform_finish (SecretPrompt *self,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
PerformClosure *closure;
|
PerformClosure *closure;
|
||||||
GSimpleAsyncResult *res;
|
|
||||||
gchar *string;
|
gchar *string;
|
||||||
|
|
||||||
g_return_val_if_fail (SECRET_IS_PROMPT (self), NULL);
|
g_return_val_if_fail (SECRET_IS_PROMPT (self), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self),
|
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
|
||||||
secret_prompt_perform), NULL);
|
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == secret_prompt_perform, NULL);
|
||||||
|
|
||||||
res = G_SIMPLE_ASYNC_RESULT (result);
|
if (!g_task_propagate_boolean (G_TASK (result), error)) {
|
||||||
|
_secret_util_strip_remote_error (error);
|
||||||
if (_secret_util_propagate_error (res, error))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
closure = g_simple_async_result_get_op_res_gpointer (res);
|
closure = g_task_get_task_data (G_TASK (result));
|
||||||
if (closure->result == NULL)
|
if (closure->result == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (closure->return_type != NULL && !g_variant_is_of_type (closure->result, closure->return_type)) {
|
if (closure->return_type != NULL && !g_variant_is_of_type (closure->result, closure->return_type)) {
|
||||||
|
@ -103,17 +103,6 @@ secret_error_get_quark (void)
|
|||||||
return quark;
|
return quark;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
_secret_util_propagate_error (GSimpleAsyncResult *async,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
if (!g_simple_async_result_propagate_error (async, error))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
_secret_util_strip_remote_error (error);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_secret_util_strip_remote_error (GError **error)
|
_secret_util_strip_remote_error (GError **error)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user