<?php

/**
*   FIXED by Andrei on 2005-10-19 22:38
*   php-gtk/ext/gtk+/gtktreeview.overrides:1.20
*   Problem reason: Wrong alloc used
*/
// Create a list store.
$listStore = new GtkListStore(Gtk::TYPE_STRING, Gtk::TYPE_LONG, Gtk::TYPE_DOUBLE);
// Add some product data.
$iter = $listStore->append(array('Crisscott T-Shirts', 10, 19.95));
$iter = $listStore->prepend(array('PHP-GTK Bumper Stickers', 37, 1.99));
$iter = $listStore->prepend(array('Pro PHP-GTK', 23, 44.95));
/**
 * Weird issue 1:
 * When the array is initialized to another array first
 * there is not problem, but if the array is created inside
 * the call to insert, it fails with the following message:

(listing9-3.php:1918): GLib-GObject-WARNING **: gvalue.c:89: cannot initialize GValue with type `gdouble', the value has already been initialized as `(null)'
PHP Warning:  PHP-GTK internal error: unsupported type (null) in /home/scott/authoring/Apress/chapter9/listing9-3.php on line 23
PHP Warning:  Cannot set row: type of element 2 does not match the model in /home/scott/authoring/Apress/chapter9/listing9-3.php on line 23

(listing9-3.php:1918): GLib-GObject-CRITICAL **: g_value_unset: assertion `G_IS_VALUE (value)' failed
*/
$iter = $listStore->insert(2, array('Crisscott Pencils', 18, 0.99));
// Comment the above line and uncomment these two to test.
//$tmp = array('Crisscott Pencils', 18, .99);
//$iter = $listStore->insert(2, $tmp);
/**
 * Weird issue 2: