]> ToastFreeware Gitweb - gregoa/zavai.git/commitdiff
Allow to configure gpsd host:port via config file
authorEnrico Zini <enrico@enricozini.org>
Tue, 9 Mar 2010 23:20:51 +0000 (00:20 +0100)
committerEnrico Zini <enrico@enricozini.org>
Tue, 9 Mar 2010 23:20:51 +0000 (00:20 +0100)
src/config.vala
src/gps.vala

index 9ca638bf431fa9aa6e3edf9623006ed10fa6bb06..e4c5cfd6ad7af02b68247f90436658149d67531c 100644 (file)
@@ -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";
index 205fd11b4b5919925083d64974582469bf17085a..ddee03255939ef7485546c9303b798d5b0fbb7f3 100644 (file)
@@ -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));