Re: Bug in Gtk2::ToggleButton->new_from_stock()



Hi muppet,

On Fri, 2006-06-02 at 21:05 -0400, muppet wrote:
On May 28, 2006, at 9:15 AM, Emmanuele Bassi wrote:

Unfortunately, GObject::constructor has no Perl counterpart: you can
control the initialisation of an Glib::Object but you can't control  
the
creation of the instance itself.  I've had a look at the Glib::Object
creation flow, and the changes for supporting a CONSTRUCTOR  
function are
not trivial (maybe muppet or Torsten have some patch lying around so
I'll be shamed into a corner, though ;-)).

No patch, sorry.  The main reason for not binding it back in the day  
was that subclassing GObjects in perl is already unnatural enough...

Yeah, I thought about that.

The syntax for allowing overriding the constructor would be something
like this:

sub CONSTRUCTOR
{
    my ($class, $params) = @_;

    my $self = $class::SUPER->constructor($class, $params);
    
    # ... do stuff with the newly created instance ...

    return $self;
}

which would *really* be unnatural.

Although, if it's really the only way to do a particular trick, we  
can work something up.

That's the only way to control an object with constructor and
constructor-only properties.

Ciao,
 Emmanuele.

-- 
Emmanuele Bassi - <ebassi gmail com>
Log: http://log.emmanuelebassi.net




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