Problem with subclassing with Glib::Object::Subclass and Gtk3
- From: Yuri Myasoedov <ymyasoedov yandex ru>
- To: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: Problem with subclassing with Glib::Object::Subclass and Gtk3
- Date: Thu, 09 Apr 2015 22:22:57 +0300
Hi!
I have a problem with migration of my code to Gtk3. Just a simple example. I want to subclass from
Gtk3::Button with Glib::Object::Subclass.
There is no new signals, no properties and so on... BTW, when I switched to Gtk3, I have to define two
additional
signals, PARENT_SET and HIERARCHY_CHANGED. This code just works if I replace Gtk3 to Gtk2. But it doesn't
when I use Gtk3. I've got a error: "undef is not of type Gtk3::Gdk::Screen at
/usr/lib/perl5/site_perl/Glib/Object/Introspection.pm line 246."
What's wrong with it? Can I still use Glib::Object::Subclass for inheritance for Gtk3?
#!/usr/bin/perl
use strict;
use warnings;
package MyButton;
use Gtk3;
use Glib::Object::Subclass
Gtk3::Button::,
signals => {},
properties => [],
;
sub INIT_INSTANCE {
my $self = shift;
return $self;
}
sub PARENT_SET {
my $self = shift;
warn "PARENT_SET was called\n";
}
sub HIERARCHY_CHANGED {
my $self = shift;
warn "HIERARCHY_CHANGED was called\n";
}
package main;
use Gtk3 -init;
my $window = Gtk3::Window->new();
$window->signal_connect(delete_event => sub { Gtk3->main_quit() });
my $my_button = MyButton->new(label => "Test");
$window->add($my_button);
$window->show_all();
Gtk3->main();
[ysm helios tmp]$ perl test.pl
(1.pl:7631): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:2:16: Theming engine 'adwaita' not found
PARENT_SET was called
HIERARCHY_CHANGED was called
undef is not of type Gtk3::Gdk::Screen at /usr/lib/perl5/site_perl/Glib/Object/Introspection.pm line 246.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]