Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / icontheme.cc
index 4403fe61f0debdcf44c2f4204d347b5420d40ae1..8d51f6b170769617bb847f743637d89e5874cf27 100644 (file)
@@ -1,5 +1,6 @@
 // Generated by gtkmmproc -- DO NOT MODIFY!
 
+
 #include <gtkmm/icontheme.h>
 #include <gtkmm/private/icontheme_p.h>
 
@@ -34,10 +35,10 @@ void IconTheme::set_search_path(const Glib::ArrayHandle<Glib::ustring>& path)
 
 Glib::ArrayHandle<Glib::ustring> IconTheme::get_search_path() const
 {
-  int* temp_int = 0;
-  gchar*** temp_path = 0;
-  gtk_icon_theme_get_search_path(const_cast<GtkIconTheme*>(gobj()), temp_path, temp_int);
-  return Glib::ArrayHandle<Glib::ustring>((const char**)(*temp_path), *temp_int, Glib::OWNERSHIP_SHALLOW);
+  int temp_int = 0;
+  gchar** temp_path = 0;
+  gtk_icon_theme_get_search_path(const_cast<GtkIconTheme*>(gobj()), &temp_path, &temp_int);
+  return Glib::ArrayHandle<Glib::ustring>((const char**) temp_path, temp_int, Glib::OWNERSHIP_DEEP);
 }
 
 Glib::ArrayHandle<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name) const
@@ -45,9 +46,14 @@ Glib::ArrayHandle<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name)
   int* pArrayInts = gtk_icon_theme_get_icon_sizes(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str());
   
   //pArrayInts is null-terminated.
-  return Glib::ArrayHandle<int>(pArrayInts, Glib::OWNERSHIP_SHALLOW); //TODO: I'm not sure about the ownership. murrayc.
+  return Glib::ArrayHandle<int>(pArrayInts, Glib::OWNERSHIP_SHALLOW);
 }
   
+Glib::ListHandle<Glib::ustring> IconTheme::list_icons() const
+{
+  return Glib::ListHandle<Glib::ustring>(gtk_icon_theme_list_icons(const_cast<GtkIconTheme*>(gobj()), 0 /* means all icons according to the C documentation. */ ), Glib::OWNERSHIP_SHALLOW);
+}
+
 
 } // namespace Gtk
 
@@ -55,13 +61,15 @@ Glib::ArrayHandle<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name)
 namespace
 {
 
-const Glib::SignalProxyInfo IconTheme_signal_changed_info =
+
+static const Glib::SignalProxyInfo IconTheme_signal_changed_info =
 {
   "changed",
   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
 };
 
+
 } // anonymous namespace
 
 
@@ -80,10 +88,18 @@ Gtk::IconThemeError::Code Gtk::IconThemeError::code() const
   return static_cast<Code>(Glib::Error::code());
 }
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
 void Gtk::IconThemeError::throw_func(GError* gobject)
 {
   throw Gtk::IconThemeError(gobject);
 }
+#else
+//When not using exceptions, we just pass the Exception object around without throwing it:
+std::auto_ptr<Glib::Error> Gtk::IconThemeError::throw_func(GError* gobject)
+{
+  return std::auto_ptr<Glib::Error>(new Gtk::IconThemeError(gobject));
+}
+#endif //GLIBMM_EXCEPTIONS_ENABLED
 
 // static
 GType Glib::Value<Gtk::IconThemeError::Code>::value_type()
@@ -135,13 +151,21 @@ void IconTheme_Class::class_init_function(void* g_class, void* class_data)
   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
   CppClassParent::class_init_function(klass, class_data);
 
+#ifdef GLIBMM_VFUNCS_ENABLED
+#endif //GLIBMM_VFUNCS_ENABLED
+
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
   klass->changed = &changed_callback;
+#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 }
 
+#ifdef GLIBMM_VFUNCS_ENABLED
+#endif //GLIBMM_VFUNCS_ENABLED
 
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 void IconTheme_Class::changed_callback(GtkIconTheme* self)
 {
-  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
   // Non-gtkmmproc-generated custom classes implicitly call the default
@@ -149,29 +173,37 @@ void IconTheme_Class::changed_callback(GtkIconTheme* self)
   // generated classes can use this optimisation, which avoids the unnecessary
   // parameter conversions if there is no possibility of the virtual function
   // being overridden:
-  if(obj && obj->is_derived_())
+  if(obj_base && obj_base->is_derived_())
   {
-    try // Trap C++ exceptions which would normally be lost because this is a C callback.
-    {
-      // Call the virtual member method, which derived classes might override.
-      obj->on_changed();
-    }
-    catch(...)
+    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+    if(obj) // This can be NULL during destruction.
     {
-      Glib::exception_handlers_invoke();
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      try // Trap C++ exceptions which would normally be lost because this is a C callback.
+      {
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+        // Call the virtual member method, which derived classes might override.
+        obj->on_changed();
+        return;
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
     }
   }
-  else
-  {
-    BaseClassType *const base = static_cast<BaseClassType*>(
+  
+  BaseClassType *const base = static_cast<BaseClassType*>(
         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
     );
 
-    // Call the original underlying C function:
-    if(base && base->changed)
-      (*base->changed)(self);
-  }
+  // Call the original underlying C function:
+  if(base && base->changed)
+    (*base->changed)(self);
 }
+#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 
 
 Glib::ObjectBase* IconTheme_Class::wrap_new(GObject* object)
@@ -217,7 +249,8 @@ GType IconTheme::get_base_type()
 
 IconTheme::IconTheme()
 :
-  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
+  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+  Glib::ObjectBase(0),
   Glib::Object(Glib::ConstructParams(icontheme_class_.init()))
 {
   }
@@ -236,6 +269,7 @@ Glib::RefPtr<IconTheme> IconTheme::get_default()
   return retvalue;
 }
 
+
 Glib::RefPtr<IconTheme> IconTheme::get_for_screen(const Glib::RefPtr<Gdk::Screen>& screen)
 {
 
@@ -246,24 +280,25 @@ Glib::RefPtr<IconTheme> IconTheme::get_for_screen(const Glib::RefPtr<Gdk::Screen
   return retvalue;
 }
 
+
 void IconTheme::set_screen(const Glib::RefPtr<Gdk::Screen>& screen)
 {
-  gtk_icon_theme_set_screen(gobj(), Glib::unwrap(screen));
+gtk_icon_theme_set_screen(gobj(), Glib::unwrap(screen)); 
 }
 
 void IconTheme::append_search_path(const Glib::ustring& path)
 {
-  gtk_icon_theme_append_search_path(gobj(), path.c_str());
+gtk_icon_theme_append_search_path(gobj(), path.c_str()); 
 }
 
 void IconTheme::prepend_search_path(const Glib::ustring& path)
 {
-  gtk_icon_theme_prepend_search_path(gobj(), path.c_str());
+gtk_icon_theme_prepend_search_path(gobj(), path.c_str()); 
 }
 
 void IconTheme::set_custom_theme(const Glib::ustring& theme_name)
 {
-  gtk_icon_theme_set_custom_theme(gobj(), theme_name.c_str());
+gtk_icon_theme_set_custom_theme(gobj(), theme_name.c_str()); 
 }
 
 bool IconTheme::has_icon(const Glib::ustring& icon_name) const
@@ -276,12 +311,29 @@ IconInfo IconTheme::lookup_icon(const Glib::ustring& icon_name, int size, IconLo
   return Glib::wrap(gtk_icon_theme_lookup_icon(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str(), size, ((GtkIconLookupFlags)(flags))));
 }
 
-Glib::RefPtr<Gdk::Pixbuf> IconTheme::load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags) const
+IconInfo IconTheme::choose_icon(const Glib::StringArrayHandle& icon_names, int size, IconLookupFlags flags)
 {
-  GError *error = 0;
-  Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_theme_load_icon(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str(), size, ((GtkIconLookupFlags)(flags)), &(error)));
-  if(error) ::Glib::Error::throw_exception(error);
+  return Glib::wrap(gtk_icon_theme_choose_icon(gobj(), const_cast<const gchar**>((icon_names).data()), size, ((GtkIconLookupFlags)(flags))));
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<Gdk::Pixbuf> IconTheme::load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags) const
+#else
+Glib::RefPtr<Gdk::Pixbuf> IconTheme::load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags, std::auto_ptr<Glib::Error>& error) const
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_theme_load_icon(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str(), size, ((GtkIconLookupFlags)(flags)), &(gerror)));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
   return retvalue;
+
 }
 
 Glib::ListHandle<Glib::ustring> IconTheme::list_icons(const Glib::ustring& context) const
@@ -289,6 +341,11 @@ Glib::ListHandle<Glib::ustring> IconTheme::list_icons(const Glib::ustring& conte
   return Glib::ListHandle<Glib::ustring>(gtk_icon_theme_list_icons(const_cast<GtkIconTheme*>(gobj()), context.c_str()), Glib::OWNERSHIP_SHALLOW);
 }
 
+Glib::ListHandle<Glib::ustring> IconTheme::list_contexts() const
+{
+  return Glib::ListHandle<Glib::ustring>(gtk_icon_theme_list_contexts(const_cast<GtkIconTheme*>(gobj())), Glib::OWNERSHIP_SHALLOW);
+}
+
 Glib::ustring IconTheme::get_example_icon_name() const
 {
   return Glib::convert_return_gchar_ptr_to_ustring(gtk_icon_theme_get_example_icon_name(const_cast<GtkIconTheme*>(gobj())));
@@ -301,7 +358,7 @@ bool IconTheme::rescan_if_needed()
 
 void IconTheme::add_builtin_icon(const Glib::ustring& icon_name, int size, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
 {
-  gtk_icon_theme_add_builtin_icon(icon_name.c_str(), size, Glib::unwrap(pixbuf));
+gtk_icon_theme_add_builtin_icon(icon_name.c_str(), size, Glib::unwrap(pixbuf));
 }
 
 
@@ -311,6 +368,7 @@ Glib::SignalProxy0< void > IconTheme::signal_changed()
 }
 
 
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 void Gtk::IconTheme::on_changed()
 {
   BaseClassType *const base = static_cast<BaseClassType*>(
@@ -320,6 +378,10 @@ void Gtk::IconTheme::on_changed()
   if(base && base->changed)
     (*base->changed)(gobj());
 }
+#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+#endif //GLIBMM_VFUNCS_ENABLED
 
 
 } // namespace Gtk