summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-10-17 19:49:47 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-10-17 19:49:47 +0000
commit78f317d6c280e359ce38b3892a1c9a7b96e50ca2 (patch)
tree522dceb850d382a4464016755e3aed8528a00bfd /src/util.c
parent6d34e1fcf79845eabb5aafb008e8bffa47acf4f7 (diff)
issue 151, issue 100
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index 02914f8..3b4323a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -384,13 +384,19 @@ void trg_widget_set_visible(GtkWidget * w, gboolean visible) {
gdouble json_double_to_progress(JsonNode *n)
{
+ return json_node_really_get_double(n)*100.0;
+}
+
+gdouble json_node_really_get_double(JsonNode *node)
+{
GValue a = { 0 };
- json_node_get_value(n, &a);
+
+ json_node_get_value(node, &a);
switch (G_VALUE_TYPE(&a)) {
case G_TYPE_INT64:
- return (gdouble) g_value_get_int64(&a) * 100.0;
+ return (gdouble) g_value_get_int64(&a);
case G_TYPE_DOUBLE:
- return g_value_get_double(&a) * 100.0;
+ return g_value_get_double(&a);
default:
return 0.0;
}