aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-05-17 14:20:15 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-05-17 14:20:15 +0200
commit0916a5f7d09eb45937bf813e97ccf49edf18b766 (patch)
treef3b9d4b39bec8c389e521bb4f5e76f6f23d4f38f /src
parent0cddbb48d793d1f68ed5062ad178025100ab5ab5 (diff)
downloadarctica-greeter-0916a5f7d09eb45937bf813e97ccf49edf18b766.tar.gz
arctica-greeter-0916a5f7d09eb45937bf813e97ccf49edf18b766.tar.bz2
arctica-greeter-0916a5f7d09eb45937bf813e97ccf49edf18b766.zip
indicator service launching: Check AGSettings for what indicator to load and remember loaded indicators to clean up properly when switching to the user context.
Diffstat (limited to 'src')
-rw-r--r--src/arctica-greeter.vala180
1 files changed, 84 insertions, 96 deletions
diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala
index f74c5cb..55b5b53 100644
--- a/src/arctica-greeter.vala
+++ b/src/arctica-greeter.vala
@@ -651,7 +651,25 @@ public class ArcticaGreeter
debug ("Creating Arctica Greeter");
var greeter = new ArcticaGreeter (do_test_mode);
- Pid dummy_pid = 0;
+ string systemd_stderr;
+ int systemd_exitcode = 0;
+
+ var indicator_list = AGSettings.get_strv(AGSettings.KEY_INDICATORS);
+
+ var update_indicator_list = false;
+ for (var i = 0; i < indicator_list.length; i++)
+ {
+ if (indicator_list[i] == "ug-keyboard")
+ {
+ indicator_list[i] = "org.ayatana.indicator.keyboard";
+ update_indicator_list = true;
+ }
+ }
+
+ if (update_indicator_list)
+ AGSettings.set_strv(AGSettings.KEY_INDICATORS, indicator_list);
+
+ var launched_indicator_services = new List<string>();
if (!do_test_mode)
{
@@ -661,57 +679,47 @@ public class ArcticaGreeter
greeter.show ();
});
- /* Start the indicator services */
- try
- {
- string[] argv;
-
- Shell.parse_argv ("systemctl --user start ayatana-indicator-application", out argv);
- Process.spawn_async (null,
- argv,
- null,
- SpawnFlags.SEARCH_PATH,
- null,
- out dummy_pid);
- }
- catch (Error e)
- {
- warning ("Error starting Ayatana Indicators Application Service: %s", e.message);
- }
- try
- {
- string[] argv;
-
- Shell.parse_argv ("systemctl --user start ayatana-indicator-power", out argv);
- Process.spawn_async (null,
- argv,
- null,
- SpawnFlags.SEARCH_PATH,
- null,
- out dummy_pid);
- }
- catch (Error e)
- {
- warning ("Error starting Ayatana Indicators Power Service: %s", e.message);
- }
- try
- {
- string[] argv;
-
- Shell.parse_argv ("systemctl --user start ayatana-indicator-session", out argv);
- Process.spawn_async (null,
- argv,
- null,
- SpawnFlags.SEARCH_PATH,
- null,
- out dummy_pid);
- }
- catch (Error e)
+ var indicator_service = "";
+ foreach (unowned string indicator in indicator_list)
{
- warning ("Error starting Ayatana Indicators Session Service: %s", e.message);
+ if ("ug-" in indicator && ! ("." in indicator))
+ continue;
+
+ if ("org.ayatana.indicator." in indicator)
+ indicator_service = "ayatana-indicator-%s".printf(indicator.split_set(".")[3]);
+ else if ("ayatana-" in indicator)
+ indicator_service = "ayatana-indicator-%s".printf(indicator.split_set("-")[1]);
+ else
+ indicator_service = indicator;
+
+ try {
+ /* Start the indicator service */
+ string[] argv;
+
+ Shell.parse_argv ("systemctl --user start %s".printf(indicator_service), out argv);
+ Process.spawn_sync (null,
+ argv,
+ null,
+ SpawnFlags.SEARCH_PATH,
+ null,
+ null,
+ out systemd_stderr,
+ out systemd_exitcode);
+
+ if (systemd_exitcode == 0)
+ {
+ launched_indicator_services.append(indicator_service);
+ debug ("Successfully started Indicator Service '%s'", indicator_service);
+ }
+ else {
+ warning ("Systemd failed to start Indicator Service '%s': %s", indicator_service, systemd_stderr);
+ }
+ }
+ catch (Error e) {
+ warning ("Error starting Indicator Service '%s': %s", indicator_service, e.message);
+ }
}
-
/* Make nm-applet hide items the user does not have permissions to interact with */
Environment.set_variable ("NM_APPLET_HIDE_POLICY_ITEMS", "1", true);
@@ -742,54 +750,34 @@ public class ArcticaGreeter
if (!do_test_mode)
{
- /* Stop the indicator services */
- try
- {
- string[] argv;
-
- Shell.parse_argv ("systemctl --user stop ayatana-indicator-application", out argv);
- Process.spawn_async (null,
- argv,
- null,
- SpawnFlags.SEARCH_PATH,
- null,
- out dummy_pid);
- }
- catch (Error e)
- {
- warning ("Error stopping Ayatana Indicators Application Service: %s", e.message);
- }
- try
+ foreach (unowned string indicator_service in launched_indicator_services)
{
- string[] argv;
-
- Shell.parse_argv ("systemctl --user stop ayatana-indicator-power", out argv);
- Process.spawn_async (null,
- argv,
- null,
- SpawnFlags.SEARCH_PATH,
- null,
- out dummy_pid);
- }
- catch (Error e)
- {
- warning ("Error stopping Ayatana Indicators Power Service: %s", e.message);
- }
- try
- {
- string[] argv;
-
- Shell.parse_argv ("systemctl --user stop ayatana-indicator-session", out argv);
- Process.spawn_async (null,
- argv,
- null,
- SpawnFlags.SEARCH_PATH,
- null,
- out dummy_pid);
- }
- catch (Error e)
- {
- warning ("Error stopping Ayatana Indicators Session Service: %s", e.message);
+
+ try {
+ /* Stop this indicator service */
+ string[] argv;
+
+ Shell.parse_argv ("systemctl --user stop %s".printf(indicator_service), out argv);
+ Process.spawn_sync (null,
+ argv,
+ null,
+ SpawnFlags.SEARCH_PATH,
+ null,
+ null,
+ out systemd_stderr,
+ out systemd_exitcode);
+
+ if (systemd_exitcode == 0)
+ {
+ debug ("Successfully stopped Indicator Service '%s' via systemd", indicator_service);
+ }
+ else {
+ warning ("Systemd failed to stop Indicator Service '%s': %s", indicator_service, systemd_stderr);
+ }
+ }
+ catch (Error e) {
+ warning ("Error stopping Indicator Service '%s': %s", indicator_service, e.message);
+ }
}
}