From 9d894e30007c54622c73ed7619c3d868e3351b35 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sun, 20 Jan 2019 16:29:30 +0100 Subject: Glib::Value: Add ValueBase_Variant Nice to have as a base class for Value and possibly for future Glib::Value specializations. --- glib/src/variant.ccg | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'glib/src/variant.ccg') diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg index ec3fc94a..299a9393 100644 --- a/glib/src/variant.ccg +++ b/glib/src/variant.ccg @@ -694,31 +694,14 @@ Variant::get_iter() const /*---------------------Value---------------------*/ -// static -GType Value::value_type() -{ - return G_TYPE_VARIANT; -} - void Value::set(CppType data) { - g_value_set_variant(&gobject_, data.gobj()); + set_variant(data.gobj()); } Value::CppType Value::get() const { - return CppType(g_value_get_variant(&gobject_), true); -} - -GParamSpec* Value::create_param_spec(const Glib::ustring& name, - const Glib::ustring& nick, const Glib::ustring& blurb, Glib::ParamFlags flags) const -{ - GVariant* gvariant = g_value_get_variant(&gobject_); - const GVariantType* gvariant_type = gvariant ? g_variant_get_type(gvariant) : G_VARIANT_TYPE_ANY; - - return g_param_spec_variant( - name.c_str(), c_str_or_nullptr(nick), c_str_or_nullptr(blurb), - gvariant_type, gvariant, static_cast(flags)); + return CppType(get_variant(), true); } } // namespace Glib -- cgit v1.2.1