From 4aee15de468be338158f2a1d32a95a62c65c5391 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 24 Mar 2005 11:15:18 +0000 Subject: (Gtk2::Banner::new) ensure icon is centered vertically --- perl-install/ugtk2.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index f0ae478eb..c147064eb 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -1530,7 +1530,8 @@ sub new { my ($_class, $icon, $text, $o_options) = @_; my $darea = Gtk2::DrawingArea->new; - $darea->set_size_request(-1, 75); + my $d_height = 75; + $darea->set_size_request(-1, $d_height); $darea->modify_font(Gtk2::Pango::FontDescription->from_string(common::N("_banner font:\nSans 14"))); $darea->{icon} = ugtk2::gtkcreate_pixbuf($icon); $darea->{text} = $text; @@ -1540,9 +1541,10 @@ sub new { $darea->signal_connect(expose_event => sub { my $style = $darea->get_style; my $height = $darea->{icon}->get_height; + my $padding = int(($d_height - $height)/2); $darea->{icon}->render_to_drawable($darea->window, $style->bg_gc('normal'), - 0, 0, 10, 10, -1, -1, 'none', 0, 0); - $darea->window->draw_layout($style->text_gc('normal'), $height + 20, $o_options->{txt_ypos} || 25, + 0, 0, $padding, $padding, -1, -1, 'none', 0, 0); + $darea->window->draw_layout($style->text_gc('normal'), $height + $padding*2, $o_options->{txt_ypos} || 25, $darea->{layout}); 1; }); -- cgit v1.2.1