[Xfce4-commits] [xfce/xfce4-power-manager] 55/63: This is better

noreply at xfce.org noreply at xfce.org
Sun Mar 22 13:02:50 CET 2015


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

eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit 89aa61c39fdb2ae8b60992350ac6e33670b3cbcf
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Fri Mar 20 11:02:52 2015 +0300

    This is better
    
    Just create an activate action to perform the default action on
    the primary instance, also don't create additional windows. We
    need to make the settings dialog take an update for when device
    icons are clicked in the panel plugin.
---
 settings/xfpm-settings-app.c |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/settings/xfpm-settings-app.c b/settings/xfpm-settings-app.c
index da31410..050a7dc 100644
--- a/settings/xfpm-settings-app.c
+++ b/settings/xfpm-settings-app.c
@@ -56,7 +56,9 @@ static void activate_device              (GSimpleAction  *action,
 static void activate_debug               (GSimpleAction  *action,
                                           GVariant       *parameter,
                                           gpointer        data);
-
+static void activate_window              (GSimpleAction  *action,
+                                          GVariant       *parameter,
+                                          gpointer        data);
 
 G_DEFINE_TYPE(XfpmSettingsApp, xfpm_settings_app, GTK_TYPE_APPLICATION);
 
@@ -85,6 +87,7 @@ xfpm_settings_app_startup (GApplication *app)
       { "socket-id", activate_socket, "i"  },
       { "device-id", activate_device, "s"  },
       { "debug",     activate_debug,  NULL },
+      { "activate",  activate_window, NULL },
     };
 
     TRACE ("entering");
@@ -136,6 +139,12 @@ xfpm_settings_app_launch (GApplication *app)
 
     TRACE ("entering");
 
+    if (gtk_application_get_windows (GTK_APPLICATION (app)))
+    {
+        DBG("window already opened, returning");
+        return;
+    }
+
     manager = xfpm_power_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
                                                          G_BUS_NAME_OWNER_FLAGS_NONE,
                                                          "org.xfce.PowerManager",
@@ -278,6 +287,18 @@ activate_debug (GSimpleAction  *action,
     xfpm_settings_app_launch (G_APPLICATION (app));
 }
 
+static void
+activate_window (GSimpleAction  *action,
+                 GVariant       *parameter,
+                 gpointer        data)
+{
+    XfpmSettingsApp *app = XFPM_SETTINGS_APP (data);
+
+    TRACE ("entering");
+
+    xfpm_settings_app_launch (G_APPLICATION (app));
+}
+
 static gboolean
 xfpm_settings_app_local_options (GApplication *g_application,
                                  GVariantDict *options)
@@ -331,7 +352,7 @@ xfpm_settings_app_local_options (GApplication *g_application,
 
 
     /* default action */
-    xfpm_settings_app_launch (g_application);
+    g_action_group_activate_action(G_ACTION_GROUP(g_application), "activate", NULL);
 
     return 0;
 }
@@ -353,6 +374,6 @@ xfpm_settings_app_new (void)
 {
     return g_object_new (XFPM_TYPE_SETTINGS_APP,
                          "application-id", "org.xfce.PowerManager.Settings",
-                         "flags", G_APPLICATION_NON_UNIQUE,
+                         "flags", G_APPLICATION_FLAGS_NONE,
                          NULL);
 }

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


More information about the Xfce4-commits mailing list