upstream switched from gconf to gsettings
[psensor-pkg-debian.git] / src / rsensor.c
index fbf6d2b..8a5aa66 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 jeanfi@gmail.com
+ * Copyright (C) 2010-2014 jeanfi@gmail.com
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -55,17 +55,17 @@ static size_t cbk_curl(void *buffer, size_t size, size_t nmemb, void *userp)
        return realsize;
 }
 
-static char *create_api_1_0_sensors_url(const char *base_url)
+static char *create_api_1_1_sensors_url(const char *base_url)
 {
        char *nurl, *ret;
        int n;
 
        nurl = url_normalize(base_url);
-       n = strlen(nurl) + strlen(URL_BASE_API_1_0_SENSORS) + 1;
+       n = strlen(nurl) + strlen(URL_BASE_API_1_1_SENSORS) + 1;
        ret = malloc(n);
 
        strcpy(ret, nurl);
-       strcat(ret, URL_BASE_API_1_0_SENSORS);
+       strcat(ret, URL_BASE_API_1_1_SENSORS);
 
        free(nurl);
 
@@ -121,7 +121,7 @@ struct psensor **get_remote_sensors(const char *server_url,
 
        sensors = NULL;
 
-       url = create_api_1_0_sensors_url(server_url);
+       url = create_api_1_1_sensors_url(server_url);
 
        obj = get_json_object(url);
 
@@ -163,14 +163,14 @@ void remote_psensor_update(struct psensor *s)
        if (obj && !is_error(obj)) {
                json_object *om;
 
-               om = json_object_object_get(obj, "last_measure");
+               json_object_object_get_ex(obj, "last_measure", &om);
 
                if (!is_error(obj)) {
                        json_object *ov, *ot;
                        struct timeval tv;
 
-                       ov = json_object_object_get(om, "value");
-                       ot = json_object_object_get(om, "time");
+                       json_object_object_get_ex(om, "value", &ov);
+                       json_object_object_get_ex(om, "time", &ot);
 
                        tv.tv_sec = json_object_get_int(ot);
                        tv.tv_usec = 0;