|
|
@ -425,25 +425,22 @@ void render() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void parse_json(const char *text) {
|
|
|
|
void parse_json(const char *text) {
|
|
|
|
|
|
|
|
/* the array of objects looks like this:
|
|
|
|
/*
|
|
|
|
* [ {
|
|
|
|
* {
|
|
|
|
* "full_text": "E: 10.0.0.1 (1000 Mbit/s)",
|
|
|
|
"full_text": "E: 10.0.0.1 (1000 Mbit/s)",
|
|
|
|
* "short_text": "10.0.0.1",
|
|
|
|
"short_text": "10.0.0.1",
|
|
|
|
* "color": "#00ff00",
|
|
|
|
"color": "#00ff00",
|
|
|
|
* "min_width": 300,
|
|
|
|
"min_width": 300,
|
|
|
|
* "align": "right",
|
|
|
|
"align": "right",
|
|
|
|
* "urgent": false,
|
|
|
|
"urgent": false,
|
|
|
|
* "name": "ethernet",
|
|
|
|
"name": "ethernet",
|
|
|
|
* "instance": "eth0",
|
|
|
|
"instance": "eth0",
|
|
|
|
* "separator": true,
|
|
|
|
"separator": true,
|
|
|
|
* "separator_block_width": 9
|
|
|
|
"separator_block_width": 9
|
|
|
|
* },
|
|
|
|
}
|
|
|
|
* { ... }, ...
|
|
|
|
*
|
|
|
|
* ]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
*
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
json_object *results = json_tokener_parse(text);
|
|
|
|
json_object *results = json_tokener_parse(text);
|
|
|
|
if (!results) {
|
|
|
|
if (!results) {
|
|
|
|
sway_log(L_DEBUG, "xxx Failed to parse json");
|
|
|
|
sway_log(L_DEBUG, "xxx Failed to parse json");
|
|
|
@ -466,7 +463,6 @@ void parse_json(const char *text) {
|
|
|
|
json_object *name, *instance, *separator, *separator_block_width;
|
|
|
|
json_object *name, *instance, *separator, *separator_block_width;
|
|
|
|
|
|
|
|
|
|
|
|
json_object *json = json_object_array_get_idx(results, i);
|
|
|
|
json_object *json = json_object_array_get_idx(results, i);
|
|
|
|
|
|
|
|
|
|
|
|
if (!json) {
|
|
|
|
if (!json) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -538,11 +534,9 @@ void parse_json(const char *text) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
list_add(status_line, new);
|
|
|
|
list_add(status_line, new);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
json_object_put(results);
|
|
|
|
json_object_put(results);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void poll_for_update() {
|
|
|
|
void poll_for_update() {
|
|
|
|