summaryrefslogtreecommitdiff
path: root/src/gclue-config.c
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2023-01-05 20:47:24 +0100
committerMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2023-01-15 13:50:23 +0100
commitcb66669cff959046c8ef02abe13fc4f1a68660c5 (patch)
treed969ebeecb694d25b007068242916f435d77c7f0 /src/gclue-config.c
parent0cc334a44ed0384785379996e7f20e85f26e624f (diff)
downloadgeoclue-cb66669cff959046c8ef02abe13fc4f1a68660c5.tar.gz
Add static location source
There were many requests to provide a static location source for systems which don't normally move but where the existing location sources provide poor location estimate. An example of such system would be a desktop PC without WiFi or 3G modem. So let's add a source that reads location from "geolocation" file in @sysconfdir@ (normally /etc) to cover this use case. This file is constantly monitored for changes during Geoclue operation and the reported static location is updated accordingly. The geoclue(5) man page should be consulted for the format description of this file.
Diffstat (limited to 'src/gclue-config.c')
-rw-r--r--src/gclue-config.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gclue-config.c b/src/gclue-config.c
index bd52b7c..2802484 100644
--- a/src/gclue-config.c
+++ b/src/gclue-config.c
@@ -44,6 +44,7 @@ struct _GClueConfigPrivate
gboolean enable_modem_gps_source;
gboolean enable_wifi_source;
gboolean enable_compass;
+ gboolean enable_static_source;
char *wifi_submit_url;
char *wifi_submit_nick;
char *nmea_socket;
@@ -123,7 +124,7 @@ load_app_configs (GClueConfig *config)
{
const char *known_groups[] = { "agent", "wifi", "3g", "cdma",
"modem-gps", "network-nmea", "compass",
- NULL };
+ "static-source", NULL };
GClueConfigPrivate *priv = config->priv;
gsize num_groups = 0, i;
g_auto(GStrv) groups = NULL;
@@ -317,6 +318,13 @@ load_compass_config (GClueConfig *config)
}
static void
+load_static_source_config (GClueConfig *config)
+{
+ config->priv->enable_static_source =
+ load_enable_source_config (config, "static-source");
+}
+
+static void
gclue_config_init (GClueConfig *config)
{
g_autoptr(GError) error = NULL;
@@ -342,6 +350,7 @@ gclue_config_init (GClueConfig *config)
load_modem_gps_config (config);
load_network_nmea_config (config);
load_compass_config (config);
+ load_static_source_config (config);
}
GClueConfig *
@@ -530,3 +539,9 @@ gclue_config_get_enable_compass (GClueConfig *config)
{
return config->priv->enable_compass;
}
+
+gboolean
+gclue_config_get_enable_static_source (GClueConfig *config)
+{
+ return config->priv->enable_static_source;
+}