From 955dc2828451b68164b152a20bf2335b64b2e96a Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 4 Aug 2005 05:00:57 +0000 Subject: simplify --- perl-install/standalone/draksplash | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/perl-install/standalone/draksplash b/perl-install/standalone/draksplash index 71228c7a7..5f3f4980c 100755 --- a/perl-install/standalone/draksplash +++ b/perl-install/standalone/draksplash @@ -162,24 +162,21 @@ sub load_image { $image_pixbuf[$mode] = $image_pixbuf[$mode]->scale_simple($theme{res_w}, $theme{res_h}, 'hyper'); $image_pixbuf[1-$mode] or $image_pixbuf[1-$mode] = $image_pixbuf[$mode]; $image_area->queue_draw; + 1; } sub choose_image { - my ($name) = @_; + my ($type) = @_; my $file_dialog = Gtk2::FileChooserDialog->new(N("choose image"), $window->{real_window}, 'open', N("Cancel") => 'cancel', N("Ok") => 'ok'); - $file_dialog->set_filename($theme{$name} || '~/'); + $file_dialog->set_filename($theme{$type} || '~/'); $file_dialog->show; - while (my $answer = $file_dialog->run) { - if (member($answer, qw(cancel delete-event))) { - $file_dialog->destroy; - return; - } elsif ($answer eq 'ok') { - load_image(my $img = $file_dialog->get_filename); - $theme{conf}{$name} = $img; - $file_dialog->destroy; - return; + while ($file_dialog->run eq 'ok') { + if (load_image(my $img = $file_dialog->get_filename)) { + $theme{conf}{$type} = $img; + last; } } + $file_dialog->destroy; } sub choose_color() { -- cgit v1.2.1