aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2016-01-04 18:52:35 +0100
committerAngelo Naselli <anaselli@linux.it>2016-01-04 18:52:35 +0100
commit96942e4ddfa330bb339d13d0ac2c0a8941db168a (patch)
tree2ad14cb2fde4e1eefb12cb5256c1d1e44168b2ec
parentedd211c4827a0ce8b19d7baf5ce6c1c8163192da (diff)
downloadmanatools-96942e4ddfa330bb339d13d0ac2c0a8941db168a.tar
manatools-96942e4ddfa330bb339d13d0ac2c0a8941db168a.tar.gz
manatools-96942e4ddfa330bb339d13d0ac2c0a8941db168a.tar.bz2
manatools-96942e4ddfa330bb339d13d0ac2c0a8941db168a.tar.xz
manatools-96942e4ddfa330bb339d13d0ac2c0a8941db168a.zip
managed also relative pathnamed icons
-rw-r--r--MODULE_HACKING5
-rw-r--r--lib/ManaTools/MainDisplay.pm12
2 files changed, 16 insertions, 1 deletions
diff --git a/MODULE_HACKING b/MODULE_HACKING
index aaee7cb0..e5e3e3fa 100644
--- a/MODULE_HACKING
+++ b/MODULE_HACKING
@@ -115,6 +115,11 @@ Let's see an example of a category configuration
</module>
</category>
+Note that icon and logo elements could be absolute or relative
+pathnames (e.g. no "/" as first char), if relative the absolute
+pathname is evaluated as
+File::ShareDir::dist_file(ManaTools::Shared::distName(), 'given/file').
+
First module is a perl ManaTools::Module extension (Services),
latter is an external one, called "module" and with a full pathname.
diff --git a/lib/ManaTools/MainDisplay.pm b/lib/ManaTools/MainDisplay.pm
index 5be17d01..59915b69 100644
--- a/lib/ManaTools/MainDisplay.pm
+++ b/lib/ManaTools/MainDisplay.pm
@@ -641,6 +641,10 @@ sub _loadSettings {
);
$self->logger()->I($self->loc()->N("Load settings: %s content is <<%s>>", $key, $settings->{$key}));
}
+ elsif (($key eq "icon" || $key eq "logo") && (substr( $read->{$key}, 0, 1) ne '/')) {
+ # icon with relative path?
+ $settings->{$key} = File::ShareDir::dist_file(ManaTools::Shared::distName(), $read->{$key});
+ }
else {
$settings->{$key} = $read->{$key};
}
@@ -825,11 +829,17 @@ sub _loadCategories {
$tmp,
'title'
);
+ my $icon = $tmp->{icon};
+ if ((substr( $icon, 0, 1) ne '/')) {
+ # icon with relative path?
+ $icon = File::ShareDir::dist_file(ManaTools::Shared::distName(), $tmp->{icon});
+ }
+
$self->logger()->D($self->loc()->N("Load categories: module title is <<%s>>", $title));
if (not $currCategory->moduleLoaded($title)) {
$tmpMod = ManaTools::Module->create(
name => $title,
- icon => $tmp->{icon},
+ icon => $icon,
launch => $tmp->{launcher}
);
}