From eebf8f911cedf5124ada2f91576f821da6f421b0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 27 Jun 2014 09:46:21 -0500 Subject: use unsigned ints for the alarm volume, duration properties --- src/exporter.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/exporter.cpp') diff --git a/src/exporter.cpp b/src/exporter.cpp index a5a059d..e2b60f2 100644 --- a/src/exporter.cpp +++ b/src/exporter.cpp @@ -107,20 +107,22 @@ private: G_CALLBACK(on_gobject_notify_string), &p); // when the Settings changes, update the GObject - p.changed().connect([o, propname](const std::string& s){ - g_object_set(o, propname, s.c_str(), nullptr); + p.changed().connect([o, propname](const std::string& val){ + g_object_set(o, propname, val.c_str(), nullptr); }); } static void - on_gobject_notify_int(GObject* o, GParamSpec* pspec, gpointer p) + on_gobject_notify_uint(GObject* o, GParamSpec* pspec, gpointer p) { - int val = 0; + uint val = 0; g_object_get (o, pspec->name, &val, nullptr); - static_cast*>(p)->set(val); + static_cast*>(p)->set(val); } - void bind_int_property(gpointer o, const char* propname, core::Property& p) + void bind_uint_property(gpointer o, + const char* propname, + core::Property& p) { // initialize the GObject property from the Settings g_object_set(o, propname, p.get(), nullptr); @@ -128,19 +130,19 @@ private: // when the GObject changes, update the Settings const std::string notify_propname = std::string("notify::") + propname; g_signal_connect(o, notify_propname.c_str(), - G_CALLBACK(on_gobject_notify_int), &p); + G_CALLBACK(on_gobject_notify_uint), &p); // when the Settings changes, update the GObject - p.changed().connect([o, propname](int i){ - g_object_set(o, propname, i, nullptr); + p.changed().connect([o, propname](unsigned int val){ + g_object_set(o, propname, val, nullptr); }); } void alarm_properties_init() { - bind_int_property(m_alarm_props, "duration", m_settings->alarm_duration); - bind_int_property(m_alarm_props, "default-volume", m_settings->alarm_volume); + bind_uint_property(m_alarm_props, "duration", m_settings->alarm_duration); + bind_uint_property(m_alarm_props, "default-volume", m_settings->alarm_volume); bind_string_property(m_alarm_props, "default-sound", m_settings->alarm_sound); } -- cgit v1.2.3