diff options
Diffstat (limited to 'gio/src/appinfo.ccg')
-rw-r--r-- | gio/src/appinfo.ccg | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gio/src/appinfo.ccg b/gio/src/appinfo.ccg index 5c4a7170..c0caaca1 100644 --- a/gio/src/appinfo.ccg +++ b/gio/src/appinfo.ccg @@ -19,6 +19,38 @@ #include <giomm/slot_async.h> #include <gio/gio.h> +namespace Glib +{ +namespace Container_Helpers +{ +/* Specialization for pointers to the GAppInfo interface. + * The partial specialization in glibmm/glib/glibmm/containerhandle_shared.h + * is not well suited for interfaces which do not already have a wrapper. + * Its to_cpp_type() calls Glib::wrap_auto() instead id Glib::wrap_auto_interface(). + * This specialization is used by Glib::ListHandler<>::list_to_vector() in + * Gio::AppInfo::get_all() and Gio::AppInfo::get_all_for_type(). + */ +template <> +struct TypeTraits<Glib::RefPtr<Gio::AppInfo>> +{ + using T = Gio::AppInfo; + using CppType = Glib::RefPtr<T>; + using CType = typename T::BaseObjectType*; + using CTypeNonConst = typename T::BaseObjectType*; + + static CType to_c_type(const CppType& ptr) { return Glib::unwrap(ptr); } + static CType to_c_type(CType ptr) { return ptr; } + static CppType to_cpp_type(CType ptr) { return Glib::wrap(ptr, true); } + + static void release_c_type(CType ptr) + { + GLIBMM_DEBUG_UNREFERENCE(nullptr, ptr); + g_object_unref(ptr); + } +}; +} // namespace Container_Helpers +} // namespace Glib + namespace Gio { |