From 4e73cd4e6bbf81776c8b10e8f035d84bdd9632bc Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 25 Jul 2002 15:56:50 +0000 Subject: use a function icon_paths instead of @icon_paths => this ensure that $ENV{SHARE_PATH} value (used in @icon_paths) is set independently of the loading order of the modules --- perl-install/my_gtk.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'perl-install/my_gtk.pm') diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 21f43f05a..90433cc00 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -379,15 +379,18 @@ sub gtkctree_children { @l; } -my @icon_paths = ($ENV{SHARE_PATH}, "$ENV{SHARE_PATH}/icons", "$ENV{SHARE_PATH}/libDrakX/pixmaps", "/usr/lib/libDrakX/icons", "pixmaps", 'standalone/icons'); +my @icon_paths = (); +sub add_icon_path { push @icon_paths, @_ } -sub add_icon_path { @icon_paths = uniq(@icon_paths, @_) } +sub icon_paths { + (@icon_paths, $ENV{SHARE_PATH}, "$ENV{SHARE_PATH}/icons", "$ENV{SHARE_PATH}/libDrakX/pixmaps", "/usr/lib/libDrakX/icons", "pixmaps", 'standalone/icons'); +} sub gtkcreate_xpm { my ($f) = @_; my $rw = gtkroot(); $f =~ m|.xpm$| or $f="$f.xpm"; - if ( $f !~ /\//) { -e "$_/$f" and $f="$_/$f", last foreach @icon_paths } + if ( $f !~ /\//) { -e "$_/$f" and $f="$_/$f", last foreach icon_paths() } my @l = Gtk::Gdk::Pixmap->create_from_xpm($rw, new Gtk::Style->bg('normal'), $f) or die "gtkcreate_xpm: missing pixmap file $f"; @l; } @@ -395,7 +398,7 @@ sub gtkcreate_xpm { sub gtkcreate_png { my ($f) = shift; $f =~ m|.png$| or $f="$f.png"; - if ( $f !~ /\//) { -e "$_/$f" and $f="$_/$f", last foreach @icon_paths } + if ( $f !~ /\//) { -e "$_/$f" and $f="$_/$f", last foreach icon_paths() } my $im = Gtk::Gdk::ImlibImage->load_image($f) or die "gtkcreate_png: missing png file $f"; $im->render($im->rgb_width, $im->rgb_height); ($im->move_image(), $im->move_mask); -- cgit v1.2.1