Don't change GDateTime in glib because of Glib::Value<>. Many boxed types get Glib::Value specializations almost automatically. Those that are wrapped as _CLASS_OPAQUE_COPYABLE don't. GDateTime is one of them. I'll either add the Glib::Value specialization manually to glibmm/datetime.h or make a more general fix in the _CLASS_OPAQUE_COPYABLE m4 macro. For the time being I can fix something in the
master branch. A fix in the glibmm-2.4 ABI series has to wait
until glibmm 2.62.0. However I fix it, the fix will include
added API and/or ABI. On 2019-04-24 18:06, Pavlo Solntsev via gtkmm-list wrote: Thank you Kjell. It works. Basically, the code you provided should be added to the header (glibmm/value.h). Currently, GDateTime is not GObject-based. If we switch GDateTime to GObject the situation will be simpler for mm. For my problem, I will use code in my app. Does it make sense to add it to the master (glibmm)? Or it is better change GDateTime implementation. Thanks. On Wed, 2019-04-24 at 14:45 +0200, Kjell Ahlstedt wrote:The description of Glib::ValueBase says * Glib::Value<> is specialized for almost any type used within the glibmm and gtkmm libraries. * * - Basic types like <tt>int</tt>, <tt>char</tt>, <tt>bool</tt>, etc., also <tt>void*</tt>. * - Glib::ustring and std::string. * - Pointers to classes derived from Glib::Object. * - Glib::RefPtr<> pointer types, which are assumed to be Glib::Object pointers. * - All flags and enum types used within the gtkmm libraries. * * If a type doesn't fit into any of these categories, then a generic * implementation for custom types will be used. "Almost any type" does not include Glib::DateTime, unfortunately. And "All flags and enum types" is not quite right. There are some enum types, especailly in glibmm, without a Glib::Value specialization. I think this Glib::Value<Glib::DateTime> specialization will work: namespace Glib { template <> class Value<Glib::DateTime> : public ValueBase_Boxed { public: using CppType = Glib::DateTime; using CType = GDateTime*; static GType value_type() { return G_TYPE_DATE_TIME; } void set(const CppType& data) { set_boxed(data.gobj()); } CppType get() const { return CppType(static_cast<CType>(get_boxed()), true); } }; } // namespace Glib |