summaryrefslogtreecommitdiff
path: root/settings
diff options
context:
space:
mode:
authorSimon Steinbeiss <simon.steinbeiss@elfenbeinturm.at>2017-10-31 00:28:35 +0100
committerSimon Steinbeiss <simon.steinbeiss@elfenbeinturm.at>2017-10-31 00:28:45 +0100
commitc649323dbd80f39b196ee748bc640037dc4837e8 (patch)
tree0d130d759767571024c5281a5f13271de15800b3 /settings
parent32b37815dda2ad108f263176837ef628070ea2e3 (diff)
downloadixfce4-power-manager-c649323dbd80f39b196ee748bc640037dc4837e8.tar.gz
Fix xfpm startup dialog ignoring response (Bug #13700)
Previously xfpm would be launched in any case, even if the user chose "no" in the dialog.
Diffstat (limited to 'settings')
-rw-r--r--settings/xfpm-settings-app.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/settings/xfpm-settings-app.c b/settings/xfpm-settings-app.c
index ad6cf849..790e22d2 100644
--- a/settings/xfpm-settings-app.c
+++ b/settings/xfpm-settings-app.c
@@ -141,7 +141,7 @@ xfpm_settings_app_launch (GApplication *app)
gboolean has_hibernate_button;
gboolean has_power_button;
gboolean has_lid;
- gboolean start_xfpm_if_not_running;
+ gint start_xfpm_if_not_running;
TRACE ("entering");
@@ -192,16 +192,26 @@ xfpm_settings_app_launch (GApplication *app)
start_xfpm_if_not_running = gtk_dialog_run (GTK_DIALOG (startw));
gtk_widget_destroy (startw);
- if ( start_xfpm_if_not_running )
+ if (start_xfpm_if_not_running == GTK_RESPONSE_YES)
{
- g_spawn_command_line_async("xfce4-power-manager",NULL);
+ GAppInfo *app_info;
+ GError *error = NULL;
+
+ app_info = g_app_info_create_from_commandline ("xfce4-power-manager", "Xfce4 Power Manager",
+ G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION, NULL);
+ if (!g_app_info_launch (app_info, NULL, NULL, &error)) {
+ if (error != NULL) {
+ g_warning ("xfce4-power-manager could not be launched. %s", error->message);
+ g_error_free (error);
+ }
+ }
/* wait 2 seconds for xfpm to startup */
g_usleep ( 2 * 1000000 );
}
else
{
- /* continue without starting xfpm, this will probably error out */
- break;
+ /* exit without starting xfpm */
+ return;
}
}