aboutsummaryrefslogtreecommitdiff
path: root/src/arctica-greeter.vala
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2023-11-19 16:19:22 +0100
committerRobert Tari <robert@tari.in>2023-11-19 16:19:22 +0100
commit9fd6b51cd7d27dc5b79b9016498e2f0f68228190 (patch)
tree9456df9c90d3ada82ca1b12efc382b0a1ab8a4b5 /src/arctica-greeter.vala
parent7f203af2c4e1861eb05f0101e079a6d208f9e82f (diff)
parent6e6190e42e5bd4b65b29ee4672f0a37a035e50c8 (diff)
downloadarctica-greeter-9fd6b51cd7d27dc5b79b9016498e2f0f68228190.tar.gz
arctica-greeter-9fd6b51cd7d27dc5b79b9016498e2f0f68228190.tar.bz2
arctica-greeter-9fd6b51cd7d27dc5b79b9016498e2f0f68228190.zip
Merge branch 'sunweaver-pr/geoclue-agent-loading'
Attributes GH PR #95: https://github.com/ArcticaProject/arctica-greeter/pull/95
Diffstat (limited to 'src/arctica-greeter.vala')
-rw-r--r--src/arctica-greeter.vala45
1 files changed, 45 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 ();