Re: Implementing TreeDragDest interface with a TreeModelSort model
- From: muppet <scott asofyet org>
- To: Christian Jodar <tian-ml c-sait net>
- Cc: gtk-perl-list gnome org
- Subject: Re: Implementing TreeDragDest interface with a TreeModelSort model
- Date: Sat, 10 Mar 2007 15:35:54 -0500
On Mar 10, 2007, at 11:48 AM, Christian Jodar wrote:
{
package MyTreeModelSort;
use Glib::Object::Subclass
Gtk2::TreeModelSort::,
interfaces => [ Gtk2::TreeDragDest:: ],
;
sub new
{
my ($proto, $childModel) = @_;
my $class = ref($proto) || $proto;
my $self = Gtk2::TreeModelSort->new($childModel);
bless ($self, $class);
return $self;
}
Here's your problem --- you're setting up MyTreeModelSort with the
interface and all that good stuff, but in the constructor, you're
creating a TreeModelSort, *not* a MyTreeModelSort.
*Reblessing does *not* work with Glib::Object::Subclass!*
Your new() should look like this:
sub new
{
my ($proto, $childModel) = @_;
my $class = ref($proto) || $proto;
return Glib::Object::new ($class, model => $childModel);
}
--
If the monkey could type one keystroke every nanosecond, the expected
waiting time until the monkey types out Hamlet is so long that the
estimated age of the universe is insignificant by comparison ... this
is not a practical method for writing plays.
-- Gian-Carlo Rota
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]