/* Copyright 2003 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtk/gtkicontheme.h>
#include <gtk/gtktypebuiltins.h> //For gtk_icon_theme_error_get_type().


namespace Gtk
{

void IconTheme::set_search_path(const Glib::ArrayHandle<Glib::ustring>& path)
{
  gtk_icon_theme_set_search_path(gobj(), const_cast<const char**>(path.data()), path.size());
}

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_DEEP);
}

Glib::ArrayHandle<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name) const
{
  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.
}
  
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

