[gtkmm] Gtk: Fix ownership of some GLists



commit 26391f3a5630c4e406975b5aa871b6e552514261
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Wed Jul 24 09:05:58 2019 +0200

    Gtk: Fix ownership of some GLists
    
    * gtk/src/gtk_docs_override.xml: Remove gtk_icon_theme_list_icons().
    * gtk/src/icontheme.[ccg|hg]: list_icons(): Replace the overload without
    the 'context' parameter with a default value, thus making all list_icons()
    have Glib::OWNERSHIP_DEEP.
    * gtk/src/iconview.hg: get_selected_icons(): SHALLOW -> DEEP. Remove the
    TreePathTraits struct in iconview.hg. Use the one in treepath.hg.
    * gtk/src/recentmanager.hg: get_items(): SHALLOW -> DEEP

 gtk/src/gtk_docs_override.xml | 25 -------------------------
 gtk/src/icontheme.ccg         |  6 ------
 gtk/src/icontheme.hg          | 19 +++++++++++++------
 gtk/src/iconview.hg           | 18 +-----------------
 gtk/src/recentmanager.hg      |  6 +-----
 5 files changed, 15 insertions(+), 59 deletions(-)
---
diff --git a/gtk/src/gtk_docs_override.xml b/gtk/src/gtk_docs_override.xml
index 4a17ffde..b2d266e4 100644
--- a/gtk/src/gtk_docs_override.xml
+++ b/gtk/src/gtk_docs_override.xml
@@ -1256,31 +1256,6 @@ files and subfolders in the current folder.
 </return>
 </function>
 
-<function name="gtk_icon_theme_list_icons">
-<description>
-Lists a subset of icons in the current icon theme, by providing a context string.
-The set of values for the context string is system dependent,
-but will typically include such values as &apos;Applications&apos; and
-&apos;MimeTypes&apos;.
-
-Since: 2.4
-</description>
-<parameters>
-<parameter name="icon_theme">
-<parameter_description> a #GtkIconTheme
-</parameter_description>
-</parameter>
-<parameter name="context">
-<parameter_description> a string identifying a particular type of icon.
-</parameter_description>
-</parameter>
-</parameters>
-<return>  The names of all the
-icons in the theme.
-</return>
-</function>
-
-
 <!-- I don't know what this GTK+ documentation means by "update its internal state". murrayc. -->
 <function name="gtk_widget_add_mnemonic_label">
 <description>
diff --git a/gtk/src/icontheme.ccg b/gtk/src/icontheme.ccg
index de6ddda9..620d1755 100644
--- a/gtk/src/icontheme.ccg
+++ b/gtk/src/icontheme.ccg
@@ -44,11 +44,5 @@ std::vector<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name) const
   return Glib::ArrayHandler<int>::array_to_vector(pArrayInts, Glib::OWNERSHIP_SHALLOW);
 }
 
-std::vector<Glib::ustring> IconTheme::list_icons() const
-{
-  return 
Glib::ListHandler<Glib::ustring>::list_to_vector(gtk_icon_theme_list_icons(const_cast<GtkIconTheme*>(gobj()), 
nullptr /* means all icons according to the C documentation. */ ), Glib::OWNERSHIP_SHALLOW);
-}
-
-
 } // namespace Gtk
 
diff --git a/gtk/src/icontheme.hg b/gtk/src/icontheme.hg
index 420cd465..fce33fec 100644
--- a/gtk/src/icontheme.hg
+++ b/gtk/src/icontheme.hg
@@ -107,16 +107,23 @@ public:
     int scale, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon_for_scale, 
errthrow)
 
 #m4 _CONVERSION(`GList*',`std::vector<Glib::ustring>',`Glib::ListHandler<Glib::ustring>::list_to_vector($3, 
Glib::OWNERSHIP_DEEP)')
-  _WRAP_METHOD(std::vector<Glib::ustring> list_icons(const Glib::ustring& context) const, 
gtk_icon_theme_list_icons)
-
   /** Lists the icons in the current icon theme.
    *
-   * @return A list holding the names of all the
-   * icons in the theme.
+   * Only a subset of the icons can be listed by providing a context string.
+   * The set of values for the context string is system dependent,
+   * but will typically include such values as “Applications” and
+   * “MimeTypes”. Contexts are explained in the
+   * <a href="http://www.freedesktop.org/wiki/Specifications/icon-theme-spec";>Icon Theme Specification</a>.
+   * The standard contexts are listed in the
+   * <a href="http://www.freedesktop.org/wiki/Specifications/icon-naming-spec";>Icon Naming Specification</a>.
+   * Also see list_contexts().
    *
-   * @newin{2,10}
+   * @param context A string identifying a particular type of icon,
+   *        or an empty string to list all icons.
+   * @return A vector holding the names of all the icons in the theme,
+   *         or all the icons in the context.
    */
-   std::vector<Glib::ustring> list_icons() const;
+  _WRAP_METHOD(std::vector<Glib::ustring> list_icons(const Glib::ustring& context{NULL} = {}) const, 
gtk_icon_theme_list_icons)
 
   _WRAP_METHOD(std::vector<Glib::ustring> list_contexts() const, gtk_icon_theme_list_contexts)
 
diff --git a/gtk/src/iconview.hg b/gtk/src/iconview.hg
index ec662127..8cf371df 100644
--- a/gtk/src/iconview.hg
+++ b/gtk/src/iconview.hg
@@ -176,23 +176,7 @@ public:
   _WRAP_METHOD(int get_item_row(const TreeModel::Path& path) const, gtk_icon_view_get_item_row)
   _WRAP_METHOD(int get_item_column(const TreeModel::Path& path) const, gtk_icon_view_get_item_column)
 
-
-  #ifndef DOXYGEN_SHOULD_SKIP_THIS
-  //TODO: I'm not sure about these to_*() functions. murrayc.
-  struct TreePathTraits
-  {
-    typedef TreePath  CppType;
-    typedef const GtkTreePath* CType;
-    typedef GtkTreePath*    CTypeNonConst;
-
-    static CType   to_c_type      (const CppType& obj) { return obj.gobj(); }
-    static CType   to_c_type      (const CType&   obj) { return obj; }
-    static CppType to_cpp_type    (const CType&   obj) { return CppType(const_cast<CTypeNonConst>(obj), 
true); }
-    static void    release_c_type (const CType&)       {}
-  };
-  #endif //DOXYGEN_SHOULD_SKIP_THIS
-
-#m4 _CONVERSION(`GList*',`std::vector<TreePath>',`Glib::ListHandler<TreePath, 
TreePathTraits>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
+#m4 _CONVERSION(`GList*',`std::vector<TreePath>',`Glib::ListHandler<TreePath, 
TreePathTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(std::vector<TreePath> get_selected_items() const, gtk_icon_view_get_selected_items)
 
   _WRAP_METHOD(void select_all(), gtk_icon_view_select_all)
diff --git a/gtk/src/recentmanager.hg b/gtk/src/recentmanager.hg
index 30c774a4..356dfa98 100644
--- a/gtk/src/recentmanager.hg
+++ b/gtk/src/recentmanager.hg
@@ -18,11 +18,8 @@
 _CONFIGINCLUDE(gtkmmconfig.h)
 
 #include <vector>
-
 #include <gdkmm/pixbuf.h>
-
 #include <gtkmm/recentinfo.h>
-
 #include <glibmm/object.h>
 
 _DEFS(gtkmm,gtk)
@@ -115,8 +112,7 @@ public:
   _WRAP_METHOD(bool has_item(const Glib::ustring& uri) const, gtk_recent_manager_has_item)
   _WRAP_METHOD(bool move_item(const Glib::ustring& uri, const Glib::ustring& new_uri), 
gtk_recent_manager_move_item, errthrow)
 
-#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<RecentInfo> 
',`Glib::ListHandler<Glib::RefPtr<RecentInfo>, RecentInfoTraits>::list_to_vector($3, 
Glib::OWNERSHIP_SHALLOW)')
-
+#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<RecentInfo> 
',`Glib::ListHandler<Glib::RefPtr<RecentInfo>, RecentInfoTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(std::vector<Glib::RefPtr<RecentInfo> > get_items() const, gtk_recent_manager_get_items)
 
   _WRAP_METHOD(int purge_items(), gtk_recent_manager_purge_items, errthrow)


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