summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-03-19 09:47:57 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-03-19 09:47:57 +0000
commit7538c096b8ca5c4058979ba042aaa400e86ce734 (patch)
tree797589afb11136878a344ebad22b4185b8c4b18c /perl-install
parent872fd1386f5ddb4ec60d71e417a58db26393ad47 (diff)
downloaddrakx-7538c096b8ca5c4058979ba042aaa400e86ce734.tar
drakx-7538c096b8ca5c4058979ba042aaa400e86ce734.tar.gz
drakx-7538c096b8ca5c4058979ba042aaa400e86ce734.tar.bz2
drakx-7538c096b8ca5c4058979ba042aaa400e86ce734.tar.xz
drakx-7538c096b8ca5c4058979ba042aaa400e86ce734.zip
- fix _find_imgfile()
- cleanup
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/ugtk2.pm21
1 files changed, 13 insertions, 8 deletions
diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm
index 6ec924ecb..a68acd4c1 100644
--- a/perl-install/ugtk2.pm
+++ b/perl-install/ugtk2.pm
@@ -579,14 +579,18 @@ sub create_hpaned {
# several places of your programs.
sub _find_imgfile {
- my ($f, @extensions) = shift;
- @extensions or @extensions = qw(.png .xpm);
- if ($f !~ m|^/|) {
+ my ($name) = @_;
+
+ if ($name =~ m|^/|) {
+ $name;
+ } else {
foreach my $path (icon_paths()) {
- -f "$path/$f$_" and $f = "$path/$f$_" foreach '', @extensions;
+ foreach ('', '.png', '.xpm') {
+ my $file = "$path/$name$_";
+ -f $file and return $file;
+ }
}
}
- return $f;
}
# use it if you want to display an icon/image in your app
@@ -602,9 +606,10 @@ sub gtkcreate_pixbuf {
sub gtktext_append { gtktext_insert(@_, append => 1) }
sub may_set_icon {
- my ($w, $f, @extensions) = @_;
- $f = $f && _find_imgfile($f, @extensions) or return;
- $w->set_icon(gtkcreate_pixbuf($f));
+ my ($w, $name) = @_;
+ if (my $f = $name && _find_imgfile($name)) {
+ $w->set_icon(gtkcreate_pixbuf($f));
+ }
}
# choose one of the two styles: