aboutsummaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/service.c b/src/service.c
index ab5deb5..982a24e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -692,22 +692,29 @@ on_settings_activated (GSimpleAction * a G_GNUC_UNUSED,
GVariant * param G_GNUC_UNUSED,
gpointer gself G_GNUC_UNUSED)
{
- if (!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xubuntu"))
+ static const gchar *control_center_cmd = NULL;
+
+ if (control_center_cmd == NULL)
{
- execute_command ("xfce4-power-manager-settings");
- }
- else
- {
- gchar *path;
+ if (!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xubuntu"))
+ {
+ control_center_cmd = "xfce4-power-manager-settings";
+ }
+ else
+ {
+ gchar *path;
- path = g_find_program_in_path ("unity-control-center");
- if (path != NULL)
- execute_command ("unity-control-center power");
- else
- execute_command ("gnome-control-center power");
+ path = g_find_program_in_path ("unity-control-center");
+ if (path != NULL)
+ control_center_cmd = "unity-control-center power";
+ else
+ control_center_cmd = "gnome-control-center power";
- g_free (path);
- }
+ g_free (path);
+ }
+ }
+
+ execute_command (control_center_cmd);
}
static void