summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-08-21 21:21:42 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-08-21 21:21:42 +0000
commit4eb9ae596b3b1d275c74e823f6c786a9848407c9 (patch)
tree3916918c0b98bcb8f9997bc54f07da8545b22f74
parente61b006721a2e5a0c857901d34a3d536471020dd (diff)
downloaddrakx-4eb9ae596b3b1d275c74e823f6c786a9848407c9.tar
drakx-4eb9ae596b3b1d275c74e823f6c786a9848407c9.tar.gz
drakx-4eb9ae596b3b1d275c74e823f6c786a9848407c9.tar.bz2
drakx-4eb9ae596b3b1d275c74e823f6c786a9848407c9.tar.xz
drakx-4eb9ae596b3b1d275c74e823f6c786a9848407c9.zip
- (gtkset_line_wrap) introduce a Gtk2::Label wrapper for
set_line_wrap() - (create_box_with_title) o factorize label creation o fix label wrongly wrap cjk languages by enabling its wrapping (real bugs is that GtkLabel does not really know its geometry: see gtk+ bugs #118045, #118046, #101968 and #104188)
-rw-r--r--perl-install/ugtk2.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm
index 2c51de4f2..1c5cede13 100644
--- a/perl-install/ugtk2.pm
+++ b/perl-install/ugtk2.pm
@@ -94,6 +94,7 @@ sub gtkset_size_request { $_[0]->set_size_request($_[1], $_[2]); $_[0] }
sub gtkshow { $_[0]->show; $_[0] }
sub gtksize { $_[0]->size($_[1], $_[2]); $_[0] }
sub gtkset_markup { $_[0]->set_markup($_[1]); $_[0] }
+sub gtkset_line_wrap { $_[0]->set_line_wrap($_[1]); $_[0] }
sub gtkadd {
my $w = shift;
@@ -302,7 +303,7 @@ sub create_box_with_title {
return $box;
}
$o->{box_size} = n_line_size($nbline, 'text', $box);
- if (@_ <= 2 && ($nbline > 4 || ($nbline > 1 && ref($::o) && $::o->{locale}{lang} =~ /^ja|^zh/))) {
+ if (@_ <= 2 && ($nbline > 4)) {
$o->{icon} && !$::isWizard and
eval { gtkpack__($box, gtkset_border_width(gtkpack_(Gtk2::HBox->new(0,0), 1, gtkcreate_img($o->{icon})),5)) };
my $wanted = $o->{box_size};
@@ -320,6 +321,11 @@ sub create_box_with_title {
} else {
my $a = !$::no_separator;
undef $::no_separator;
+ my $new_label = sub {
+ my ($txt) = @_;
+ my $w = ref($txt) ? $txt : gtkset_line_wrap(Gtk2::Label->new($txt), 1);
+ gtkset_name($w, "Title");
+ };
if ($o->{icon} && (!$::isWizard || $::isInstall)) {
gtkpack__($box,
gtkpack_(Gtk2::HBox->new(0,0),
@@ -329,9 +335,9 @@ sub create_box_with_title {
1, gtkpack_($o->{box_title} = Gtk2::VBox->new(0,0),
1, Gtk2::HBox->new(0,0),
(map {
- my $w = ref($_) ? $_ : Gtk2::Label->new($_);
+ my $w = $new_label->($_);
$::isWizard and $w->set_justify("left");
- (0, gtkset_name($w, "Title"));
+ (0, $w);
} map { ref($_) ? $_ : warp_text($_) } @_),
1, Gtk2::HBox->new(0,0),
)
@@ -342,8 +348,7 @@ sub create_box_with_title {
gtkpack__($box,
if_($::isWizard, gtkset_size_request(Gtk2::Label->new, 0, 10)),
(map {
- my $w = ref($_) ? $_ : Gtk2::Label->new($_);
- gtkset_name($w, "Title");
+ my $w = $new_label->($_);
$::isWizard ? gtkpack__(Gtk2::HBox->new(0,0), gtkset_size_request(Gtk2::Label->new, 20, 0), $w)
: $w
} map { ref($_) ? $_ : warp_text($_) } @_),