signal_add_emission_hook first in program



The program below gets an error

  Unknown signal realize for object of type  at /usr/lib/perl5/Glib.pm line 211.

where I hoped it would print "realized something".

I wonder if signal_add_emission_hook() has to cope with lazy loading of
types or something.  Calling the commented-out find_property() just as a
dummy first seems to drag in whatever's needed to make it work.

use strict;
use warnings;
use Gtk2 '-init';

# Gtk2::Widget->find_property ('name');

Gtk2::Widget->signal_add_emission_hook
  (realize => sub { print "realized something\n"; });

my $toplevel = Gtk2::Window->new ('toplevel');
$toplevel->show_all;
Gtk2->main;
exit 0;


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