• Load icons from disc only once
• Use source directory if not installed
# supported and available plugins lists
my @PLUGINS = qw(AttRemover GPG ManageSieve Libravatar PerlPlugin);
my @AVPLUGINS = ();
# supported and available plugins lists
my @PLUGINS = qw(AttRemover GPG ManageSieve Libravatar PerlPlugin);
my @AVPLUGINS = ();
+# loaded icons
+my @APPICONS = ();
# index constants for preference arrays
use constant NAME => 0; # the name on the rc file
# index constants for preference arrays
use constant NAME => 0; # the name on the rc file
- my $dir = $DATADIR . '/icons/hicolor';
- my @names = map {
- join ('/', ($dir, , $_ . 'x' . $_, 'apps', $NAME . '.png'))
- } (64, 128);
- my @icons = ();
+ return @APPICONS if (@APPICONS);
+ my @names;
+ if (-d $DATADIR) { # installed
+ my $dir = $DATADIR . '/icons/hicolor';
+ @names = map {
+ join ('/', ($dir, $_ . 'x' . $_, 'apps', $NAME . '.png'))
+ } (64, 128);
+ } else { # unpacked tarball or git clone
+ @names = map {
+ join ('/', ('./icons', $NAME . '-' . $_ . '.png'));
+ } (64, 128);
+ }
foreach (@names) {
my $icon = undef;
$icon = Gtk2::Gdk::Pixbuf->new_from_file($_) if (-f $_);
foreach (@names) {
my $icon = undef;
$icon = Gtk2::Gdk::Pixbuf->new_from_file($_) if (-f $_);
- push @icons, $icon if ($icon);
+ push @APPICONS, $icon if ($icon);