[glibmm] Gio::ThemedIcon: Add create(const std::vector<Glib::ustring>& iconnames)



commit 51f7915c91a00196b08ebc9e691e24e6eb71d8f6
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sun Jan 27 18:11:02 2019 +0100

    Gio::ThemedIcon: Add create(const std::vector<Glib::ustring>& iconnames)
    
    And change the type of icon names to Glib::ustring in methods where it
    was std::string. Gtkmm consistently uses Glib::ustring for icon names,
    but Gio::ThemedIcon has been inconsistent. (The string returned by
    Gio::Icon::to_string() is not an icon name. It shall remain a std::string.)

 gio/src/themedicon.ccg |  7 ++++++-
 gio/src/themedicon.hg  | 25 ++++++++++++++++++++-----
 2 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/gio/src/themedicon.ccg b/gio/src/themedicon.ccg
index 48b76861..00fffc13 100644
--- a/gio/src/themedicon.ccg
+++ b/gio/src/themedicon.ccg
@@ -19,9 +19,14 @@
 namespace Gio
 {
 
-ThemedIcon::ThemedIcon(const std::string& iconname, bool use_default_fallbacks)
+ThemedIcon::ThemedIcon(const Glib::ustring& iconname, bool use_default_fallbacks)
 : _CONSTRUCT("name", iconname.c_str(), "use-default-fallbacks", gboolean(use_default_fallbacks))
 {
 }
 
+ThemedIcon::ThemedIcon(const std::vector<Glib::ustring>& iconnames)
+: _CONSTRUCT("names", Glib::ArrayHandler<Glib::ustring>::vector_to_array(iconnames).data())
+{
+}
+
 } // namespace Gio
diff --git a/gio/src/themedicon.hg b/gio/src/themedicon.hg
index 4d3616a0..9020e35f 100644
--- a/gio/src/themedicon.hg
+++ b/gio/src/themedicon.hg
@@ -49,9 +49,18 @@ protected:
    * @param iconname A string containing an icon name.
    * @param use_default_fallbacks Whether to use all the names that can be created by shortening @a iconname 
at '-' characters.
    */
-  explicit ThemedIcon(const std::string& iconname, bool use_default_fallbacks = false);
+  explicit ThemedIcon(const Glib::ustring& iconname, bool use_default_fallbacks = false);
   _IGNORE(g_themed_icon_new, g_themed_icon_new_with_default_fallbacks)
 
+  /** Creates a new themed icon for @a iconnames.
+   *
+   * @param iconnames A vector of strings containing icon names.
+   *
+   * @newin{2,60}
+   */
+  explicit ThemedIcon(const std::vector<Glib::ustring>& iconnames);
+  _IGNORE(g_themed_icon_new_from_names)
+
 public:
   /** Creates a new themed icon for @a iconname, and optionally all the names that can be created by 
shortening @a iconname at '-' characters.
    *
@@ -70,12 +79,18 @@ public:
    * @param iconname A string containing an icon name.
    * @param use_default_fallbacks Whether to use all the names that can be created by shortening @a iconname 
at '-' characters.
    */
-  _WRAP_CREATE(const std::string& iconname, bool use_default_fallbacks = false)
+  _WRAP_CREATE(const Glib::ustring& iconname, bool use_default_fallbacks = false)
 
-  //TODO: GIcon *g_themed_icon_new_from_names (char **iconnames, int len);
+  /** Creates a new themed icon for @a iconnames.
+   *
+   * @param iconnames A vector of strings containing icon names.
+   *
+   * @newin{2,60}
+   */
+  _WRAP_CREATE(const std::vector<Glib::ustring>& iconnames)
 
-  _WRAP_METHOD(void prepend_name(const std::string& iconname), g_themed_icon_prepend_name)
-  _WRAP_METHOD(void append_name(const std::string& iconname), g_themed_icon_append_name)
+  _WRAP_METHOD(void prepend_name(const Glib::ustring& iconname), g_themed_icon_prepend_name)
+  _WRAP_METHOD(void append_name(const Glib::ustring& iconname), g_themed_icon_append_name)
 
   #m4 _CONVERSION(`const gchar* 
const*',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3, 
Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(std::vector<Glib::ustring> get_names() const, g_themed_icon_get_names)


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