[glibmm] Gio::AppInfo::get_all(): Use a local TypeTraits in ListHandler



commit 7bad998c18dafc9174fcc1c98c43029862db68ed
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Thu Jul 29 15:22:34 2021 +0200

    Gio::AppInfo::get_all(): Use a local TypeTraits in ListHandler
    
    Instead of a specialization of Glib::Container_Helpers::TypeTraits
    for Glib::RefPtr<Gio::AppInfo>, add and use struct TypeTraits_AppInfo,
    local in gio/src/appinfo.ccg and appinfo.cc.
    Modifies the issue #94 fix.

 gio/src/appinfo.ccg | 15 ++++++---------
 gio/src/appinfo.hg  |  2 +-
 2 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/gio/src/appinfo.ccg b/gio/src/appinfo.ccg
index c0caaca1..b75af725 100644
--- a/gio/src/appinfo.ccg
+++ b/gio/src/appinfo.ccg
@@ -19,19 +19,17 @@
 #include <giomm/slot_async.h>
 #include <gio/gio.h>
 
-namespace Glib
+namespace
 {
-namespace Container_Helpers
-{
-/* Specialization for pointers to the GAppInfo interface.
+/* Special type traits 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
+ * These type traits are used by Glib::ListHandler<>::list_to_vector() in
  * Gio::AppInfo::get_all() and Gio::AppInfo::get_all_for_type().
+ * https://gitlab.gnome.org/GNOME/glibmm/-/issues/94
  */
-template <>
-struct TypeTraits<Glib::RefPtr<Gio::AppInfo>>
+struct TypeTraits_AppInfo
 {
   using T = Gio::AppInfo;
   using CppType = Glib::RefPtr<T>;
@@ -48,8 +46,7 @@ struct TypeTraits<Glib::RefPtr<Gio::AppInfo>>
     g_object_unref(ptr);
   }
 };
-} // namespace Container_Helpers
-} // namespace Glib
+} // anonymous namespace
 
 namespace Gio
 {
diff --git a/gio/src/appinfo.hg b/gio/src/appinfo.hg
index ed7a6dc0..06d8d515 100644
--- a/gio/src/appinfo.hg
+++ b/gio/src/appinfo.hg
@@ -220,7 +220,7 @@ public:
 
   _WRAP_METHOD(bool set_as_last_used_for_type(const std::string& content_type), 
g_app_info_set_as_last_used_for_type, errthrow)
 
-#m4 
_CONVERSION(`GList*',`std::vector<Glib::RefPtr<AppInfo>>',`Glib::ListHandler<Glib::RefPtr<AppInfo>>::list_to_vector($3,
 Glib::OWNERSHIP_DEEP)')
+#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<AppInfo>>',`Glib::ListHandler<Glib::RefPtr<AppInfo>, 
TypeTraits_AppInfo>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(static std::vector<Glib::RefPtr<AppInfo>> get_all(), g_app_info_get_all)
 
   _WRAP_METHOD(static std::vector<Glib::RefPtr<AppInfo>> get_all_for_type(const std::string& content_type), 
g_app_info_get_all_for_type)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]