From 387d24160f48d7da35941662e07cf05c658f4267 Mon Sep 17 00:00:00 2001 From: Enrico Zini Date: Wed, 10 Mar 2010 00:20:51 +0100 Subject: [PATCH] Allow to configure gpsd host:port via config file --- src/config.vala | 18 ++++++++++++++++++ src/gps.vala | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/config.vala b/src/config.vala index 9ca638b..e4c5cfd 100644 --- a/src/config.vala +++ b/src/config.vala @@ -89,6 +89,20 @@ public class Config set { _min_button_height = set_int("min_button_height", value); } } + private string _gpsd_host; + public string gpsd_host + { + get { return _gpsd_host; } + set { _gpsd_host = set_string("gpsd_host", value); } + } + + private string _gpsd_port; + public string gpsd_port + { + get { return _gpsd_port; } + set { _gpsd_port = set_string("gpsd_port", value); } + } + private string _gprs_apn; public string gprs_apn { @@ -157,6 +171,8 @@ public class Config _homedir = get_string("homedir"); _icondir = get_string("icondir"); _min_button_height = get_int("min_button_height"); + _gpsd_host = get_string("gpsd_host"); + _gpsd_port = get_string("gpsd_port"); _gprs_apn = get_string("gprs_apn"); _gprs_user = get_string("gprs_user"); _gprs_pass = get_string("gprs_pass"); @@ -177,6 +193,8 @@ public class Config if (icondir == null) icondir = "/usr/share/zavai/icons"; min_button_height = 80; + gpsd_host = "localhost"; + gpsd_port = "gpsd"; gprs_apn = "general.t-mobile.uk"; gprs_user = "x"; gprs_pass = "x"; diff --git a/src/gps.vala b/src/gps.vala index 205fd11..ddee032 100644 --- a/src/gps.vala +++ b/src/gps.vala @@ -103,7 +103,8 @@ public class GPS: zavai.Service return; } - int res = libgps.open_r("localhost", "gpsd", ref data); + zavai.log.info("Connecting to gpsd at " + config.gpsd_host + ":" + config.gpsd_port); + int res = libgps.open_r(config.gpsd_host, config.gpsd_port, ref data); if (res != 0) { zavai.log.error(libgps.errstr(res)); -- 2.39.5