[gnome-software/135-restart-and-install-update-button-does-not-trigger-reboot-when-using-lxde] gs-common: Prefix error in gs_utils_invoke_reboot_async()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/135-restart-and-install-update-button-does-not-trigger-reboot-when-using-lxde] gs-common: Prefix error in gs_utils_invoke_reboot_async()
- Date: Tue, 21 Jun 2022 09:54:49 +0000 (UTC)
commit a30363b8c0075c4af74c66cfed8ffbf0dd578299
Author: Milan Crha <mcrha redhat com>
Date: Tue Jun 21 09:18:54 2022 +0200
gs-common: Prefix error in gs_utils_invoke_reboot_async()
To return more accurate error message.
src/gs-common.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-common.c b/src/gs-common.c
index 1b95bf60d..62100947b 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -904,10 +904,10 @@ gs_utils_reboot_call_done_cb (GObject *source,
/* get result */
if (gs_utils_invoke_reboot_finish (source, res, &error))
return;
- if (error != NULL) {
- g_warning ("Calling org.gnome.SessionManager.Reboot failed: %s",
- error->message);
- }
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_debug ("Calling reboot had been cancelled");
+ else if (error != NULL)
+ g_warning ("Calling reboot failed: %s", error->message);
}
static void
@@ -920,10 +920,12 @@ gs_utils_invoke_reboot_ready_cb (GObject *source_object,
g_autoptr(GError) error = NULL;
ret_val = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object), result, &error);
- if (ret_val != NULL)
+ if (ret_val != NULL) {
g_task_return_boolean (task, TRUE);
- else
+ } else {
+ g_prefix_error (&error, "Failed to call %s:", (const gchar *) g_task_get_task_data (task));
g_task_return_error (task, g_steal_pointer (&error));
+ }
}
/**
@@ -954,6 +956,7 @@ gs_utils_invoke_reboot_async (GCancellable *cancellable,
task = g_task_new (NULL, cancellable, ready_callback, user_data);
g_task_set_source_tag (task, gs_utils_invoke_reboot_async);
+ g_task_set_task_data (task, (gpointer) "org.gnome.SessionManager.Reboot", NULL);
bus = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, &error);
if (bus == NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]