} function __set_gproperty($spec, $value) { echo "__set_gproperty called for {$spec} = {$value}\n"; if ($spec->name == 'foo') { $this->foo = $value; } else { if ($spec->name == 'bar') { $this->bar = $value; } else { trigger_error('Unknown property'); } } } } GObject::register_type('NewType'); echo $c, "\n"; $c = new NewType(); var_dump($c->get_property('foo')); var_dump($c->get_property('bar')); var_dump($c->get_property('zoo')); $c->set_property('bar', new GtkButton()); echo $c->get_property('bar'); echo "\n"; /* Returns: __get_gproperty called for [GParamString 'foo'] string(6) "abcdef" __get_gproperty called for [GParamObject 'bar'] NULL __get_gproperty called for [GParamBoolean 'zoo'] bool(true)