[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

problems with Gtk2::ListStore



The following test code works:

<code>
	#!/usr/bin/perl

	use strict;

	use Gtk2;
	use Gnome2;
	use strict;

	use constant VERSION => '0.1';

	Gtk2->init;

	Gnome2::Program->init('test', '0.1', 'libgnomeui');

	my $w = Gnome2::App->new('toplevel');
	my $s = Gtk2::ListStore->new('G::String');

	for (qw(foo bar baz foofoo foobar foobaz)) {
        	$s->set($s->append, 0 => $_);
	}

	my $l = Gtk2::TreeView->new($s);
	$l->append_column(
        	Gtk2::TreeViewColumn->new_with_attributes(
                	"foo",
			Gtk2::CellRendererText->new,
                	text => 0
        	)
	);

	$w->set_contents($l);

	$w->show_all;

	Gtk2->main;
</code>

but this application code does not:

<code>
	my $store = Gtk2::ListStore->new('G::String');
	for my $dsn (@dbs) {
		$store->set($store->append, 0 => $dsn);
	}

	my $list = Gtk2::TreeView->new($store);
	$list->append_column(
		Gtk2::TreeViewColumn->new_with_attributes(
			"Databases",
			Gtk2::CellRendererText->new,
			text => 0
		)
	);
	$sw->add($list);
</code>

it dies on the $store->set with an error
variable is not of type Gtk2::ListStore at gnome2-sql-editor line 502.

I can see no real difference between the test code and the app code.  Does anyone have an idea?




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]