diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/arctica-greeter.vala | 45 | ||||
-rw-r--r-- | src/settings.vala | 1 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala index 1f1f6d3..7f1ddb2 100644 --- a/src/arctica-greeter.vala +++ b/src/arctica-greeter.vala @@ -1086,6 +1086,35 @@ public class ArcticaGreeter : Object } } + Pid geoclueagent_pid = 0; + if (AGSettings.get_boolean (AGSettings.KEY_GEOCLUE_AGENT) && (!do_test_mode)) + { + + try + { + string[] argv = null; + + if (FileUtils.test ("/usr/lib/geoclue-2.0/demos/agent", FileTest.EXISTS)) { + Shell.parse_argv ("/usr/lib/geoclue-2.0/demos/agent", out argv); + } + else if (FileUtils.test ("/usr/libexec/geoclue-2.0/demos/agent", FileTest.EXISTS)) { + Shell.parse_argv ("/usr/libexec/geoclue-2.0/demos/agent", out argv); + } + if (argv != null) + Process.spawn_async (null, + argv, + null, + SpawnFlags.SEARCH_PATH, + null, + out geoclueagent_pid); + debug ("Launched GeoClue-2.0 agent. PID: %d", geoclueagent_pid); + } + catch (Error e) + { + warning ("Error starting the GeoClue-2.0 agent: %s", e.message); + } + } + /* Enable touchpad tap-to-click */ enable_tap_to_click (); @@ -1337,6 +1366,22 @@ public class ArcticaGreeter : Object debug ("AT-SPI terminated with signal %d", Process.term_sig (status)); atspi_pid = 0; } + + if (geoclueagent_pid != 0) + { +#if VALA_0_40 + Posix.kill (geoclueagent_pid, Posix.Signal.KILL); +#else + Posix.kill (geoclueagent_pid, Posix.SIGKILL); +#endif + int status; + Posix.waitpid (geoclueagent_pid, out status, 0); + if (Process.if_exited (status)) + debug ("GeoClue-2.0 agent exited with return value %d", Process.exit_status (status)); + else + debug ("GeoClue-2.0 agent terminated with signal %d", Process.term_sig (status)); + geoclueagent_pid = 0; + } } var screen = Gdk.Screen.get_default (); diff --git a/src/settings.vala b/src/settings.vala index e4386a6..74e6e40 100644 --- a/src/settings.vala +++ b/src/settings.vala @@ -82,6 +82,7 @@ public class AGSettings : Object public const string KEY_EXCLUDED_SESSIONS = "excluded-sessions"; public const string KEY_SHUTDOWN_DIALOG_TIMEOUT = "shutdown-dialog-timeout"; public const string KEY_PREFERRED_SESSIONS = "preferred-sessions"; + public const string KEY_GEOCLUE_AGENT = "geoclue-agent"; public static bool get_boolean (string key) { |