Re: Gtk2->show_about_dialog() bug



On Nov 18, 2006, at 8:56 AM, Torsten Schoenfeld wrote:

Any suggestions for improvements?
I don't know if this would be an improvement, but we could move the  
implementation to perl to emphasize the fact that it's just a  
convenience function.
Provided that the license and credits dialogs are made transient to  
their About parent, you should be able to do something like this:
#!/usr/bin/perl -w

use strict;
use Gtk2 -init;

my $hold = Gtk2::MessageDialog->new (undef, [], 'info', 'ok', 'Hold');
my $dialog = Gtk2::MessageDialog->new ($hold, [], 'info', 'ok', 'Dialog'); my $childd = Gtk2::MessageDialog->new ($dialog, [], 'info', 'ok', 'Child');
$hold->show;
$dialog->show;
$childd->show;

$dialog->signal_connect (response => sub {
    # destroy all windows transient to this one.
    foreach my $w (Gtk2::Window->list_toplevels ()) {
        next if $w == $dialog;
        my $parent = $w->get_transient_for;
        $w->destroy if $parent && $parent == $dialog;
    }
    $dialog->destroy;
});

$hold->signal_connect (response => sub { $_[0]->destroy });
$hold->signal_connect (destroy => sub { Gtk2->main_quit });

Gtk2->main;




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