diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-06-18 15:33:39 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-06-18 15:33:39 -0500 |
commit | 96bc6e532df0611fb12fdcb4ccb346a248461d58 (patch) | |
tree | 998c29915f97d9180cb9405409fbb67e00e3797a /src/backend-dbus | |
parent | a1ea3fece0ded0f1a17198d47855f26b1841ee2e (diff) | |
download | ayatana-indicator-session-96bc6e532df0611fb12fdcb4ccb346a248461d58.tar.gz ayatana-indicator-session-96bc6e532df0611fb12fdcb4ccb346a248461d58.tar.bz2 ayatana-indicator-session-96bc6e532df0611fb12fdcb4ccb346a248461d58.zip |
If we try to prompt for confirmation with zenity but zenity fails to run, treat that as confirmation. Otherwise how will a user ever log out?
Diffstat (limited to 'src/backend-dbus')
-rw-r--r-- | src/backend-dbus/actions.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c index 503f1b8..5447440 100644 --- a/src/backend-dbus/actions.c +++ b/src/backend-dbus/actions.c @@ -669,6 +669,7 @@ zenity_question (IndicatorSessionActionsDbus * self, { char * command_line; int exit_status; + GError * error; gboolean confirmed; command_line = g_strdup_printf ("%s" @@ -686,11 +687,16 @@ zenity_question (IndicatorSessionActionsDbus * self, ok_label, cancel_label); + /* Treat errors as user confirmation. + Otherwise how will the user ever log out? */ exit_status = -1; - if (!g_spawn_command_line_sync (command_line, NULL, NULL, &exit_status, NULL)) + error = NULL; + if (!g_spawn_command_line_sync (command_line, NULL, NULL, &exit_status, &error)) + { + confirmed = TRUE; + } + else if (!g_spawn_check_exit_status (exit_status, &error)) { - /* Treat failure-to-prompt as user confirmation. - Otherwise how will the user ever log out? */ confirmed = TRUE; } else @@ -698,6 +704,7 @@ zenity_question (IndicatorSessionActionsDbus * self, confirmed = exit_status == 0; } + log_and_clear_error (&error, G_STRLOC, G_STRFUNC); g_free (command_line); return confirmed; } |