From 84bf37abed50fc60e3b21f683b964734b821f827 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 17 Jul 2018 16:05:15 +0000 Subject: [PATCH] GTK: save boolean settings as JSON booleans. --- src/platform/guigtk.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/platform/guigtk.cpp b/src/platform/guigtk.cpp index 21921c2b..daf2ff6a 100644 --- a/src/platform/guigtk.cpp +++ b/src/platform/guigtk.cpp @@ -120,6 +120,19 @@ public: return defaultValue; } + void FreezeBool(const std::string &key, bool value) override { + struct json_object *jsonValue = json_object_new_boolean(value); + json_object_object_add(_json, key.c_str(), jsonValue); + } + + bool ThawBool(const std::string &key, bool defaultValue) override { + struct json_object *jsonValue; + if(json_object_object_get_ex(_json, key.c_str(), &jsonValue)) { + return json_object_get_boolean(jsonValue); + } + return defaultValue; + } + void FreezeFloat(const std::string &key, double value) override { struct json_object *jsonValue = json_object_new_double(value); json_object_object_add(_json, key.c_str(), jsonValue);