Re: Question about subclassing Gtk2::TextBuffer




Jaap Karssenberg said:
muppet wrote:
That you're seeing this assertion implies that you're somehow setting
the tag table twice.

Yes, I figured something like that. Problem is I do not set a tag table
in my code anywhere. Apperently it gets called twice during construction
of the object by Glib::Object::new(). I opened GObject.xs to see if I
could find out why, but I'm afraid this is beyond me.

Maybe I should provide a test script, maybe next week.

That would help.  I can't reproduce with a trivial script.  (Glib & Gtk2
1.081, gtk+ 2.4.14 and glib 2.4.7)

-=-=-=-=-=-=-=-=-=-
#!/usr/bin/perl -w

package MyBuffer;
use strict;
use Gtk2;
use Glib::Object::Subclass
    Gtk2::TextBuffer::,
    signals => {
        insert_text => \&_do_insert_text,
    },
    ;
sub _do_insert_text {
    my ($self, $iter, $string) = @_;
    $string = lc $string;  # disallow capitals.
    $string =~ s/(.)/$1 /g;  # add an extra space to everything.
    $self->signal_chain_from_overridden ($iter, $string, length ($string));
}

package main;

use strict;
use Gtk2 -init;

my $buffer = MyBuffer->new;
my $textview = Gtk2::TextView->new_with_buffer ($buffer);
my $scroller = Gtk2::ScrolledWindow->new;
my $window = Gtk2::Window->new;
$window->add ($scroller);
$scroller->add ($textview);
$window->signal_connect (destroy => sub { Gtk2->main_quit });
$window->show_all;
Gtk2->main;
-=-=-=-=-=-=-=-=-=-



-- 
muppet <scott at asofyet dot org>




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