#!/usr/bin/perl

package ClassFoo;
use strict;
use warnings;
use Glib;

use Glib::Object::Subclass
  Glib::Object::,
  properties => [
    Glib::ParamSpec->boxed('title',
                           'title',
                           'The title',
                           'Glib::Scalar',
                           [qw/writable readable/]),
  ];

sub INIT_INSTANCE {
    my $self = shift;
    $self->{prop_title} = undef;
}

sub SET_PROPERTY {
    my ($self, $pspec, $val) = @_;
    my $propname = $pspec->get_name;
    if ($propname eq 'title') {
        $self->{prop_title} = $val;
    } else {
        die "unknown property ``$propname''";
    }
}

sub GET_PROPERTY {
    my ($self, $pspec) = @_;
    my $propname = $pspec->get_name;
    if ($propname eq 'title') {
        return $self->{prop_title};
    } else {
        die "unknown property ``$propname''";
    }
}

# --------------------------------------------------------------------------- #

package main;
use strict;
use warnings;

my $w = ClassFoo->new;

for (my $i = 0; $i < 10000; $i++) {
  $w->set_property ('title', 'bla');
  $w->get_property ('title');
}
