summaryrefslogtreecommitdiff
path: root/gio/src/settings.ccg
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2010-07-22 22:40:12 +0200
committerMurray Cumming <murrayc@murrayc.com>2010-07-22 22:40:12 +0200
commit96c1f18cd3b695c925553d0ccda47da7c1d56d8c (patch)
treed06bfee333598a45f4ffe63c5aa8238d8b338845 /gio/src/settings.ccg
parent1da3fe549cf604b5b07263965676c59f745ea38f (diff)
downloadglibmm-96c1f18cd3b695c925553d0ccda47da7c1d56d8c.tar.gz
Variant<>: Make this usable as an ouput parameter.
* glib/src/variant.[hg|ccg]: VariantBase: Added init(), like Value::init(). This just changes the gobject_, with appropriate unref and ref. * gio/src/settings.[hg|ccg]: get_value(): Use an output parameter for the VariantBase, instead of a return value, as we do for Value, allowing the caller to use a derived (templated) type. * examples/settings/settings.cc: Show how Variant<> can be used.
Diffstat (limited to 'gio/src/settings.ccg')
-rw-r--r--gio/src/settings.ccg9
1 files changed, 9 insertions, 0 deletions
diff --git a/gio/src/settings.ccg b/gio/src/settings.ccg
index 342b70f5..feaba2aa 100644
--- a/gio/src/settings.ccg
+++ b/gio/src/settings.ccg
@@ -3,6 +3,15 @@
namespace Gio
{
+void Settings::get_value(const Glib::ustring& key, Glib::VariantBase& value)
+{
+ GVariant* const g_value = g_settings_get_value(gobj(), key.c_str());
+ if(!g_value)
+ return;
+
+ value.init(g_value, false /* don't take a reference */);
+}
+
void Settings::bind(const Glib::ustring& key,
const Glib::PropertyProxy_Base& property_proxy,
SettingsBindFlags flags)