summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar si <snaunton@gmail.com>2018-04-11 22:00:00 +1000
committerGravatar Patrick Griffis <tingping@tingping.se>2018-04-12 16:01:03 -0400
commit52b4447af743bb1e6a44461d89e1fb654611e79b (patch)
treebd4eeb7e902091624d332077263073e413b0cc15
parentdd01b099b7f1807999a08b09bbe06ed2d65aeadd (diff)
Fix for General download/upload speed cannot be set in preferences
-rw-r--r--src/trg-json-widgets.c11
-rw-r--r--src/trg-remote-prefs-dialog.c10
2 files changed, 10 insertions, 11 deletions
diff --git a/src/trg-json-widgets.c b/src/trg-json-widgets.c
index 79299c6..21d5610 100644
--- a/src/trg-json-widgets.c
+++ b/src/trg-json-widgets.c
@@ -128,9 +128,8 @@ GtkWidget *trg_json_widget_spin_new(GList ** wl, JsonObject * obj,
{
GtkWidget *w = gtk_spin_button_new_with_range(min, max, step);
trg_json_widget_desc *wd = g_new0(trg_json_widget_desc, 1);
- JsonNode *node = json_object_get_member(obj, key);
- wd->saveFunc = trg_json_widget_spin_save_double;
+ wd->saveFunc = trg_json_widget_spin_save_int;
wd->key = g_strdup(key);
wd->widget = w;
@@ -143,7 +142,7 @@ GtkWidget *trg_json_widget_spin_new(GList ** wl, JsonObject * obj,
}
gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
- json_node_really_get_double(node));
+ (double)json_object_get_int_member(obj, key));
*wl = g_list_append(*wl, wd);
@@ -168,10 +167,10 @@ trg_json_widget_entry_save(GtkWidget * widget, JsonObject * obj,
}
void
-trg_json_widget_spin_save_double(GtkWidget * widget, JsonObject * obj,
+trg_json_widget_spin_save_int(GtkWidget * widget, JsonObject * obj,
gchar * key)
{
- json_object_set_double_member(obj, key,
- gtk_spin_button_get_value(GTK_SPIN_BUTTON
+ json_object_set_int_member(obj, key,
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
(widget)));
}
diff --git a/src/trg-remote-prefs-dialog.c b/src/trg-remote-prefs-dialog.c
index 3fcd910..7aa7b22 100644
--- a/src/trg-remote-prefs-dialog.c
+++ b/src/trg-remote-prefs-dialog.c
@@ -180,13 +180,13 @@ trg_rprefs_time_widget_savefunc(GtkWidget * w, JsonObject * obj,
{
GtkWidget *hourSpin = g_object_get_data(G_OBJECT(w), "hours-spin");
GtkWidget *minutesSpin = g_object_get_data(G_OBJECT(w), "mins-spin");
- gdouble hoursValue =
- gtk_spin_button_get_value(GTK_SPIN_BUTTON(hourSpin));
- gdouble minutesValue =
- gtk_spin_button_get_value(GTK_SPIN_BUTTON(minutesSpin));
+ gint hoursValue =
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(hourSpin));
+ gint minutesValue =
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(minutesSpin));
json_object_set_int_member(obj, key,
- (gint64) ((hoursValue * 60.0) +
+ (gint64) ((hoursValue * 60) +
minutesValue));
}