From 8b5271483157d2e747db5dcdd8624ee4b5705fff Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 31 Jul 2002 20:04:11 +0000 Subject: (create_box_with_title): create an empty box when there is no message (also don't set $o->{box} since unused outside of this function) --- perl-install/my_gtk.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index a7d67f993..0333123bf 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -736,11 +736,13 @@ sub create_box_with_title($@) { my $o = shift; my $nbline = sum(map { round(length($_) / 60 + 1/2) } map { split "\n" } @_); - $o->{box} = new Gtk::VBox(0,0); - $o->{box_size} = n_line_size($nbline, 'text', $o->{box}); + my $box = new Gtk::VBox(0,0); + return $box if $nbline == 0; + + $o->{box_size} = n_line_size($nbline, 'text', $box); if (@_ <= 2 && $nbline > 4) { $o->{icon} && !$::isWizard and - eval { gtkpack__($o->{box}, gtkset_border_width(gtkpack_(new Gtk::HBox(0,0), 1, gtkpng($o->{icon})),5)) }; + eval { gtkpack__($box, gtkset_border_width(gtkpack_(new Gtk::HBox(0,0), 1, gtkpng($o->{icon})),5)) }; my $wanted = $o->{box_size}; $o->{box_size} = min(200, $o->{box_size}); my $has_scroll = $o->{box_size} < $wanted; @@ -750,12 +752,12 @@ sub create_box_with_title($@) { chomp(my $text = join("\n", @_)); my $scroll = createScrolledWindow(gtktext_insert($wtext, $text)); $scroll->set_usize(400, $o->{box_size}); - gtkpack__($o->{box}, $scroll); + gtkpack__($box, $scroll); } else { my $a = !$::no_separator; undef $::no_separator; if ($o->{icon} && !$::isWizard) { - gtkpack__($o->{box}, + gtkpack__($box, gtkpack_(new Gtk::HBox(0,0), 0, gtkset_usize(new Gtk::VBox(0,0), 15, 0), 0, eval { gtkpng($o->{icon}) }, @@ -774,7 +776,7 @@ sub create_box_with_title($@) { if_($a, new Gtk::HSeparator) ) } else { - gtkpack__($o->{box}, + gtkpack__($box, (map { my $w = ref $_ ? $_ : new Gtk::Label($_); $::isWizard and $w->set_justify("left"); -- cgit v1.2.1