builder on scalar properties



If an object property is a Glib::Scalar, ie. Glib::ParamSpec->scalar,
can it be set with the <property> thingie in Gtk2::Builder ?  The few
lines below get

    Gtk-WARNING **: Failed to set property Foo.myscalar to "hello": Could not parse '"hello"' as a GPerlSV at 
/tmp/scalar.pl line 21.

and apparently don't set the property.

use strict;
use warnings;
use Gtk2;

{
  package Foo;
  use strict;
  use warnings;
  use Glib;
  use Glib::Object::Subclass
    'Glib::Object',
      properties => [Glib::ParamSpec->scalar
                     ('myscalar',
                      'myscalar',
                      'Blurb.',
                      Glib::G_PARAM_READWRITE),
                    ];
}

my $builder = Gtk2::Builder->new;
$builder->add_from_string (<<'HERE');
<interface>
  <object class="Foo" id="myfoo">
    <property name="myscalar">"hello"</property>
  </object>
</interface>
HERE

my $foo = $builder->get_object('myfoo');
print $foo,"\n";
print $foo->get('myscalar')||'[undef]',"\n";

exit 0;


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