bgo#627861 - [randr] Don't silengly ignore errors when pkexec(1) fails
Now we present a proper error dialog if the 'Make Default' configuration cannot be set due to a pkexec error. Signed-off-by: Federico Mena Quintero <federico@novell.com>
This commit is contained in:
parent
bc65958e72
commit
bfb92ffe9b
1 changed files with 20 additions and 3 deletions
|
@ -2329,6 +2329,12 @@ success_dialog_for_make_default (App *app)
|
|||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
error_dialog_for_make_default (App *app, const char *error_text)
|
||||
{
|
||||
error_message (app, _("Could not set the default configuration for monitors"), error_text);
|
||||
}
|
||||
|
||||
static void
|
||||
make_default (App *app)
|
||||
{
|
||||
|
@ -2336,6 +2342,8 @@ make_default (App *app)
|
|||
char *source_filename;
|
||||
char *dest_filename;
|
||||
char *dest_basename;
|
||||
char *std_error;
|
||||
gint exit_status;
|
||||
GError *error;
|
||||
|
||||
if (!sanitize_and_save_configuration (app))
|
||||
|
@ -2355,12 +2363,21 @@ make_default (App *app)
|
|||
dest_basename);
|
||||
|
||||
error = NULL;
|
||||
/* FIXME: pick up stderr and present it nicely in case of error */
|
||||
if (!g_spawn_command_line_sync (command_line, NULL, NULL, NULL, &error))
|
||||
error_message (app, _("Could not set the default configuration for monitors"), error ? error->message : NULL);
|
||||
if (!g_spawn_command_line_sync (command_line, NULL, &std_error, &exit_status, &error))
|
||||
{
|
||||
error_dialog_for_make_default (app, error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
else if (!WIFEXITED (exit_status) || WEXITSTATUS (exit_status) != 0)
|
||||
{
|
||||
error_dialog_for_make_default (app, std_error);
|
||||
}
|
||||
else
|
||||
{
|
||||
success_dialog_for_make_default (app);
|
||||
}
|
||||
|
||||
g_free (std_error);
|
||||
g_free (dest_filename);
|
||||
g_free (dest_basename);
|
||||
g_free (source_filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue