The Gtk2::Buildable pod "PLAIN OBJECTS" reads like you can't build a plain Glib::Object subclass at all unless you have the Gtk2::Buildable interface on it. I suppose that's adapted from the gtk ref manual GtkBuildable "Description",
In order to allow construction from a GtkBuilder UI description, an object class must implement the GtkBuildable interface. But is it true? The few lines below seem to work for me (gtk 2.20). Gtk2::Builder seems fine on plain objects, at least as far as creating and <property> settings.
use strict; use warnings; use Gtk2; { package Foo; use strict; use warnings; use Glib; use Glib::Object::Subclass 'Glib::Object', properties => [Glib::ParamSpec->string ('mystring', 'mystring', 'Blurb.', '', # default Glib::G_PARAM_READWRITE), ]; } my $builder = Gtk2::Builder->new; $builder->add_from_string (<<'HERE'); <interface> <object class="Foo" id="myfoo"> <property name="mystring">hello</property> </object> </interface> HERE my $foo = $builder->get_object('myfoo'); print $foo,"\n"; print $foo->get('mystring'),"\n"; print "interfaces: ",Glib::Type->list_interfaces('Foo'),"\n"; exit 0;
_______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list