From a550b67fcd217af0799b15e39b1feb2cba4db60e Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 19 Jan 2004 16:14:09 +0000 Subject: (reate_box_with_title) shrink TextView size to its minimal size in order to get the bigger place for other widgets --- perl-install/ugtk2.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'perl-install') diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index 6dc7bbd9f..d5e680a82 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -317,7 +317,15 @@ sub create_box_with_title { $wtext->signal_connect(button_press_event => sub { 1 }); #- disable selecting text and popping the contextual menu (GUI team says it's *horrible* to be able to do select text!) chomp(my $text = join("\n", @_)); my $scroll = create_scrolled_window(gtktext_insert($wtext, $text)); - $scroll->set_size_request(400, $o->{box_size}); + my $width = 400; + $scroll->signal_connect(realize => sub { + my $layout = $wtext->create_pango_layout ($text); + $layout->set_width(($width - 10) * Gtk2::Pango->scale); + $wtext->set_size_request($width, min(200, ($layout->get_pixel_size)[1] + 10)); + $scroll->set_size_request($width, min(200, ($layout->get_pixel_size)[1] + 10)); + $o->{rwindow}->queue_resize; + }); + $scroll->set_size_request($width, 200); gtkpack_($box, 0, $scroll); } else { my $a = !$::no_separator; -- cgit v1.2.1