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

Re: exception trap in key snooper callback



I wrote:
>
> Is there anything beyond the key snooper
> which is a main loop callback not using a GClosure thingie?

I see LinkButton and two AboutDialog callbacks exit the program on an
error (samples below).  That'd make 4 or 5 places where the
Glib->exception stuff would be helpful.  So if they could share
some code ...

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

my $toplevel = Gtk2::Window->new ('toplevel');

my $button = Gtk2::LinkButton->new ('http://localhost/index.html',
                                    'Click to throw an error');
$toplevel->add ($button);

Glib->install_exception_handler (sub {
                                   print "exception handler\n";
                                 });
Gtk2::LinkButton->set_uri_hook (sub { print "uri hook\n";
                                      die "some error\n";
                                    });

$toplevel->show_all;
Gtk2->main;
print "exit 0\n";
exit 0;
use strict;
use warnings;
use Gtk2 '-init';

Glib->install_exception_handler (sub {
                                   print "exception handler\n";
                                 });

Gtk2::AboutDialog->set_url_hook (sub { print "url hook\n";
                                       die "some error\n";
                                     });
Gtk2::AboutDialog->set_email_hook (sub { print "email hook\n";
                                         die "some error\n";
                                       });

my $dialog = Gtk2::AboutDialog->new;
$dialog->set_authors ('Click for Error <foo bar com>');
$dialog->set_website ('http://localhost/index.html');
$dialog->set_website_label ('Home Page: Click to throw an error');

$dialog->show;
Gtk2->main;
print "exit 0\n";
exit 0;
-- 
"Two hours of sparkling entertainment spread over a four hour show."


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