From 96942e4ddfa330bb339d13d0ac2c0a8941db168a Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Mon, 4 Jan 2016 18:52:35 +0100 Subject: managed also relative pathnamed icons --- MODULE_HACKING | 5 +++++ lib/ManaTools/MainDisplay.pm | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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 +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} ); } -- cgit v1.2.1