summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-03-24 11:15:49 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-03-24 11:15:49 +0000
commit66fd6d0c42ba6dc8cbf104613550334878ceba96 (patch)
tree01e617945e967c79f7a121737710a72ec51c4f60
parent4aee15de468be338158f2a1d32a95a62c65c5391 (diff)
downloaddrakx-66fd6d0c42ba6dc8cbf104613550334878ceba96.tar
drakx-66fd6d0c42ba6dc8cbf104613550334878ceba96.tar.gz
drakx-66fd6d0c42ba6dc8cbf104613550334878ceba96.tar.bz2
drakx-66fd6d0c42ba6dc8cbf104613550334878ceba96.tar.xz
drakx-66fd6d0c42ba6dc8cbf104613550334878ceba96.zip
(Gtk2::Banner::new) make banner be RTL aware (aka follow language direction
and display itself mirrored for RTL languages) (#11910)
-rw-r--r--perl-install/ugtk2.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm
index c147064eb..4d21d3aec 100644
--- a/perl-install/ugtk2.pm
+++ b/perl-install/ugtk2.pm
@@ -1523,6 +1523,7 @@ sub set_pixmap {
return if !$darea->realized;
ugtk2::set_back_pixmap($darea);
$darea->{layout} = $darea->create_pango_layout($darea->{text});
+ $darea->{txt_width} = ($darea->{layout}->get_pixel_size)[0];
}
@@ -1535,6 +1536,7 @@ sub new {
$darea->modify_font(Gtk2::Pango::FontDescription->from_string(common::N("_banner font:\nSans 14")));
$darea->{icon} = ugtk2::gtkcreate_pixbuf($icon);
$darea->{text} = $text;
+ my $is_rtl = lang::text_direction_rtl();
$darea->signal_connect(realize => \&set_pixmap);
$darea->signal_connect("style-set" => \&set_pixmap);
@@ -1542,9 +1544,12 @@ sub new {
my $style = $darea->get_style;
my $height = $darea->{icon}->get_height;
my $padding = int(($d_height - $height)/2);
+ my $d_width = $darea->allocation->width;
+ my $x_icon = $is_rtl ? $d_width - $padding - $darea->{icon}->get_width : $padding;
+ my $x_text = $is_rtl ? $x_icon - $padding - $darea->{txt_width} : $height + $padding*2;
$darea->{icon}->render_to_drawable($darea->window, $style->bg_gc('normal'),
- 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,
+ 0, 0, $x_icon, $padding, -1, -1, 'none', 0, 0);
+ $darea->window->draw_layout($style->text_gc('normal'), $x_text, $o_options->{txt_ypos} || 25,
$darea->{layout});
1;
});