summaryrefslogtreecommitdiff
path: root/glib/src/varianttype.ccg
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2019-01-18 10:41:31 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2019-01-18 10:41:31 +0100
commit73e7da4f21b13b252fc2f54e905543390ce914e2 (patch)
treeacc834601e7391584046c5d03be5c9c6b3a7aecd /glib/src/varianttype.ccg
parentbc0799144a3ba3b4ac4e9b71d4ad9360697b80bc (diff)
downloadglibmm-73e7da4f21b13b252fc2f54e905543390ce914e2.tar.gz
Glib: Add some Glib::Value<> specializations
* glib/glibmm/error.[cc|h]: Add operator bool(). Add Glib::Value<Glib::Error> which is needed in _WRAP_PROPERTY() in Gtk::MediaStream. * glib/glibmm/objectbase.[cc|h]: Add get_base_type(), which is necessary for one of the existing Value<> specializations to apply. ObjectBase is used in _WRAP_PROPERTY() in Glib::Binding. * glib/src/variant.[ccg|hg]: Add Glib::Value<VariantBase> which is needed in _WRAP_PROPERTY() in Gio:Action. * glib/src/varianttype.[ccg|hg]: Add Glib::Value<VariantType> which is needed in _WRAP_PROPERTY() in Gio:Action. All data types that occur in _WRAP_PROPERTY() must have correct Glib::Value<> specializations. In most cases missing Value<> specializations are noticed only during execution of code that calls an affected property_*() method.
Diffstat (limited to 'glib/src/varianttype.ccg')
-rw-r--r--glib/src/varianttype.ccg18
1 files changed, 18 insertions, 0 deletions
diff --git a/glib/src/varianttype.ccg b/glib/src/varianttype.ccg
index ff1784fa..cd45bd5f 100644
--- a/glib/src/varianttype.ccg
+++ b/glib/src/varianttype.ccg
@@ -136,4 +136,22 @@ std::vector<VariantType> VariantType::get_item_types() const
return result;
}
+// Glib::Value<Glib::VariantType>
+GType Value<VariantType>::value_type()
+{
+ // The type function is *not* called g_variant_type_get_type().
+ // Use the macro in order to avoid using the non-standard function name here.
+ return G_TYPE_VARIANT_TYPE;
+}
+
+void Value<VariantType>::set(const CppType& data)
+{
+ set_boxed(data.gobj());
+}
+
+Value<VariantType>::CppType Value<VariantType>::get() const
+{
+ return Glib::wrap(static_cast<CType>(get_boxed()), true);
+}
+
} // namespace GLib