/*
 * 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 Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glibmm/vectorutils.h>

#include <gtk/gtk.h>


namespace Gtk
{

typedef UIManager::ui_merge_id ui_merge_id; //Help gmmproc so that it does not need to add the full type name for the return type.

UIManager::ui_merge_id UIManager::add_ui_from_string(const Glib::ustring& buffer)
{
  GError* gerror = nullptr;
  guint retvalue = gtk_ui_manager_add_ui_from_string(gobj(), buffer.c_str(), buffer.size(), &(gerror));

  if (gerror)
  {
  ::Glib::Error::throw_exception(gerror);
  }
  return retvalue;
}

void UIManager::add_ui_separator(ui_merge_id merge_id, const Glib::ustring& path, const Glib::ustring& name, UIManagerItemType type, bool top)
{
  gtk_ui_manager_add_ui(gobj(), merge_id, path.c_str(), name.c_str(), 0 /* See C docs */, ((GtkUIManagerItemType)(type)), static_cast<int>(top));
}

} // namespace Gtk

