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

#line 1 "xs/GtkTreeStore.xs"
/*
 * Copyright (c) 2003-2006, 2009 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 Library 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
 * 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., 51 Franklin Street, Fifth Floor, 
 * Boston, MA  02110-1301  USA.
 *
 * $Id$
 */

#include "gtk2perl.h"

#line 34 "xs/GtkTreeStore.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 178 "xs/GtkTreeStore.c"

XS_EUPXS(XS_Gtk2__TreeStore_new); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_new)
{
    dVAR; dXSARGS;
    if (items < 1)
       croak_xs_usage(cv,  "class, ...");
    {
#line 39 "xs/GtkTreeStore.xs"
	GArray * typearray;
#line 189 "xs/GtkTreeStore.c"
	GtkTreeStore_noinc *	RETVAL;
#line 41 "xs/GtkTreeStore.xs"
	GTK2PERL_STACK_ITEMS_TO_GTYPE_ARRAY (typearray, 1, items-1);
	RETVAL = gtk_tree_store_newv (typearray->len, (GType*)(typearray->data));
	g_array_free (typearray, TRUE);
#line 195 "xs/GtkTreeStore.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGtkTreeStore_noinc (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__TreeStore_set_column_types); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_set_column_types)
{
    dVAR; dXSARGS;
    if (items < 1)
       croak_xs_usage(cv,  "tree_store, ...");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
#line 57 "xs/GtkTreeStore.xs"
	GArray * types;
#line 218 "xs/GtkTreeStore.c"
#line 59 "xs/GtkTreeStore.xs"
	GTK2PERL_STACK_ITEMS_TO_GTYPE_ARRAY (types, 1, items-1);
	gtk_tree_store_set_column_types (tree_store, types->len,
	                                 (GType*)(types->data));
#line 223 "xs/GtkTreeStore.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__TreeStore_set); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_set)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items < 4)
       croak_xs_usage(cv,  "tree_store, iter, col1, val1, ...");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter *	iter = SvGtkTreeIter (ST(1))
;
#line 83 "xs/GtkTreeStore.xs"
	int i, ncols;
#line 243 "xs/GtkTreeStore.c"
#line 85 "xs/GtkTreeStore.xs"
	PERL_UNUSED_VAR (ix);
	/* require at least one pair --- that means there needs to be
	 * four items on the stack.  also require that the stack has an
	 * even number of items on it. */
	if (items < 4 || 0 != (items % 2)) {
		/* caller didn't specify an even number of parameters... */
		croak ("Usage: $treestore->set ($iter, column1, value1, column2, value2, ...)\n"
		       "   there must be a value for every column number");
	}
	ncols = gtk_tree_model_get_n_columns (GTK_TREE_MODEL (tree_store));
	for (i = 2 ; i < items ; i+= 2) {
		gint column;
		GValue gvalue = {0, };
		if (!looks_like_number (ST (i)))
			croak ("Usage: $treestore->set ($iter, column1, value1, column2, value2, ...)\n"
			       "   the first value in each pair must be a column number");
		column = SvIV (ST (i));

		if (column >= 0 && column < ncols) {

			g_value_init (&gvalue,
			              gtk_tree_model_get_column_type
			                          (GTK_TREE_MODEL (tree_store),
			                           column));
			/* gperl_value_from_sv either succeeds or croaks. */
			gperl_value_from_sv (&gvalue, ST (i+1));
			gtk_tree_store_set_value (GTK_TREE_STORE (tree_store),
			                          iter, column, &gvalue);
			g_value_unset (&gvalue);

		} else {
			warn ("can't set value for column %d, model only has %d columns",
			      column, ncols);
		}
	}
#line 280 "xs/GtkTreeStore.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__TreeStore_remove); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_remove)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "tree_store, iter");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter *	iter = SvGtkTreeIter (ST(1))
;
	gboolean	RETVAL;
#line 136 "xs/GtkTreeStore.xs"
#if GTK_CHECK_VERSION(2,2,0)
	RETVAL = gtk_tree_store_remove (tree_store, iter);
#else
	/* void return in 2.0.x; look for stamp zapped to 0 if no more
	 * rows, to emulate the return value of 2.2 and up
	 */
	gtk_tree_store_remove (tree_store, iter);
	RETVAL = (iter->stamp != 0);
#endif
#line 308 "xs/GtkTreeStore.c"
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__TreeStore_insert); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_insert)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "tree_store, parent, position");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter_ornull *	parent = SvGtkTreeIter_ornull (ST(1))
;
	gint	position = (gint)SvIV(ST(2))
;
#line 155 "xs/GtkTreeStore.xs"
	GtkTreeIter iter = {0, };
#line 330 "xs/GtkTreeStore.c"
	GtkTreeIter_copy *	RETVAL;
#line 157 "xs/GtkTreeStore.xs"
	gtk_tree_store_insert (tree_store, &iter, parent, position);
	RETVAL = &iter;
#line 335 "xs/GtkTreeStore.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGtkTreeIter_copy (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__TreeStore_insert_before); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_insert_before)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 3)
       croak_xs_usage(cv,  "tree_store, parent, sibling");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter_ornull *	parent = SvGtkTreeIter_ornull (ST(1))
;
	GtkTreeIter_ornull *	sibling = SvGtkTreeIter_ornull (ST(2))
;
#line 172 "xs/GtkTreeStore.xs"
	GtkTreeIter iter;
#line 363 "xs/GtkTreeStore.c"
	GtkTreeIter_copy *	RETVAL;
#line 174 "xs/GtkTreeStore.xs"
	if (ix == 0)
		gtk_tree_store_insert_before (tree_store, &iter,
		                              parent, sibling);
	else
		gtk_tree_store_insert_after (tree_store, &iter,
		                             parent, sibling);
	RETVAL = &iter;
#line 373 "xs/GtkTreeStore.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGtkTreeIter_copy (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__TreeStore_prepend); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_prepend)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 2)
       croak_xs_usage(cv,  "tree_store, parent");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter_ornull *	parent = SvGtkTreeIter_ornull (ST(1))
;
#line 193 "xs/GtkTreeStore.xs"
	GtkTreeIter iter;
#line 399 "xs/GtkTreeStore.c"
	GtkTreeIter_copy *	RETVAL;
#line 195 "xs/GtkTreeStore.xs"
	if (ix == 0)
		gtk_tree_store_prepend (tree_store, &iter, parent);
	else
		gtk_tree_store_append (tree_store, &iter, parent);
	RETVAL = &iter;
#line 407 "xs/GtkTreeStore.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGtkTreeIter_copy (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__TreeStore_is_ancestor); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_is_ancestor)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "tree_store, iter, descendant");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter *	iter = SvGtkTreeIter (ST(1))
;
	GtkTreeIter *	descendant = SvGtkTreeIter (ST(2))
;
	gboolean	RETVAL;

	RETVAL = gtk_tree_store_is_ancestor(tree_store, iter, descendant);
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__TreeStore_iter_depth); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_iter_depth)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "tree_store, iter");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter *	iter = SvGtkTreeIter (ST(1))
;
	gint	RETVAL;
	dXSTARG;

	RETVAL = gtk_tree_store_iter_depth(tree_store, iter);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__TreeStore_clear); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_clear)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "tree_store");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;

	gtk_tree_store_clear(tree_store);
    }
    XSRETURN_EMPTY;
}

#if GTK_CHECK_VERSION(2,2,0)
#define XSubPPtmpAAAA 1


XS_EUPXS(XS_Gtk2__TreeStore_iter_is_valid); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_iter_is_valid)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "tree_store, iter");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter *	iter = SvGtkTreeIter (ST(1))
;
	gboolean	RETVAL;

	RETVAL = gtk_tree_store_iter_is_valid(tree_store, iter);
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gtk2__TreeStore_reorder); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_reorder)
{
    dVAR; dXSARGS;
    if (items < 2)
       croak_xs_usage(cv,  "tree_store, parent, ...");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter_ornull *	parent = SvGtkTreeIter_ornull (ST(1))
;
#line 239 "xs/GtkTreeStore.xs"
	gint  * new_order;
	GNode * level;
	GNode * node;
	int     length = 0;
	int     i;
#line 518 "xs/GtkTreeStore.c"
#line 245 "xs/GtkTreeStore.xs"
	if( !parent )
		level = ((GNode*)(tree_store->root))->children;
	else
		level = ((GNode*)(parent->user_data))->children;
	/* count nodes */
	node = level;
	while (node)
	{
		length++;
		node = node->next;
	}
	if( (items-2) != length )
		croak("xs: gtk_tree_store_reorder: wrong number of "
		      "positions passed");
	new_order = (gint*)g_new(gint, length);
	for (i = 0 ; i < length ; i++)
		new_order[i] = SvIV (ST (i+2));
	gtk_tree_store_reorder(tree_store, parent, new_order);
	g_free(new_order);
#line 539 "xs/GtkTreeStore.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__TreeStore_swap); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_swap)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "tree_store, a, b");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter *	a = SvGtkTreeIter (ST(1))
;
	GtkTreeIter *	b = SvGtkTreeIter (ST(2))
;

	gtk_tree_store_swap(tree_store, a, b);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__TreeStore_move_before); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_move_before)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "tree_store, iter, position");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter *	iter = SvGtkTreeIter (ST(1))
;
	GtkTreeIter_ornull *	position = SvGtkTreeIter_ornull (ST(2))
;

	gtk_tree_store_move_before(tree_store, iter, position);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Gtk2__TreeStore_move_after); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_move_after)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "tree_store, iter, position");
    {
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter *	iter = SvGtkTreeIter (ST(1))
;
	GtkTreeIter_ornull *	position = SvGtkTreeIter_ornull (ST(2))
;

	gtk_tree_store_move_after(tree_store, iter, position);
    }
    XSRETURN_EMPTY;
}

#endif /* >= 2.2.0 */
#if GTK_CHECK_VERSION (2, 10, 0)
#define XSubPPtmpAAAB 1


XS_EUPXS(XS_Gtk2__TreeStore_insert_with_values); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gtk2__TreeStore_insert_with_values)
{
    dVAR; dXSARGS;
    if (items < 3)
       croak_xs_usage(cv,  "tree_store, parent, position, ...");
    {
#line 303 "xs/GtkTreeStore.xs"
	gint n_cols, i;
	GtkTreeIter iter;
	gint * columns = NULL;
	GValue * values = NULL;
	gint n_values;
	const char * errfmt = "Usage: $iter = $treestore->insert_with_values ($parent, $position, column1, value1, ...)\n     %s";
#line 623 "xs/GtkTreeStore.c"
	GtkTreeIter_copy *	RETVAL;
	GtkTreeStore *	tree_store = SvGtkTreeStore (ST(0))
;
	GtkTreeIter_ornull *	parent = SvGtkTreeIter_ornull (ST(1))
;
	gint	position = (gint)SvIV(ST(2))
;
#line 310 "xs/GtkTreeStore.xs"
	if (items < 3 || 0 != ((items - 3) % 2))
		croak (errfmt, "There must be a value for every column number");
	/*
	 * we could jump through hoops to prevent leaking arrays and
	 * initialized GValues here on column validation croaks, but
	 * since gperl_value_from_sv() croaks (and we can't catch it
	 * without major work), and since column index validation errors
	 * mean there's a programming error anyway, we won't worry about
	 * any of that.
	 */
	n_cols = gtk_tree_model_get_n_columns (GTK_TREE_MODEL (tree_store));
	n_values = (items - 3) / 2;
	if (n_values > 0) {
		columns = gperl_alloc_temp (sizeof (gint) * n_values);
		/* gperl_alloc_temp() calls memset(), so we don't need to do
		 * anything else special to prepare these GValues. */
		values = gperl_alloc_temp (sizeof (GValue) * n_values);
		for (i = 0 ; i < n_values ; i ++) {
			if (! looks_like_number (ST (3 + i*2)))
				croak (errfmt, "The first value in each pair must be a column index number");
			columns[i] = SvIV (ST (3 + i*2));
			if (! (columns[i] >= 0 && columns[i] < n_cols))
				croak (errfmt, form ("Bad column index %d, model only has %d columns",
						     columns[i], n_cols));
			g_value_init (values + i,
			              gtk_tree_model_get_column_type
			                        (GTK_TREE_MODEL (tree_store),
			                         columns[i]));
			gperl_value_from_sv (values + i, ST (3 + i*2 + 1));
		}
	}
	gtk_tree_store_insert_with_valuesv (tree_store, &iter, parent, position,
					    columns, values, n_values);
	for (i = 0 ; i < n_values ; i++)
		g_value_unset (values + i);
	RETVAL = &iter;
#line 668 "xs/GtkTreeStore.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVGtkTreeIter_copy (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif /* 2.10 */
#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Gtk2__TreeStore); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Gtk2__TreeStore)
{
#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("Gtk2::TreeStore::new", XS_Gtk2__TreeStore_new);
        newXS_deffile("Gtk2::TreeStore::set_column_types", XS_Gtk2__TreeStore_set_column_types);
        cv = newXS_deffile("Gtk2::TreeStore::set", XS_Gtk2__TreeStore_set);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Gtk2::TreeStore::set_value", XS_Gtk2__TreeStore_set);
        XSANY.any_i32 = 1;
        newXS_deffile("Gtk2::TreeStore::remove", XS_Gtk2__TreeStore_remove);
        newXS_deffile("Gtk2::TreeStore::insert", XS_Gtk2__TreeStore_insert);
        cv = newXS_deffile("Gtk2::TreeStore::insert_after", XS_Gtk2__TreeStore_insert_before);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Gtk2::TreeStore::insert_before", XS_Gtk2__TreeStore_insert_before);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Gtk2::TreeStore::append", XS_Gtk2__TreeStore_prepend);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Gtk2::TreeStore::prepend", XS_Gtk2__TreeStore_prepend);
        XSANY.any_i32 = 0;
        newXS_deffile("Gtk2::TreeStore::is_ancestor", XS_Gtk2__TreeStore_is_ancestor);
        newXS_deffile("Gtk2::TreeStore::iter_depth", XS_Gtk2__TreeStore_iter_depth);
        newXS_deffile("Gtk2::TreeStore::clear", XS_Gtk2__TreeStore_clear);
#if XSubPPtmpAAAA
        newXS_deffile("Gtk2::TreeStore::iter_is_valid", XS_Gtk2__TreeStore_iter_is_valid);
        newXS_deffile("Gtk2::TreeStore::reorder", XS_Gtk2__TreeStore_reorder);
        newXS_deffile("Gtk2::TreeStore::swap", XS_Gtk2__TreeStore_swap);
        newXS_deffile("Gtk2::TreeStore::move_before", XS_Gtk2__TreeStore_move_before);
        newXS_deffile("Gtk2::TreeStore::move_after", XS_Gtk2__TreeStore_move_after);
#endif
#if XSubPPtmpAAAB
        newXS_deffile("Gtk2::TreeStore::insert_with_values", XS_Gtk2__TreeStore_insert_with_values);
#endif

    /* Initialisation Section */

#line 27 "xs/GtkTreeStore.xs"
	/* must prepend TreeModel in the hierarchy so that
	 * Gtk2::TreeModel::get isn't masked by Glib::Object::get.
	 * should we change the api to something unique, instead? */
	gperl_prepend_isa ("Gtk2::TreeStore", "Gtk2::TreeModel");

#if XSubPPtmpAAAA
#endif
#if XSubPPtmpAAAB
#endif
#line 750 "xs/GtkTreeStore.c"

    /* End of Initialisation Section */

#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
}

