Re: TreeModel HAS_CHILD return
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: TreeModel HAS_CHILD return
- Date: Sun, 04 May 2008 15:12:50 +0200
Kevin Ryde wrote:
gtk2perl_tree_model_iter_has_child looks like it uses POPi. Could it
test the return with sv_true (or whichever test it is that correctly
handles magic)?
Yes, I think that would make sense. Patch attached. Does this work in
your case?
--
Bye,
-Torsten
Index: t/GtkTreeModelIface.t
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/GtkTreeModelIface.t,v
retrieving revision 1.5
diff -u -d -p -r1.5 GtkTreeModelIface.t
--- t/GtkTreeModelIface.t 5 Oct 2005 19:13:07 -0000 1.5
+++ t/GtkTreeModelIface.t 4 May 2008 13:11:48 -0000
@@ -180,7 +180,7 @@ sub ITER_HAS_CHILD {
isa_ok ($list, "CustomList", "ITER_HAS_CHILD");
ok ($iter->[0] == $list->{stamp}, "ITER_HAS_CHILD");
- return FALSE;
+ return 'asdf';
}
sub ITER_N_CHILDREN {
@@ -374,7 +374,7 @@ isa_ok ($iter = $model->iter_children(un
isa_ok ($path = $model->get_path ($iter), "Gtk2::TreePath");
is_deeply ([$path->get_indices], [0]);
-is ($model->iter_has_child ($iter), FALSE);
+is ($model->iter_has_child ($iter), TRUE);
is ($model->iter_n_children ($iter), 0);
isa_ok ($iter = $model->iter_nth_child (undef, 7), "Gtk2::TreeIter");
Index: xs/GtkTreeModel.xs
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/xs/GtkTreeModel.xs,v
retrieving revision 1.52
diff -u -d -p -r1.52 GtkTreeModel.xs
--- xs/GtkTreeModel.xs 7 Jan 2008 20:23:29 -0000 1.52
+++ xs/GtkTreeModel.xs 4 May 2008 13:11:48 -0000
@@ -313,11 +313,13 @@ static gboolean
gtk2perl_tree_model_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
+ SV *sv;
gboolean ret;
PREP (tree_model);
XPUSHs (sv_2mortal (sv_from_iter (iter)));
CALL ("ITER_HAS_CHILD", G_SCALAR);
- ret = POPi;
+ sv = POPs;
+ ret = sv_2bool (sv);
FINISH;
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]