summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-11 21:44:28 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-11 21:44:28 +0000
commit2aacfd5e691a7c8b37c2fc1dbcf001615c205b97 (patch)
treeb594b99f18040d95a7c1b2325f76fc20ebd46e81 /src/util.c
parent70bf14ea3eade947baf6fab49541f3b19c4db099 (diff)
show progress in percent done column
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 05c28ee..07a6440 100644
--- a/src/util.c
+++ b/src/util.c
@@ -367,3 +367,17 @@ void trg_widget_set_visible(GtkWidget * w, gboolean visible) {
else
gtk_widget_hide(w);
}
+
+gdouble json_int_or_double_to_double(JsonNode *n)
+{
+ GValue a = { 0 };
+ json_node_get_value(n, &a);
+ switch (G_VALUE_TYPE(&a)) {
+ case G_TYPE_INT64:
+ return (gdouble) g_value_get_int64(&a) * 100.0;
+ case G_TYPE_DOUBLE:
+ return g_value_get_double(&a) * 100.0;
+ default:
+ return 0.0;
+ }
+}