aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaarten Vanraes <alien@mageia.org>2016-05-09 09:44:15 +0200
committerMaarten Vanraes <alien@mageia.org>2016-05-09 10:22:32 +0200
commitbfbd54060e10f0f2cdfa417643f6dedee8fe0984 (patch)
tree3de0af4cce6726f3f8ac0576c1cc741c2ef7b074
parent2694a6180633ca8c5b176170b75d0189d3e42b75 (diff)
downloadmanatools-bfbd54060e10f0f2cdfa417643f6dedee8fe0984.tar
manatools-bfbd54060e10f0f2cdfa417643f6dedee8fe0984.tar.gz
manatools-bfbd54060e10f0f2cdfa417643f6dedee8fe0984.tar.bz2
manatools-bfbd54060e10f0f2cdfa417643f6dedee8fe0984.tar.xz
manatools-bfbd54060e10f0f2cdfa417643f6dedee8fe0984.zip
Modules: provide title & icon using the new Module
-rw-r--r--lib/ManaTools/MainDisplay.pm26
-rw-r--r--lib/ManaTools/Module/Clock.pm36
-rw-r--r--lib/ManaTools/Module/DisplayManager.pm13
-rw-r--r--lib/ManaTools/Module/Firewall.pm13
-rw-r--r--lib/ManaTools/Module/Hosts.pm13
-rw-r--r--lib/ManaTools/Module/LogViewer.pm13
-rw-r--r--lib/ManaTools/Module/PkgDownloader.pm5
-rw-r--r--lib/ManaTools/Module/Proxy.pm13
-rw-r--r--lib/ManaTools/Module/Services.pm13
-rw-r--r--lib/ManaTools/Module/Users.pm13
10 files changed, 55 insertions, 103 deletions
diff --git a/lib/ManaTools/MainDisplay.pm b/lib/ManaTools/MainDisplay.pm
index 3768f944..ecdbda55 100644
--- a/lib/ManaTools/MainDisplay.pm
+++ b/lib/ManaTools/MainDisplay.pm
@@ -117,30 +117,14 @@ with 'ManaTools::ConfigDirRole';
#=============================================================
has '+name' => (
- is => 'ro',
- isa => 'Str',
default => 'mpan',
+ required => 0,
+ init_arg => 'name',
);
-has '+icon' => (
- is => 'rw',
- isa => 'Str',
- default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/mageia.png'),
-);
-
-has 'title' => (
- is => 'rw',
- isa => 'Str',
- init_arg => undef,
- lazy => 1,
- builder => '_titleInitialize',
-);
-
-sub _titleInitialize {
- my $self = shift;
-
- return $self->name();
-}
+override('_iconInitializer', sub {
+ return (File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/mageia.png'),
+});
has 'settings' => (
is => 'rw',
diff --git a/lib/ManaTools/Module/Clock.pm b/lib/ManaTools/Module/Clock.pm
index 3b4d2605..ba8f2e11 100644
--- a/lib/ManaTools/Module/Clock.pm
+++ b/lib/ManaTools/Module/Clock.pm
@@ -67,10 +67,18 @@ use Time::Piece;
use yui;
-has '+icon' => (
- default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manaclock.png'),
+has '+name' => (
+ default => 'manaclock',
+ required => 0,
+ init_arg => undef,
);
+override('_titleInitializer', sub {
+ my $self = shift;
+
+ return ($self->loc->N("%s - Date, Clock & Time Zone Settings", $self->name()));
+});
+
has 'sh_gui' => (
is => 'rw',
lazy => 1,
@@ -106,30 +114,6 @@ has 'NTPServers' => (
#=============================================================
-=head2 BUILD
-
-=head3 INPUT
-
- $self: this object
-
-=head3 DESCRIPTION
-
- The BUILD method is called after a Moose object is created,
- in this methods Services loads all the service information.
-
-=cut
-
-#=============================================================
-sub BUILD {
- my $self = shift;
-
- if (! $self->name) {
- $self->name ($self->loc->N("Date, Clock & Time Zone Settings"));
- }
-}
-
-#=============================================================
-
=head2 start
=head3 INPUT
diff --git a/lib/ManaTools/Module/DisplayManager.pm b/lib/ManaTools/Module/DisplayManager.pm
index e40d8c24..32599f9c 100644
--- a/lib/ManaTools/Module/DisplayManager.pm
+++ b/lib/ManaTools/Module/DisplayManager.pm
@@ -42,19 +42,16 @@ use MDK::Common::Func qw(find);
extends qw( ManaTools::Module );
-has '+icon' => (
- default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manadm.png'),
-);
-
has '+name' => (
- lazy => 1,
- builder => '_nameInitializer',
+ default => 'manadm',
+ required => 0,
+ init_arg => undef,
);
-sub _nameInitializer {
+sub _titleInitializer {
my $self = shift;
- return ($self->loc->N("manadm - Display Manager"));
+ return ($self->loc->N("%s - Display Manager", $self->name()));
}
has 'dialog' => (
diff --git a/lib/ManaTools/Module/Firewall.pm b/lib/ManaTools/Module/Firewall.pm
index f5c5b370..41a0b709 100644
--- a/lib/ManaTools/Module/Firewall.pm
+++ b/lib/ManaTools/Module/Firewall.pm
@@ -74,19 +74,16 @@ sub _configDirBuilder {
with 'ManaTools::ConfigDirRole';
-has '+icon' => (
- default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manawall.png'),
-);
-
has '+name' => (
- lazy => 1,
- builder => '_nameInitializer',
+ default => 'manawall',
+ required => 0,
+ init_arg => undef,
);
-sub _nameInitializer {
+sub _titleInitializer {
my $self = shift;
- return ($self->loc->N("manawall - Firewall Manager"));
+ return ($self->loc->N("%s - Firewall Manager", $self->name()));
}
diff --git a/lib/ManaTools/Module/Hosts.pm b/lib/ManaTools/Module/Hosts.pm
index 4d069a62..48b2cfdd 100644
--- a/lib/ManaTools/Module/Hosts.pm
+++ b/lib/ManaTools/Module/Hosts.pm
@@ -36,19 +36,16 @@ use ManaTools::Shared::Hosts;
extends qw( ManaTools::Module );
-has '+icon' => (
- default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manahost.png'),
-);
-
has '+name' => (
- lazy => 1,
- builder => '_nameInitializer',
+ default => 'manahost',
+ required => 0,
+ init_arg => undef,
);
-sub _nameInitializer {
+sub _titleInitializer {
my $self = shift;
- return ($self->loc->N("manahost - manage hosts definitions"));
+ return ($self->loc->N("%s - manage hosts definitions", $self->name()));
}
has 'dialog' => (
diff --git a/lib/ManaTools/Module/LogViewer.pm b/lib/ManaTools/Module/LogViewer.pm
index e471d1b0..b0237e25 100644
--- a/lib/ManaTools/Module/LogViewer.pm
+++ b/lib/ManaTools/Module/LogViewer.pm
@@ -69,19 +69,16 @@ use yui;
extends qw( ManaTools::Module );
-has '+icon' => (
- default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manalog.png'),
-);
-
has '+name' => (
- lazy => 1,
- builder => '_nameInitializer',
+ default => 'manalog',
+ required => 0,
+ init_arg => undef,
);
-sub _nameInitializer {
+sub _titleInitializer {
my $self = shift;
- return ($self->loc->N("Log viewer"));
+ return ($self->loc->N("%s - Log viewer", $self->name()));
}
has 'sh_gui' => (
diff --git a/lib/ManaTools/Module/PkgDownloader.pm b/lib/ManaTools/Module/PkgDownloader.pm
index 1ae765a9..43c3d9db 100644
--- a/lib/ManaTools/Module/PkgDownloader.pm
+++ b/lib/ManaTools/Module/PkgDownloader.pm
@@ -38,6 +38,11 @@ my $QUERY_LOOKFORSRPM_PARM = "--sourcerpm";
my $QUERY_PKG_FULL = "-f";
my $DLDER = "--wget";
+has '+name' => (
+ default => 'urpm-downloader',
+ required => 0,
+ init_arg => undef,
+);
has 'use_wget' => (
is => 'rw',
diff --git a/lib/ManaTools/Module/Proxy.pm b/lib/ManaTools/Module/Proxy.pm
index fa3a8a3c..9869a197 100644
--- a/lib/ManaTools/Module/Proxy.pm
+++ b/lib/ManaTools/Module/Proxy.pm
@@ -41,19 +41,16 @@ use MDK::Common::System qw(getVarsFromSh);
extends qw( ManaTools::Module );
-has '+icon' => (
- default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manaproxy.png'),
-);
-
has '+name' => (
- lazy => 1,
- builder => '_nameInitializer',
+ default => 'manaproxy',
+ required => 0,
+ init_arg => undef,
);
-sub _nameInitializer {
+sub _titleInitializer {
my $self = shift;
- return ($self->loc->N("manaproxy - Proxy configuration"));
+ return ($self->loc->N("%s - Proxy configuration", $self->name()));
};
has 'dialog' => (
diff --git a/lib/ManaTools/Module/Services.pm b/lib/ManaTools/Module/Services.pm
index cb4c47d9..c1313cb1 100644
--- a/lib/ManaTools/Module/Services.pm
+++ b/lib/ManaTools/Module/Services.pm
@@ -74,19 +74,16 @@ use File::Basename;
extends qw( ManaTools::Module );
-has '+icon' => (
- default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manaservice.png'),
-);
-
has '+name' => (
- lazy => 1,
- builder => '_nameInitializer',
+ default => 'manaservice',
+ required => 0,
+ init_arg => undef,
);
-sub _nameInitializer {
+sub _titleInitializer {
my $self = shift;
- return ($self->loc->N("Services and daemons"));
+ return ($self->loc->N("%s - Services and daemons", $self->name()));
};
has '_services' => (
diff --git a/lib/ManaTools/Module/Users.pm b/lib/ManaTools/Module/Users.pm
index 715765d3..3e872ffa 100644
--- a/lib/ManaTools/Module/Users.pm
+++ b/lib/ManaTools/Module/Users.pm
@@ -103,19 +103,16 @@ has 'moduleName' => (
default => 'manauser',
);
-has '+icon' => (
- default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manauser.png'),
-);
-
has '+name' => (
- lazy => 1,
- builder => '_nameInitializer',
+ default => 'manauser',
+ required => 0,
+ init_arg => undef,
);
-sub _nameInitializer {
+sub _titleInitializer {
my $self = shift;
- return ($self->loc->N("manauser - Mageia Users Management Tool"));
+ return ($self->loc->N("%s - Users Management Tool", $self->name()));
}
# main dialog