From 83862af83ddce62bcf54b1d706e31780645c7fc4 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 17 Sep 2009 10:07:36 +0000 Subject: (create_widget) use stock icons for up & down buttons in order to pack them horizontaly so that we fit in default sizing(#53703) --- perl-install/interactive/gtk.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'perl-install/interactive/gtk.pm') diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index ecdcf554c..971203960 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -453,10 +453,12 @@ sub create_widget { my @buttons = (N_("Add"), N_("Modify"), N_("Remove")); # Add Up/Down buttons if their actions are defined foreach (qw(Up Down)) { - push @buttons, $_ if $actions->{$_}; + push @buttons, 'gtk-go-' . lc($_) if $actions->{$_}; } @buttons = map { - { kind => lc $_, action => $actions->{$_}, button => Gtk2::Button->new(translate($_)) }; + my $button = /^gtk-/ ? gtknew('Button', image => gtknew('Image', stock => $_)) + : Gtk2::Button->new(translate($_)); + { kind => lc $_, action => $actions->{$_}, button => $button }; } @buttons; my $modify = find { $_->{kind} eq 'modify' } @buttons; @@ -473,9 +475,19 @@ sub create_widget { } add_modify_remove_sensitive(\@buttons, $e); + my ($images, $real_buttons) = partition { $_->{kind} =~ /^gtk-/ } @buttons; $real_w = gtkpack_(Gtk2::HBox->new(0,0), 1, create_scrolled_window($w), - 0, gtkpack__(Gtk2::VBox->new(0,0), map { $_->{button} } @buttons)); + 0, gtkpack__(Gtk2::VBox->new(0,0), + (map { $_->{button} } @$real_buttons), + if_($images, + gtknew('HButtonBox', + layout => 'spread', + children_loose => [ map { $_->{button} } @$images] + ) + ), + ), + ); $e->{grow} = 'expand'; } else { my $use_boxradio = exists $e->{gtk}{use_boxradio} ? $e->{gtk}{use_boxradio} : @{$e->{list}} <= 8; -- cgit v1.2.1