Re: [PHP-GTK-DEV] Re: bug

[email protected] (Pablo DallOglio)
Newsgroups php.gtk.dev
Message-ID <[email protected]>
Hello Elizabeth,

I have already tried your workaround before.
But for me, it's even worse, because php gives me
a segmentation fault, and you knows, seg fault says
nothing at all, hehehe

For testing purposes, I've reduced the test code:

<?php
$window = new GtkWindow;

$model = new GtkListStore(GObject::TYPE_OBJECT, GObject::TYPE_STRING);

$comboBox = new GtkComboBox;
$comboBox->set_model($model);// => the error is here

$window->show_all();
Gtk::main();
?>
*Segmentation Fault*

I'm not sure the message is exactly "Segmentation Fault" because
it's shown in portuguese "Falha de segmentação" ;-)

*php-gtk2 -v*
PHP 5.2.8 (cli) (built: Dec 24 2008 16:39:40)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

phpversion() => *5.2.8*
phpversion('php-gtk') => *2.0.1*
gtk::get_version() => *GTK 2.12.0

*Pablo

2009/2/13 Elizabeth M Smith <[email protected]>

> Pablo DallOglio wrote:
> > Hello
> >
> > When creating a combobox using a GtkListStore, PHP-GTK gives me this
> > error:
> >
> > (combobox_model.php:7672): GLib-GObject-WARNING **:
> > IA__g_object_new_valist: object class `GtkComboBox' has no property
> > named `text-column'
> >
> > Does anyone knows what it can be ? The code is below:
> >
> > <?php
> > $window = new GtkWindow;
> > $window->set_default_size(200,100);
> > $window->set_border_width(20);
> > $window->set_position(GTK::WIN_POS_CENTER);
> >
> > $model = new GtkListStore(GObject::TYPE_OBJECT, GObject::TYPE_STRING);
> >
> > $comboBox = new GtkComboBox($model); // => the error is here
> >
> > $cell_renderer1 = new GtkCellRendererPixbuf();
> > $cell_renderer2 = new GtkCellRendererText();
> >
> > $comboBox->pack_start($cell_renderer1, false);
> > $comboBox->pack_start($cell_renderer2, true);
> >
> > $comboBox->set_attributes($cell_renderer1, 'pixbuf', 0);
> > $comboBox->set_attributes($cell_renderer2, 'text', 1);
> >
> > $items   = array();
> >
> > $items[] = array('ico_pdf.png', 'Arquivo PDF');
> > $items[] = array('ico_php.png', 'Arquivo PHP');
> >
> > foreach ($items as $item)
> > {
> >     $imagem = $item[0];
> >     $texto  = $item[1];
> >
> >     $pixbuf = GdkPixbuf::new_from_file($imagem);
> >
> >     $iter = $model->append(array($pixbuf, $texto));
> > }
> >
> > $comboBox->set_active(0);
> > $window->add($comboBox);
> >
> > $window->show_all();
> > Gtk::main();
> > ?>
> >
> definitely a bug, I'll have to take a look later
>
> For now an easy workaround is this
>
> $comboBox = new GtkComboBox();
> $comboBox->set_model($model);
>
> does same thing and no error is thrown
>
> Thanks,
> Elizabeth
>
> --
> PHP-GTK Development Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.