/*
 * This file was generated automatically by ExtUtils::ParseXS version 3.34 from the
 * contents of GnomeAppHelper.xs. Do not edit this file, edit GnomeAppHelper.xs instead.
 *
 *    ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "xs/GnomeAppHelper.xs"
/*
 * Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS)
 * 
 * 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 LICENSE file in the top level of this distribution
 * for the complete license terms.
 *
 */

#include "gnome2perl.h"
#include <gperl_marshal.h>

static void
gnome2perl_popup_menu_activate_func (GtkObject *object,
                                     gpointer data,
                                     GtkWidget *for_widget)
{
	/* We stored the SV in the widget.  Get it. */
	SV *callback = g_object_get_data (G_OBJECT (object), "gnome2perl_popup_menu_callback");

	if (callback) {
		dGPERL_CALLBACK_MARSHAL_SP;
#ifdef PERL_IMPLICIT_CONTEXT
		PERL_SET_CONTEXT (callback);
		SPAGAIN;
#endif

		ENTER;
		SAVETMPS;

		PUSHMARK (SP);

		EXTEND (SP, 3);
		PUSHs (sv_2mortal (newSVGtkObject (object)));
		PUSHs (sv_2mortal (newSVsv (data)));
		PUSHs (sv_2mortal (newSVGtkWidget (for_widget)));

		PUTBACK;

		call_sv (callback, G_DISCARD);

		FREETMPS;
		LEAVE;
	}
}

static void
gnome2perl_popup_menu_activate_func_destroy (SV *callback)
{
	/* FIXME: Any idea how to destroy the callback?
	SvREFCNT_dec (callback); */
}

/* ------------------------------------------------------------------------- */

/*
 * this was originally SvGnomeUIInfo in Gtk-Perl-0.7008/Gnome/xs/Gnome.xs
 */
void
gnome2perl_parse_uiinfo_sv (SV * sv,
                            GnomeUIInfo * info)
{
	g_assert (sv != NULL);
	g_assert (info != NULL);

	if (!SvOK (sv))
		return; /* fail silently if undef */
	if ((!SvRV (sv)) ||
	    (SvTYPE (SvRV (sv)) != SVt_PVHV && SvTYPE (SvRV (sv)) != SVt_PVAV))
		croak ("GnomeUIInfo must be a hash or array reference");

	if (SvTYPE (SvRV (sv)) == SVt_PVHV) {
		HV *h = (HV*) SvRV (sv);
		SV **s;
		if ((s = hv_fetch (h, "type", 4, 0)) && SvOK (*s))
			info->type = SvGnomeUIInfoType(*s);
		if ((s = hv_fetch (h, "label", 5, 0)) && SvOK (*s))
			info->label = SvGChar (*s);
		if ((s = hv_fetch (h, "hint", 4, 0)) && SvOK (*s))
			info->hint = SvGChar (*s);
		if ((s = hv_fetch (h, "widget", 6, 0)) && SvOK (*s))
			info->widget = SvGtkWidget (*s);

		/* 'subtree' and 'callback' are also allowed - they
                   have the bonus that we know what you mean if you
                   use them */
		if ((s = hv_fetch(h, "moreinfo", 8, 0)) && SvOK(*s)) {
			info->moreinfo = *s;
		} else if ((s = hv_fetch(h, "subtree", 7, 0)) && SvOK(*s)) {
			if (info->type != GNOME_APP_UI_SUBTREE &&
			    info->type != GNOME_APP_UI_SUBTREE_STOCK)
				croak ("'subtree' argument specified, but "
				       "GnomeUIInfo type is not 'subtree'");
			info->moreinfo = *s;
		} else if ((s = hv_fetch(h, "callback", 8, 0)) && SvOK(*s)) {
			if ((info->type != GNOME_APP_UI_ITEM) &&
			    (info->type != GNOME_APP_UI_ITEM_CONFIGURABLE) &&
			    (info->type != GNOME_APP_UI_TOGGLEITEM))
				croak ("'callback' argument specified, but "
				       "GnomeUIInfo type is not an item type");
			info->moreinfo = *s;
		}

		if ((s = hv_fetch(h, "pixmap_type", 11, 0)) && SvOK(*s))
			info->pixmap_type = SvGnomeUIPixmapType(*s);
		if ((s = hv_fetch(h, "pixmap_info", 11, 0)) && SvOK(*s))
			/* stock ids have no non-ascii (i hope), and this should
			 * allow actual pixmap data through, too */
			info->pixmap_info = SvPV_nolen (*s);
		if ((s = hv_fetch(h, "accelerator_key", 15, 0)) && SvOK(*s)) /* keysym */
			info->accelerator_key = SvIV(*s);
		if ((s = hv_fetch(h, "ac_mods", 7, 0)) && SvOK(*s))
			info->ac_mods = SvGdkModifierType(*s);
	} else { /* As in Python - it's an array of:
		    type, label, hint, moreinfo, pixmap_type, pixmap_info,
		    accelerator_key, modifiers */
		AV *a = (AV*)SvRV (sv);
		SV **s;
		if ((s = av_fetch (a, 0, 0)) && SvOK (*s))
			info->type = SvGnomeUIInfoType (*s);
		if ((s = av_fetch (a, 1, 0)) && SvOK (*s))
			info->label = SvGChar (*s);
		if ((s = av_fetch (a, 2, 0)) && SvOK (*s))
			info->hint = SvGChar (*s);
		if ((s = av_fetch (a, 3, 0)) && SvOK (*s))
			info->moreinfo = *s;
		if ((s = av_fetch (a, 4, 0)) && SvOK (*s))
			info->pixmap_type = SvGnomeUIPixmapType (*s);
		if ((s = av_fetch (a, 5, 0)) && SvOK (*s))
			info->pixmap_info = SvPV_nolen (*s);
		if ((s = av_fetch (a, 6, 0)) && SvOK (*s)) /* keysym */
			info->accelerator_key = SvIV (*s);
		if ((s = av_fetch (a, 7, 0)) && SvOK (*s))
			info->ac_mods = SvGdkModifierType (*s);	  

#		define GNOME2PERL_WIDGET_ARRAY_INDEX 8

		if ((s = av_fetch (a, GNOME2PERL_WIDGET_ARRAY_INDEX, 0)) && SvOK (*s))
			info->widget = SvGtkWidget (*s);
	}

	/* Decide what to do with the moreinfo */
	switch (info->type) {
	    case GNOME_APP_UI_SUBTREE:
	    case GNOME_APP_UI_SUBTREE_STOCK:
	    case GNOME_APP_UI_RADIOITEMS:
		if (info->moreinfo == NULL)
			croak ("GnomeUIInfo type requires a 'moreinfo' or "
			       "'subtree' argument, but none was specified");
		/* Now we can recurse */
		/* Hope user_data doesn't get mangled... */
		info->user_data = info->moreinfo;
		info->moreinfo =
		  gnome2perl_svrv_to_uiinfo_tree (info->moreinfo,
		                                  "'subtree' or 'moreinfo'");
		break;

	    case GNOME_APP_UI_HELP:
		if (info->moreinfo == NULL)
			croak("GnomeUIInfo type requires a 'moreinfo' argument, "
			      "but none was specified");
		/* It's just a string */
		info->moreinfo = SvGChar ((SV*)info->moreinfo);
		break;

	    case GNOME_APP_UI_ITEM:
	    case GNOME_APP_UI_ITEM_CONFIGURABLE:
	    case GNOME_APP_UI_TOGGLEITEM:
		if (info->moreinfo) {
			/* We simply swap moreinfo and user_data here so that
			   the GnomePopupMenu functions don't see the SV but our
			   custom marshaller.  GnomeAppHelper isn't directly
			   affected since we use the GnomeUIBuilderData thingy
			   there anyway. */
			info->user_data = info->moreinfo;
			info->moreinfo = gnome2perl_popup_menu_activate_func;
		}
		break;

	    default:
		/* Do nothing */
		break;
	}
}

GnomeUIInfo *
gnome2perl_svrv_to_uiinfo_tree (SV* sv, char * name)
{
	AV * av;
	int i, count;
	GnomeUIInfo * infos;

	g_assert (sv != NULL);
	if ((!SvOK (sv)) || (!SvRV (sv)) || (SvTYPE (SvRV (sv)) != SVt_PVAV))
		croak ("%s must be a reference to an array of Gnome UI "
		       "Info Entries", name);

	av = (AV*)SvRV (sv);
	/* add one to turn from last index to length... */
	count = av_len (av) + 1;
	infos = gperl_alloc_temp (sizeof(GnomeUIInfo) * (count+1));
	for (i = 0; i < count; i++) {
		SV ** svp = av_fetch (av, i, FALSE);
		gnome2perl_parse_uiinfo_sv (*svp, infos + i);
	}
	/* and stick another one on the end of the array as the terminator */
	infos[count].type = GNOME_APP_UI_ENDOFINFO;
	
	return infos;
}


GnomeUIInfo *
SvGnomeUIInfo (SV * sv)
{
	return gnome2perl_svrv_to_uiinfo_tree (sv, "variable");
}

static void
gnome2perl_refill_info_common (SV *data, GnomeUIInfo *info)
{
	if (info->widget) {
		if (SvTYPE(SvRV(data)) == SVt_PVHV) {
			hv_store ((HV*)SvRV(data), "widget", 6,
			          newSVGtkWidget (info->widget), FALSE);
		} else {
			av_store ((AV*)SvRV(data), GNOME2PERL_WIDGET_ARRAY_INDEX,
			          newSVGtkWidget (info->widget));
		}
	}
}


static void
gnome2perl_refill_info (SV *data, GnomeUIInfo *info)
{
	gnome2perl_refill_info_common (data, info);

	switch (info->type) {
	    case GNOME_APP_UI_SUBTREE:
	    case GNOME_APP_UI_SUBTREE_STOCK:
	    case GNOME_APP_UI_RADIOITEMS:
		/* in gnome2perl_parse_uiinfo_sv, we stashed a pointer to
		 * the SV reference to the subtree array in info->user_data.
		 * it should still be there, provided there's no mangling
		 * in the library. */
		gnome2perl_refill_infos (info->user_data, info->moreinfo);
		break;

	    default:
		break;
	}
}

static void
gnome2perl_refill_info_popup (SV *data, GnomeUIInfo *info)
{
	gnome2perl_refill_info_common (data, info);

	switch (info->type) {
	    case GNOME_APP_UI_SUBTREE:
	    case GNOME_APP_UI_SUBTREE_STOCK:
	    case GNOME_APP_UI_RADIOITEMS:
		/* in gnome2perl_parse_uiinfo_sv, we stashed a pointer to
		 * the SV reference to the subtree array in info->user_data.
		 * it should still be there, provided there's no mangling
		 * in the library. */
		gnome2perl_refill_infos_popup (info->user_data, info->moreinfo);
		break;

	    case GNOME_APP_UI_ITEM:
	    case GNOME_APP_UI_ITEM_CONFIGURABLE:
	    case GNOME_APP_UI_TOGGLEITEM:
		/* user_data contains the SV.  Store it in the widget so that
		   the custom marshaller can recover and call it. */
		if (info->user_data)
			g_object_set_data_full (
			  G_OBJECT (info->widget),
			  "gnome2perl_popup_menu_callback",
			  info->user_data,
			  (GDestroyNotify)
			    gnome2perl_popup_menu_activate_func_destroy);
		break;

	    default:
		break;
	}
}

void
gnome2perl_refill_infos (SV *data, GnomeUIInfo *infos)
{
	int i, count;
	AV* a = (AV*)SvRV (data);
	count = av_len(a) + 1;
	for (i = 0; i < count; i++) {
		SV** s = av_fetch(a, i, 0);
		gnome2perl_refill_info (*s, infos + i);
	}
}

void
gnome2perl_refill_infos_popup (SV *data, GnomeUIInfo *infos)
{
	int i, count;
	AV* a = (AV*)SvRV (data);
	count = av_len(a) + 1;
	for (i = 0; i < count; i++) {
		SV** s = av_fetch(a, i, 0);
		gnome2perl_refill_info_popup (*s, infos + i);
	}
}

static void
gnome2perl_ui_signal_connect (GnomeUIInfo * uiinfo,
                              const char * signal_name,
                              GnomeUIBuilderData * uibdata)
{
	/* We're using user_data here instead of moreinfo because we swapped
	   them in gnome2perl_parse_uiinfo_sv. */
	if (uiinfo->user_data)
		gperl_signal_connect (newSVGObject (G_OBJECT (uiinfo->widget)),
		                      (char*) signal_name,
		                      uiinfo->user_data,
		                      NULL,
		                      G_SIGNAL_RUN_FIRST);
}

static GnomeUIBuilderData
ui_builder_data = {
	gnome2perl_ui_signal_connect,
	NULL,
	FALSE,
	NULL,
	(GtkDestroyNotify) gperl_callback_destroy
};

#line 356 "xs/GnomeAppHelper.c"
#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
#  define dVAR		dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
#  define PERL_DECIMAL_VERSION \
	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
#  define PERL_VERSION_GE(r,v,s) \
	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
#  define PERL_VERSION_LE(r,v,s) \
	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
 * XS macro.
 *
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
 * for anything but the BOOT XSUB.
 *
 * See XSUB.h in core!
 */


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
#  undef XS_EXTERNAL
#  undef XS_INTERNAL
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
#  endif
#  if defined(__SYMBIAN32__)
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
#  endif
#  ifndef XS_EXTERNAL
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
#    else
#      ifdef __cplusplus
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
#        define XS_INTERNAL(name) static XSPROTO(name)
#      else
#        define XS_EXTERNAL(name) XSPROTO(name)
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
#      endif
#    endif
#  endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
 * macro defined, the best we can do is assume XS is the same.
 * Dito for XS_INTERNAL.
 */
#ifndef XS_EXTERNAL
#  define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
#  define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
 * internal macro that we're free to redefine for varying linkage due
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
 */

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
#  define XS_EUPXS(name) XS_EXTERNAL(name)
#else
   /* default to internal */
#  define XS_EUPXS(name) XS_INTERNAL(name)
#endif

#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
    const GV *const gv = CvGV(cv);

    PERL_ARGS_ASSERT_CROAK_XS_USAGE;

    if (gv) {
        const char *const gvname = GvNAME(gv);
        const HV *const stash = GvSTASH(gv);
        const char *const hvname = stash ? HvNAME(stash) : NULL;

        if (hvname)
	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
        else
	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
	Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage        S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
 * so we define a portable version of newXSproto()
 */
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
#  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
#  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

#line 500 "xs/GnomeAppHelper.c"

XS_EUPXS(XS_Gnome2_accelerators_sync); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2_accelerators_sync)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "class");
    {

	gnome_accelerators_sync(/*void*/);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__MenuShell_fill_menu); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__MenuShell_fill_menu)
{
    dVAR; dXSARGS;
    if (items != 5)
       croak_xs_usage(cv,  "menu_shell, uiinfo, accel_group, uline_accels, pos");
    {
	GtkMenuShell *	menu_shell = SvGtkMenuShell (ST(0))
;
	GnomeUIInfo *	uiinfo = SvGnomeUIInfo (ST(1))
;
	GtkAccelGroup *	accel_group = SvGtkAccelGroup (ST(2))
;
	gboolean	uline_accels = (bool)SvTRUE(ST(3))
;
	gint	pos = (gint)SvIV(ST(4))
;
#line 449 "xs/GnomeAppHelper.xs"
	gnome_app_fill_menu_custom (menu_shell, uiinfo, &ui_builder_data, accel_group, uline_accels, pos);
	gnome2perl_refill_infos (ST (1), uiinfo);
#line 536 "xs/GnomeAppHelper.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__MenuShell_find_menu_pos); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__MenuShell_find_menu_pos)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "parent, path");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GtkWidget *	parent = SvGtkWidget (ST(0))
;
	const gchar *	path;
#line 463 "xs/GnomeAppHelper.xs"
	gint pos;
	GtkWidget *widget;
#line 557 "xs/GnomeAppHelper.c"

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	path = (const gchar *)SvPV_nolen (ST(1))
;
#line 466 "xs/GnomeAppHelper.xs"
	EXTEND (sp, 2);
	widget = gnome_app_find_menu_pos (parent, path, &pos);
	PUSHs (sv_2mortal (newSVGtkWidget (widget)));
	PUSHs (sv_2mortal (newSViv (pos)));
#line 568 "xs/GnomeAppHelper.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gtk2__Toolbar_fill_toolbar); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Toolbar_fill_toolbar)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "toolbar, uiinfo, accel_group");
    {
	GtkToolbar *	toolbar = SvGtkToolbar (ST(0))
;
	GnomeUIInfo *	uiinfo = SvGnomeUIInfo (ST(1))
;
	GtkAccelGroup *	accel_group = SvGtkAccelGroup (ST(2))
;
#line 485 "xs/GnomeAppHelper.xs"
	gnome_app_fill_toolbar_custom (toolbar, uiinfo, &ui_builder_data, accel_group);
	gnome2perl_refill_infos (ST (1), uiinfo);
#line 591 "xs/GnomeAppHelper.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gnome2__App_create_menus); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__App_create_menus)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 2)
       croak_xs_usage(cv,  "app, uiinfo");
    {
	GnomeApp *	app = SvGnomeApp (ST(0))
;
	GnomeUIInfo *	uiinfo = SvGnomeUIInfo (ST(1))
;
#line 510 "xs/GnomeAppHelper.xs"
	if (ix == 0)
		gnome_app_create_menus_custom (app, uiinfo, &ui_builder_data);
	else
		gnome_app_create_toolbar_custom (app, uiinfo, &ui_builder_data);

	gnome2perl_refill_infos (ST (1), uiinfo);
#line 616 "xs/GnomeAppHelper.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gnome2__App_insert_menus); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__App_insert_menus)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "app, path, menuinfo");
    {
	GnomeApp *	app = SvGnomeApp (ST(0))
;
	const gchar *	path;
	GnomeUIInfo *	menuinfo = SvGnomeUIInfo (ST(2))
;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	path = (const gchar *)SvPV_nolen (ST(1))
;
#line 527 "xs/GnomeAppHelper.xs"
	gnome_app_insert_menus_custom (app, path, menuinfo, &ui_builder_data);
	gnome2perl_refill_infos (ST (2), menuinfo);
#line 642 "xs/GnomeAppHelper.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gnome2__App_remove_menus); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__App_remove_menus)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "app, path, items");
    {
	GnomeApp *	app = SvGnomeApp (ST(0))
;
	const gchar *	path;
	gint	items = (gint)SvIV(ST(2))
;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	path = (const gchar *)SvPV_nolen (ST(1))
;

	gnome_app_remove_menus(app, path, items);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gnome2__App_remove_menu_range); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__App_remove_menu_range)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "app, path, start, items");
    {
	GnomeApp *	app = SvGnomeApp (ST(0))
;
	const gchar *	path;
	gint	start = (gint)SvIV(ST(2))
;
	gint	items = (gint)SvIV(ST(3))
;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	path = (const gchar *)SvPV_nolen (ST(1))
;

	gnome_app_remove_menu_range(app, path, start, items);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gnome2__App_install_menu_hints); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__App_install_menu_hints)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "app, uiinfo");
    {
	GnomeApp *	app = SvGnomeApp (ST(0))
;
	GnomeUIInfo *	uiinfo = SvGnomeUIInfo (ST(1))
;

	gnome_app_install_menu_hints(app, uiinfo);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gnome2__App_setup_toolbar); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__App_setup_toolbar)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "class, toolbar, dock_item");
    {
	GtkToolbar *	toolbar = SvGtkToolbar (ST(1))
;
	BonoboDockItem *	dock_item = SvBonoboDockItem (ST(2))
;

	gnome_app_setup_toolbar(toolbar, dock_item);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gnome2__AppBar_install_menu_hints); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__AppBar_install_menu_hints)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "appbar, uiinfo");
    {
	GnomeAppBar*	appbar = SvGnomeAppBar (ST(0))
;
	GnomeUIInfo*	uiinfo = SvGnomeUIInfo (ST(1))
;
#line 568 "xs/GnomeAppHelper.xs"
	gnome_app_install_appbar_menu_hints (appbar, uiinfo);
#line 747 "xs/GnomeAppHelper.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__Statusbar_install_menu_hints); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__Statusbar_install_menu_hints)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "bar, uiinfo");
    {
	GtkStatusbar*	bar = SvGtkStatusbar (ST(0))
;
	GnomeUIInfo*	uiinfo = SvGnomeUIInfo (ST(1))
;
#line 581 "xs/GnomeAppHelper.xs"
	gnome_app_install_statusbar_menu_hints (bar, uiinfo);
#line 766 "xs/GnomeAppHelper.c"
    }
    XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Gnome2__AppHelper); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Gnome2__AppHelper)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
    dVAR; dXSBOOTARGSXSAPIVERCHK;
#endif
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(file);

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5)
    XS_VERSION_BOOTCHECK;
#  ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#  endif
#endif

        newXS_deffile("Gnome2::accelerators_sync", XS_Gnome2_accelerators_sync);
        newXS_deffile("Gtk2::MenuShell::fill_menu", XS_Gtk2__MenuShell_fill_menu);
        newXS_deffile("Gtk2::MenuShell::find_menu_pos", XS_Gtk2__MenuShell_find_menu_pos);
        newXS_deffile("Gtk2::Toolbar::fill_toolbar", XS_Gtk2__Toolbar_fill_toolbar);
        cv = newXS_deffile("Gnome2::App::create_menus", XS_Gnome2__App_create_menus);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Gnome2::App::create_toolbar", XS_Gnome2__App_create_menus);
        XSANY.any_i32 = 1;
        newXS_deffile("Gnome2::App::insert_menus", XS_Gnome2__App_insert_menus);
        newXS_deffile("Gnome2::App::remove_menus", XS_Gnome2__App_remove_menus);
        newXS_deffile("Gnome2::App::remove_menu_range", XS_Gnome2__App_remove_menu_range);
        newXS_deffile("Gnome2::App::install_menu_hints", XS_Gnome2__App_install_menu_hints);
        newXS_deffile("Gnome2::App::setup_toolbar", XS_Gnome2__App_setup_toolbar);
        newXS_deffile("Gnome2::AppBar::install_menu_hints", XS_Gnome2__AppBar_install_menu_hints);
        newXS_deffile("Gtk2::Statusbar::install_menu_hints", XS_Gtk2__Statusbar_install_menu_hints);
#if PERL_VERSION_LE(5, 21, 5)
#  if PERL_VERSION_GE(5, 9, 0)
    if (PL_unitcheckav)
        call_list(PL_scopestack_ix, PL_unitcheckav);
#  endif
    XSRETURN_YES;
#else
    Perl_xs_boot_epilog(aTHX_ ax);
#endif
}

