From bba9db3a0f511d3ace91477cedd8bfec0235872b Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Thu, 5 Jun 2014 23:08:01 +0200 Subject: Hosts now uses AdminPanel::Shared::GUI --- lib/AdminPanel/Module/Hosts.pm | 31 +++++++++++++++++++++---------- lib/AdminPanel/Module/Services.pm | 2 +- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/lib/AdminPanel/Module/Hosts.pm b/lib/AdminPanel/Module/Hosts.pm index a509b43..3fbb871 100644 --- a/lib/AdminPanel/Module/Hosts.pm +++ b/lib/AdminPanel/Module/Hosts.pm @@ -28,7 +28,8 @@ use utf8; use Glib; use yui; -use AdminPanel::Shared; +use AdminPanel::Shared qw(trim); +use AdminPanel::Shared::GUI; use AdminPanel::Shared::Hosts; extends qw( AdminPanel::Module ); @@ -65,6 +66,18 @@ has 'cfgHosts' => ( init_arg => undef ); +has 'sh_gui' => ( + is => 'rw', + init_arg => undef, + builder => '_SharedUGUIInitialize' +); + +sub _SharedUGUIInitialize { + my $self = shift(); + + $self->sh_gui(AdminPanel::Shared::GUI->new() ); +} + #============================================================= =head2 start @@ -177,7 +190,7 @@ sub _manipulateHostDialog { my $res = undef; my @hosts_toadd; push @hosts_toadd, $textHostName->value(); - if(trim($textHostAlias->value()) ne ""){ + if(AdminPanel::Shared::trim($textHostAlias->value()) ne ""){ push @hosts_toadd, $textHostAlias->value(); } print "@hosts_toadd\n"; @@ -334,7 +347,7 @@ sub _manageHostsDialog { } elsif ($widget == $remButton) { # implement deletion dialog - if(AdminPanel::Shared::ask_YesOrNo("Confirmation","Are you sure to drop this host?") == 1){ + if($self->sh_gui->ask_YesOrNo({title => "Confirmation", text => "Are you sure to drop this host?"}) == 1){ my $tblItem = yui::toYTableItem($self->table->selectedItem()); # drop the host using the ip $self->cfgHosts->_dropHost($tblItem->cell(0)->label()); @@ -343,15 +356,13 @@ sub _manageHostsDialog { $self->setupTable(); } }elsif ($widget == $aboutButton) { - AdminPanel::Shared::AboutDialog({ + $self->sh_gui->AboutDialog({ name => $appTitle, version => $VERSION, - copyright => "Copyright (c) 2013-2014 by Matteo Pasotti", - license => $AdminPanel::Shared::License, - comments => "Graphical manager for hosts definitions", - website => "http://gitweb.mageia.org/software/adminpanel", - website_label => "Mageia", - authors => "Matteo Pasotti " + credits => "Copyright (c) 2013-2014 by Matteo Pasotti", + license => "GPLv2", + description => "Graphical manager for hosts definitions", + authors => "Matteo Pasotti <matteo.pasotti\@gmail.com>" } ); }elsif ($widget == $okButton) { diff --git a/lib/AdminPanel/Module/Services.pm b/lib/AdminPanel/Module/Services.pm index 2d7ed7c..365f3e1 100644 --- a/lib/AdminPanel/Module/Services.pm +++ b/lib/AdminPanel/Module/Services.pm @@ -447,7 +447,7 @@ sub _servicePanel { last; } elsif ($widget == $aboutButton) { - my $translators = $self->loc->N("_: Translator(s) name(s) & email(s)\n"); + my $translators = $self->loc->N("_: Translator(s) name(s) & email(s)\n"); $translators =~ s/\/\>\;/g; $self->sh_gui->AboutDialog({ name => $self->name, -- cgit v1.2.1