[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Fix xfpm startup dialog ignoring response (Bug #13700)

noreply at xfce.org noreply at xfce.org
Tue Oct 31 00:28:59 CET 2017


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-power-manager.

commit c649323dbd80f39b196ee748bc640037dc4837e8
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Tue Oct 31 00:28:35 2017 +0100

    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.
---
 settings/xfpm-settings-app.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/settings/xfpm-settings-app.c b/settings/xfpm-settings-app.c
index ad6cf84..790e22d 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;
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list