[gtkmm] Gtk::IconInfo: Inherit from Glib::Object



commit 66cd2d9f0826c08164faf11d36812a71fead53d4
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Tue Jan 9 08:59:33 2018 +0100

    Gtk::IconInfo: Inherit from Glib::Object
    
    * gdk/gdkmm/general.[cc|h]: Gdk::Cairo::set_source_pixbuf() accepts a
    constant pixbuf.
    * gtk/src/iconinfo.[ccg|hg]: GtkIconInfo became a subclass of GObject
    in 2013. Now Gtk::IconInfo is a subclass of Glib::Object.
    Use _WRAP_METHOD() instead of hand-coded methods where possible.
    Make IconInfo more const-correct. All the load_*() methods return
    objects that must not be modified by the caller.
    * gtk/src/icontheme.hg: Methods that have returned an IconInfo, now return
    a Glib::RefPtr<IconInfo> or a Glib::RefPtr<const IconInfo>.
    load_icon() returns a constant pixbuf. It must not be modified by the caller.
    * gtk/src/selectiondata.hg: set_pixbuf(), set_surface() and set_texture()
    accept a constant pixbuf, surface or texture.
    * tools/m4/convert_gdk.m4: Add a conversion for constant pixbuf.
    * tools/m4/convert_gtk.m4: Modified conversions for IconInfo.
    Add a conversion for constant Cairo::Surface.
    * demos/gtk-demo/example_iconbrowser.cc: DetailDialog::get_icon()
    returns a constant pixbuf.

 demos/gtk-demo/example_iconbrowser.cc |    8 +-
 gdk/gdkmm/general.cc                  |    2 +-
 gdk/gdkmm/general.h                   |    2 +-
 gtk/src/iconinfo.ccg                  |  133 +--------------------------------
 gtk/src/iconinfo.hg                   |  120 +++++++++++------------------
 gtk/src/icontheme.hg                  |   30 +++++--
 gtk/src/selectiondata.hg              |    9 ++-
 tools/m4/convert_gdk.m4               |    1 +
 tools/m4/convert_gtk.m4               |    6 +-
 9 files changed, 84 insertions(+), 227 deletions(-)
---
diff --git a/demos/gtk-demo/example_iconbrowser.cc b/demos/gtk-demo/example_iconbrowser.cc
index c25c0e2..db2ed03 100644
--- a/demos/gtk-demo/example_iconbrowser.cc
+++ b/demos/gtk-demo/example_iconbrowser.cc
@@ -95,7 +95,7 @@ protected:
   void on_image_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context,
     Gtk::SelectionData& selection_data, guint time, int size_index);
 
-  Glib::RefPtr<Gdk::Pixbuf> get_icon(int size_index);
+  Glib::RefPtr<const Gdk::Pixbuf> get_icon(int size_index);
 
   static const int n_icon_sizes = 5;
   static const int m_icon_size[n_icon_sizes];
@@ -957,16 +957,16 @@ void DetailDialog::on_image_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&
   selection_data.set_pixbuf(get_icon(size_index));
 }
 
-Glib::RefPtr<Gdk::Pixbuf> DetailDialog::get_icon(int size_index)
+Glib::RefPtr<const Gdk::Pixbuf> DetailDialog::get_icon(int size_index)
 {
   auto context = m_image[size_index].get_style_context();
   auto info = Gtk::IconTheme::get_default()->lookup_icon(
     m_icon_name, m_icon_size[size_index]);
-  Glib::RefPtr<Gdk::Pixbuf> pixbuf;
+  Glib::RefPtr<const Gdk::Pixbuf> pixbuf;
   try
   {
     bool is_symbolic = false;
-    pixbuf = info.load_symbolic_for_context(context, is_symbolic);
+    pixbuf = info->load_symbolic_for_context(context, is_symbolic);
   }
   catch (const Glib::Error& err)
   {
diff --git a/gdk/gdkmm/general.cc b/gdk/gdkmm/general.cc
index b9e9e79..2f42789 100644
--- a/gdk/gdkmm/general.cc
+++ b/gdk/gdkmm/general.cc
@@ -31,7 +31,7 @@ void set_source_rgba(const ::Cairo::RefPtr< ::Cairo::Context >& context, const G
   gdk_cairo_set_source_rgba(context->cobj(), const_cast<GdkRGBA*>(color.gobj()));
 }
 
-void set_source_pixbuf(const ::Cairo::RefPtr< ::Cairo::Context >& context, const Glib::RefPtr<Gdk::Pixbuf>& 
pixbuf, double pixbuf_x, double pixbuf_y)
+void set_source_pixbuf(const ::Cairo::RefPtr< ::Cairo::Context >& context, const Glib::RefPtr<const 
Gdk::Pixbuf>& pixbuf, double pixbuf_x, double pixbuf_y)
 {
   gdk_cairo_set_source_pixbuf(context->cobj(), pixbuf->gobj(), pixbuf_x, pixbuf_y);
 }
diff --git a/gdk/gdkmm/general.h b/gdk/gdkmm/general.h
index 3477324..aae46c0 100644
--- a/gdk/gdkmm/general.h
+++ b/gdk/gdkmm/general.h
@@ -52,7 +52,7 @@ void set_source_rgba(const ::Cairo::RefPtr< ::Cairo::Context >& context, const G
  * @newin{2,10}
  */
 void set_source_pixbuf(const ::Cairo::RefPtr< ::Cairo::Context >& context,
-  const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, double pixbuf_x = 0, double pixbuf_y = 0);
+  const Glib::RefPtr<const Gdk::Pixbuf>& pixbuf, double pixbuf_x = 0, double pixbuf_y = 0);
 
 /** Adds the given rectangle to the current path of the context.
  *
diff --git a/gtk/src/iconinfo.ccg b/gtk/src/iconinfo.ccg
index d7d239e..9f7441d 100644
--- a/gtk/src/iconinfo.ccg
+++ b/gtk/src/iconinfo.ccg
@@ -19,19 +19,12 @@
 
 #include <gtk/gtk.h>
 #include <gdkmm/cairoutils.h>
+#include <gdkmm/texture.h>
 #include <gtkmm/icontheme.h>
 //TODO: Install and use this? #include <giomm/slot_async.h>
 
 namespace {
 
-//This is just to satisfy our generated code, which cannot
-//handle just using g_object_ref() because it needs a cast.
-static GtkIconInfo* gtk_icon_info_ref(GtkIconInfo* icon_info)
-{
-  g_object_ref (G_OBJECT(icon_info));
-  return icon_info;
-}
-
 //TODO: Install and use giomm's slot_async.h if we use this more often:
 static void
 SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data)
@@ -57,130 +50,8 @@ namespace Gtk
 {
 
 IconInfo::IconInfo(const Glib::RefPtr<IconTheme>& icon_theme, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
-: gobject_( gtk_icon_info_new_for_pixbuf(Glib::unwrap(icon_theme), pixbuf->gobj()) )
-{
-}
-
-IconInfo::operator bool() const
-{
-  return gobj();
-}
-
-
-Glib::RefPtr<Gdk::Pixbuf> IconInfo::load_symbolic(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const 
Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, bool& was_symbolic)
-{
-  GError* gerror = nullptr;
-  gboolean c_was_symbolic = false;
-  auto retvalue = Glib::wrap(gtk_icon_info_load_symbolic(const_cast<GtkIconInfo*>(gobj()), 
const_cast<GdkRGBA*>(fg.gobj()), const_cast<GdkRGBA*>(success_color.gobj()), 
const_cast<GdkRGBA*>(warning_color.gobj()), const_cast<GdkRGBA*>(error_color.gobj()), &c_was_symbolic, 
&(gerror)));
-  was_symbolic = c_was_symbolic;
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-
-  return retvalue;
-}
-
-Glib::RefPtr<Gdk::Pixbuf> IconInfo::load_symbolic_for_context(const Glib::RefPtr<StyleContext>& context, 
bool& was_symbolic)
+: Glib::Object((GObject*)gtk_icon_info_new_for_pixbuf(Glib::unwrap(icon_theme), pixbuf->gobj()))
 {
-  GError* gerror = nullptr;
-  gboolean c_was_symbolic = false;
-  auto retvalue = Glib::wrap(gtk_icon_info_load_symbolic_for_context(gobj(), Glib::unwrap(context), 
&c_was_symbolic, &(gerror)));
-  was_symbolic = c_was_symbolic;
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-
-  return retvalue;
 }
 
-
-void IconInfo::load_icon_async(const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& 
cancellable)
-{
-  // Create a copy of the slot.
-  // A pointer to it will be passed through the callback's data parameter
-  // and deleted in the callback.
-  auto slot_copy = new Gio::SlotAsyncReady(slot);
-
-  gtk_icon_info_load_icon_async(gobj(),
-    Glib::unwrap(cancellable),
-    &SignalProxy_async_callback,
-    slot_copy);
-}
-
-void IconInfo::load_icon_async(const Gio::SlotAsyncReady& slot)
-{
-  // Create a copy of the slot.
-  // A pointer to it will be passed through the callback's data parameter
-  // and deleted in the callback.
-  auto slot_copy = new Gio::SlotAsyncReady(slot);
-
-  gtk_icon_info_load_icon_async(gobj(),
-    nullptr,
-    &SignalProxy_async_callback,
-    slot_copy);
-}
-
-
-void IconInfo::load_symbolic_async(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& 
warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot, const 
Glib::RefPtr<Gio::Cancellable>& cancellable)
-{
-  // Create a copy of the slot.
-  // A pointer to it will be passed through the callback's data parameter
-  // and deleted in the callback.
-  auto slot_copy = new Gio::SlotAsyncReady(slot);
-
-  gtk_icon_info_load_symbolic_async(gobj(),
-    fg.gobj(),
-    success_color.gobj(),
-    warning_color.gobj(),
-    error_color.gobj(),
-    Glib::unwrap(cancellable),
-    &SignalProxy_async_callback,
-    slot_copy);
-}
-
-void IconInfo::load_symbolic_async(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& 
warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot)
-{
-  // Create a copy of the slot.
-  // A pointer to it will be passed through the callback's data parameter
-  // and deleted in the callback.
-  auto slot_copy = new Gio::SlotAsyncReady(slot);
-
-  gtk_icon_info_load_symbolic_async(gobj(),
-    fg.gobj(),
-    success_color.gobj(),
-    warning_color.gobj(),
-    error_color.gobj(),
-    nullptr,
-    &SignalProxy_async_callback,
-    slot_copy);
-}
-
-
-void IconInfo::load_symbolic_for_context_async(const Glib::RefPtr<StyleContext>& context, const 
Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
-{
-  // Create a copy of the slot.
-  // A pointer to it will be passed through the callback's data parameter
-  // and deleted in the callback.
-  auto slot_copy = new Gio::SlotAsyncReady(slot);
-
-  gtk_icon_info_load_symbolic_for_context_async(gobj(),
-    Glib::unwrap(context),
-    Glib::unwrap(cancellable),
-    &SignalProxy_async_callback,
-    slot_copy);
-}
-
-void IconInfo::load_symbolic_for_context_async(const Glib::RefPtr<StyleContext>& context, const 
Gio::SlotAsyncReady& slot)
-{
-  // Create a copy of the slot.
-  // A pointer to it will be passed through the callback's data parameter
-  // and deleted in the callback.
-  auto slot_copy = new Gio::SlotAsyncReady(slot);
-
-  gtk_icon_info_load_symbolic_for_context_async(gobj(),
-    Glib::unwrap(context),
-    nullptr,
-    &SignalProxy_async_callback,
-    slot_copy);
-}
-
-
 } // namespace Gtk
diff --git a/gtk/src/iconinfo.hg b/gtk/src/iconinfo.hg
index 2435304..572abe9 100644
--- a/gtk/src/iconinfo.hg
+++ b/gtk/src/iconinfo.hg
@@ -26,106 +26,76 @@
 #include <giomm/cancellable.h>
 
 _DEFS(gtkmm,gtk)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gdk
+{
+class Texture;
+}
 
 namespace Gtk
 {
 
 class IconTheme;
 
-class IconInfo
+class IconInfo : public Glib::Object
 {
-  _CLASS_BOXEDTYPE(IconInfo, GtkIconInfo, NONE, gtk_icon_info_ref, g_object_unref)
-public:
+  _CLASS_GOBJECT(IconInfo, GtkIconInfo, GTK_ICON_INFO, Glib::Object, GObject)
 
+protected:
+  // Can't use _WRAP_CTOR(), because there are no properties that correspond
+  // to the constructor's parameters.
   IconInfo(const Glib::RefPtr<IconTheme>& icon_theme, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
   _IGNORE(gtk_icon_info_new_for_pixbuf)
 
-   /** Tests whether the IconInfo is valid.
-    *
-    * @newin{3,22}
-    */
-   explicit operator bool() const;
+public:
+  /** Creates an %IconInfo for a Gdk::Pixbuf.
+   *
+   * @newin{3,92}
+   *
+   * @param icon_theme A Gtk::IconTheme.
+   * @param pixbuf The pixbuf to wrap in an %IconInfo.
+   * @return A RefPtr to a new %IconInfo.
+   */
+  _WRAP_CREATE(const Glib::RefPtr<IconTheme>& icon_theme, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
 
   _WRAP_METHOD(int get_base_size() const, gtk_icon_info_get_base_size)
   _WRAP_METHOD(int get_base_scale() const, gtk_icon_info_get_base_scale)
 
   _WRAP_METHOD(Glib::ustring get_filename() const, gtk_icon_info_get_filename)
-  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(), gtk_icon_info_load_icon, errthrow)
+  _WRAP_METHOD(bool is_symbolic() const, gtk_icon_info_is_symbolic)
 
+  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> load_icon() const, gtk_icon_info_load_icon, errthrow)
   _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> load_surface(const Glib::RefPtr<Gdk::Window>& for_window) 
const, gtk_icon_info_load_surface, errthrow)
+  _WRAP_METHOD(Glib::RefPtr<const Gdk::Texture> load_texture() const, gtk_icon_info_load_texture)
 
-  //TODO: Documentation
-  Glib::RefPtr<Gdk::Pixbuf> load_symbolic(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const 
Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, bool& was_symbolic);
-  _IGNORE(gtk_icon_info_load_symbolic)
-
-  /** Asynchronously load, render and scale an icon previously looked up from the icon theme using 
Gtk::IconTheme::lookup_icon().
-   *
-   * @param slot A callback slot to call when the request is satisfied.
-   * @param cancellable A Cancellable object which can be used to cancel the operation.
-   *
-   * @newin{3,8}
-   */
-  void load_icon_async(const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable);
-
-  /** Asynchronously load, render and scale an icon previously looked up from the icon theme using 
Gtk::IconTheme::lookup_icon().
-   *
-   * @param slot A callback slot to call when the request is satisfied.
-   *
-   * @newin{3,8}
-   */
-  void load_icon_async(const Gio::SlotAsyncReady& slot);
-  _IGNORE(gtk_icon_info_load_icon_async)
-
- _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon_finish(const Glib::RefPtr<Gio::AsyncResult>& result), 
gtk_icon_info_load_icon_finish, errthrow)
+  _WRAP_METHOD(void load_icon_async(const Gio::SlotAsyncReady& slot{callback}, const 
Glib::RefPtr<Gio::Cancellable>& cancellable{.?}) const,
+    gtk_icon_info_load_icon_async, slot_name slot, slot_callback SignalProxy_async_callback)
+  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> load_icon_finish(const Glib::RefPtr<Gio::AsyncResult>& 
result) const,
+    gtk_icon_info_load_icon_finish, errthrow)
 
 
-  /** Loads an icon, modifying it to match the system colors for the foreground, success, warning and error 
colors provided.
-   * If the icon is not a symbolic one, this method will return the result from load_icon().
-   * This method uses the regular foreground color and the symbolic colors with the names "success_color",
-   * "warning_color" and "error_color" from the context.
-   *
-   * This allows loading symbolic icons that will match the system theme.
-   *
-   * @param context A StyleContext.
-   * @param was_symbolic Whether the loaded icon was a symbolic one and whether the fg color was applied to 
it.
-   */
-  Glib::RefPtr<Gdk::Pixbuf> load_symbolic_for_context(const Glib::RefPtr<StyleContext>& context, bool& 
was_symbolic);
-  _IGNORE(gtk_icon_info_load_symbolic_for_context)
+  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> load_symbolic(const Gdk::RGBA& fg, const Gdk::RGBA& 
success_color,
+    const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, bool& was_symbolic{>>}) const,
+    gtk_icon_info_load_symbolic, errthrow)
 
-  /** Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using 
Gtk::IconTheme::lookup_icon().
-   * For more details, see load_symbolic_for_context() which is the synchronous version of this call.
-   *
-   * @param context A StyleContext.
-   * @param slot A callback slot to call when the request is satisfied.
-   * @param cancellable A Cancellable object which can be used to cancel the operation.
-   *
-   * @newin{3,8}
-   */
-  void load_symbolic_for_context_async(const Glib::RefPtr<StyleContext>& context, const Gio::SlotAsyncReady& 
slot, const Glib::RefPtr<Gio::Cancellable>& cancellable);
+  // In gtk_icon_info_load_symbolic_async(), each GdkRGBA* can be NULL, but we do not want that many method 
overloads.
+  _WRAP_METHOD(void load_symbolic_async(const Gdk::RGBA& fg, const Gdk::RGBA& success_color,
+    const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot{callback},
+    const Glib::RefPtr<Gio::Cancellable>& cancellable{.?}) const,
+    gtk_icon_info_load_symbolic_async, slot_name slot, slot_callback SignalProxy_async_callback)
+  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> load_symbolic_finish(const Glib::RefPtr<Gio::AsyncResult>& 
result,
+    bool& was_symbolic{>>}) const, gtk_icon_info_load_symbolic_finish, errthrow)
 
-  /** Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using 
Gtk::IconTheme::lookup_icon().
-   * For more details, see load_symbolic_for_context() which is the synchronous version of this call.
-   *
-   * @param context A StyleContext.
-   * @param slot A callback slot to call when the request is satisfied.
-   *
-   * @newin{3,8}
-   */
-  void load_symbolic_for_context_async(const Glib::RefPtr<StyleContext>& context, const Gio::SlotAsyncReady& 
slot);
-  _IGNORE(gtk_icon_info_load_symbolic_for_context_async)
-
- _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_symbolic_for_context_finish(const 
Glib::RefPtr<Gio::AsyncResult>& result, bool& was_symbolic), gtk_icon_info_load_symbolic_for_context_finish, 
errthrow)
 
+  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> load_symbolic_for_context(const Glib::RefPtr<StyleContext>& 
context,
+    bool& was_symbolic{>>}) const, gtk_icon_info_load_symbolic_for_context, errthrow)
 
-  //TODO: In gtk_icon_info_load_symbolic_async(), each GdkRGBA* can be NULL, but we do not want that many 
method overloads.
-  //TODO: Documentation.
-  void load_symbolic_async(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& 
warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot, const 
Glib::RefPtr<Gio::Cancellable>& cancellable);
-  void load_symbolic_async(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& 
warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot);
-  _IGNORE(gtk_icon_info_load_symbolic_async)
-
-  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_symbolic_finish(const Glib::RefPtr<Gio::AsyncResult>& result, 
bool& was_symbolic), gtk_icon_info_load_symbolic_finish, errthrow)
-
-  _WRAP_METHOD(bool is_symbolic() const, gtk_icon_info_is_symbolic)
+  _WRAP_METHOD(void load_symbolic_for_context_async(const Glib::RefPtr<StyleContext>& context,
+    const Gio::SlotAsyncReady& slot{callback}, const Glib::RefPtr<Gio::Cancellable>& cancellable{.?}) const,
+    gtk_icon_info_load_symbolic_for_context_async, slot_name slot, slot_callback SignalProxy_async_callback)
+ _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> load_symbolic_for_context_finish(const 
Glib::RefPtr<Gio::AsyncResult>& result,
+   bool& was_symbolic{>>}) const, gtk_icon_info_load_symbolic_for_context_finish, errthrow)
 };
 
 } // namespace Gtk
diff --git a/gtk/src/icontheme.hg b/gtk/src/icontheme.hg
index 314e82f..d67643f 100644
--- a/gtk/src/icontheme.hg
+++ b/gtk/src/icontheme.hg
@@ -61,17 +61,29 @@ public:
   std::vector<int> get_icon_sizes(const Glib::ustring& icon_name) const;
   _IGNORE(gtk_icon_theme_get_icon_sizes)
 
-  _WRAP_METHOD(IconInfo lookup_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags = 
(IconLookupFlags)0) const, gtk_icon_theme_lookup_icon)
-  _WRAP_METHOD(IconInfo lookup_icon(const Glib::ustring& icon_name, int size, int scale, IconLookupFlags 
flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_icon_for_scale)
-  _WRAP_METHOD(IconInfo lookup_icon(const Glib::RefPtr<const Gio::Icon>& icon, int size, IconLookupFlags 
flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_by_gicon)
-  _WRAP_METHOD(IconInfo lookup_icon(const Glib::RefPtr<const Gio::Icon>& icon, int size, int scale, 
IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_by_gicon_for_scale)
+  _WRAP_METHOD(Glib::RefPtr<IconInfo> lookup_icon(const Glib::ustring& icon_name, int size, IconLookupFlags 
flags = (IconLookupFlags)0), gtk_icon_theme_lookup_icon)
+  _WRAP_METHOD(Glib::RefPtr<const IconInfo> lookup_icon(const Glib::ustring& icon_name, int size, 
IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_icon, constversion)
 
-  #m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const gchar*[]',`const_cast<const 
gchar**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array($3).data ())')
-  _WRAP_METHOD(IconInfo choose_icon(const std::vector<Glib::ustring>& icon_names, int size, IconLookupFlags 
flags = (IconLookupFlags)0), gtk_icon_theme_choose_icon)
-  _WRAP_METHOD(IconInfo choose_icon(const std::vector<Glib::ustring>& icon_names, int size, int scale, 
IconLookupFlags flags = (IconLookupFlags)0), gtk_icon_theme_choose_icon_for_scale)
+  _WRAP_METHOD(Glib::RefPtr<IconInfo> lookup_icon(const Glib::ustring& icon_name, int size, int scale, 
IconLookupFlags flags = (IconLookupFlags)0), gtk_icon_theme_lookup_icon_for_scale)
+  _WRAP_METHOD(Glib::RefPtr<const IconInfo> lookup_icon(const Glib::ustring& icon_name, int size, int scale, 
IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_icon_for_scale, constversion)
 
-  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags 
flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon, errthrow)
-    _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, int scale, 
IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon_for_scale, errthrow)
+  _WRAP_METHOD(Glib::RefPtr<IconInfo> lookup_icon(const Glib::RefPtr<const Gio::Icon>& icon, int size, 
IconLookupFlags flags = (IconLookupFlags)0), gtk_icon_theme_lookup_by_gicon)
+  _WRAP_METHOD(Glib::RefPtr<const IconInfo> lookup_icon(const Glib::RefPtr<const Gio::Icon>& icon, int size, 
IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_by_gicon, constversion)
+
+  _WRAP_METHOD(Glib::RefPtr<IconInfo> lookup_icon(const Glib::RefPtr<const Gio::Icon>& icon, int size, int 
scale, IconLookupFlags flags = (IconLookupFlags)0), gtk_icon_theme_lookup_by_gicon_for_scale)
+  _WRAP_METHOD(Glib::RefPtr<const IconInfo> lookup_icon(const Glib::RefPtr<const Gio::Icon>& icon, int size, 
int scale, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_by_gicon_for_scale, 
constversion)
+
+  #m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const gchar*[]',`const_cast<const 
gchar**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array($3).data())')
+  _WRAP_METHOD(Glib::RefPtr<IconInfo> choose_icon(const std::vector<Glib::ustring>& icon_names, int size, 
IconLookupFlags flags = (IconLookupFlags)0), gtk_icon_theme_choose_icon)
+  _WRAP_METHOD(Glib::RefPtr<const IconInfo> choose_icon(const std::vector<Glib::ustring>& icon_names, int 
size, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_choose_icon, constversion)
+
+  _WRAP_METHOD(Glib::RefPtr<IconInfo> choose_icon(const std::vector<Glib::ustring>& icon_names, int size, 
int scale, IconLookupFlags flags = (IconLookupFlags)0), gtk_icon_theme_choose_icon_for_scale)
+  _WRAP_METHOD(Glib::RefPtr<const IconInfo> choose_icon(const std::vector<Glib::ustring>& icon_names, int 
size, int scale, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_choose_icon_for_scale, 
constversion)
+
+  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size,
+    IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon, errthrow)
+  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size,
+    int scale, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon_for_scale, 
errthrow)
 
   _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> load_surface(const Glib::ustring& icon_name,
     int size, int scale, const Glib::RefPtr<Gdk::Window>& for_window, IconLookupFlags flags = 
(IconLookupFlags)0) const,
diff --git a/gtk/src/selectiondata.hg b/gtk/src/selectiondata.hg
index cd25982..1e320a7 100644
--- a/gtk/src/selectiondata.hg
+++ b/gtk/src/selectiondata.hg
@@ -79,15 +79,18 @@ public:
   Glib::ustring get_text() const;
   _IGNORE(gtk_selection_data_get_text)
 
-  _WRAP_METHOD(bool set_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_selection_data_set_pixbuf)
+  // The Gdk::Pixbuf can be const because set_pixbuf() copies the data in the pixbuf.
+  _WRAP_METHOD(bool set_pixbuf(const Glib::RefPtr<const Gdk::Pixbuf>& pixbuf), gtk_selection_data_set_pixbuf)
   // get_pixbuf() is const because it returns a newly allocated pixbuf.
   _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_pixbuf() const, gtk_selection_data_get_pixbuf)
 
-  _WRAP_METHOD(bool set_surface(const Cairo::RefPtr<Cairo::Surface>& surface), 
gtk_selection_data_set_surface)
+  // The Cairo::Surface can be const because set_surface() copies the data in the surface.
+  _WRAP_METHOD(bool set_surface(const Cairo::RefPtr<const Cairo::Surface>& surface), 
gtk_selection_data_set_surface)
   // get_surface() is const because it returns a newly allocated cairo surface.
   _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_surface() const, gtk_selection_data_get_surface)
 
-  _WRAP_METHOD(bool set_texture(const Glib::RefPtr<Gdk::Texture>& texture), gtk_selection_data_set_texture)
+  // The Gdk::Texture can be const because set_texture() copies the data in the texture.
+  _WRAP_METHOD(bool set_texture(const Glib::RefPtr<const Gdk::Texture>& texture), 
gtk_selection_data_set_texture)
   // get_texture() is const because it returns a newly allocated texture.
   _WRAP_METHOD(Glib::RefPtr<Gdk::Texture> get_texture() const, gtk_selection_data_get_texture)
 
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index 55e8dd3..57c858f 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -129,6 +129,7 @@ _CONVERSION(`const Glib::RefPtr<const Drawable>&',`GdkDrawable*',__CONVERT_CONST
 _CONVERSION(`const Glib::RefPtr<Pixbuf>&',`GdkPixbuf*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const Pixbuf>&',`const GdkPixbuf*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const Pixbuf>&',`GdkPixbuf*',__CONVERT_CONST_REFPTR_TO_P_SUN(Pixbuf))
+_CONVERSION(`const Glib::RefPtr<const Gdk::Pixbuf>&',`GdkPixbuf*',__CONVERT_CONST_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<Gdk::Pixbuf>&',`GdkPixbuf*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`Glib::RefPtr<Gdk::Pixbuf>',`GdkPixbuf*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<Gdk::PixbufAnimation>&',`GdkPixbufAnimation*',__CONVERT_REFPTR_TO_P)
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 3d59353..4b0a887 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -288,6 +288,8 @@ _CONVERSION(Gtk::Notebook_Helpers::Page*,GtkNotebookPage*,`($1)((void*)($3))',`(
 
 _CONVERSION(`GtkSettings*',`Glib::RefPtr<Settings>', Glib::wrap($3))
 
+_CONVERSION(`GtkIconInfo*',`Glib::RefPtr<IconInfo>',`Glib::wrap($3)')
+_CONVERSION(`GtkIconInfo*',`Glib::RefPtr<const IconInfo>',`Glib::wrap($3)')
 _CONVERSION(`GtkIconTheme*',`Glib::RefPtr<IconTheme>',`Glib::wrap($3)')
 
 _CONVERSION(`GtkWindowGroup*',`Glib::RefPtr<WindowGroup>',`Glib::wrap($3)')
@@ -395,9 +397,6 @@ _CONVERSION(const Gtk::Widget&,GtkWidget*,__CFR2P)
 
 _CONVERSION(`const Glib::RefPtr<Tooltip>&',`GtkTooltip*',__CONVERT_REFPTR_TO_P)
 
-#IconInfo
-_CONVERSION(`GtkIconInfo*',`IconInfo',`Glib::wrap($3)')
-
 _CONVERSION(`Requisition&', `GtkRequisition*', `($2)(&$3)')
 _CONVERSION(`const Requisition&', `GtkRequisition*', `($2)(&$3)')
 _CONVERSION(`GtkRequisition*', `Requisition&', `($2)(*$3)')
@@ -499,6 +498,7 @@ _CONVERSION(`const Cairo::FontOptions&',`const cairo_font_options_t*',`($3).cobj
 _CONVERSION(`const Cairo::RefPtr<const Cairo::Region>&',`cairo_region_t*',`const_cast<cairo_region_t*>(($3) 
? ($3)->cobj() : nullptr)')
 _CONVERSION(`const Cairo::RefPtr<const Cairo::Region>&',`const cairo_region_t*',`(($3) ? ($3)->cobj() : 
nullptr)')
 _CONVERSION(`const Cairo::RefPtr<Cairo::Surface>&',`cairo_surface_t*',`(($3) ? ($3)->cobj() : nullptr)')
+_CONVERSION(`const Cairo::RefPtr<const 
Cairo::Surface>&',`cairo_surface_t*',`const_cast<cairo_surface_t*>(($3) ? ($3)->cobj() : nullptr)')
 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Gdk::Cairo::wrap($3)')
 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<const Cairo::Surface>',`Gdk::Cairo::wrap($3)')
 


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