diff options
author | Angelo Naselli <anaselli@linux.it> | 2015-09-05 12:34:37 +0200 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2015-09-05 12:34:37 +0200 |
commit | 5b03338ff3e41e43a328b60c89a2c6f853c4fe56 (patch) | |
tree | e32b3b743eef6ae0dbf98e8e9c99d9858d140aad | |
parent | 75db02b0fdc7e435869eea8605c79bd1a47b67ce (diff) | |
download | manatools-5b03338ff3e41e43a328b60c89a2c6f853c4fe56.tar manatools-5b03338ff3e41e43a328b60c89a2c6f853c4fe56.tar.gz manatools-5b03338ff3e41e43a328b60c89a2c6f853c4fe56.tar.bz2 manatools-5b03338ff3e41e43a328b60c89a2c6f853c4fe56.tar.xz manatools-5b03338ff3e41e43a328b60c89a2c6f853c4fe56.zip |
Fixed factories initialization
-rw-r--r-- | lib/ManaTools/Shared/GUI/Dialog.pm | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/ManaTools/Shared/GUI/Dialog.pm b/lib/ManaTools/Shared/GUI/Dialog.pm index 7650507f..e5a0a884 100644 --- a/lib/ManaTools/Shared/GUI/Dialog.pm +++ b/lib/ManaTools/Shared/GUI/Dialog.pm @@ -114,25 +114,43 @@ has 'module' => ( ); has 'factory' => ( - is => 'rw', + is => 'ro', isa => 'Maybe[yui::YWidgetFactory]', lazy => 1, init_arg => undef, default => sub { - return undef; + return yui::YUI::widgetFactory; }, ); has 'optFactory' => ( - is => 'rw', + is => 'ro', isa => 'Maybe[yui::YOptionalWidgetFactory]', lazy => 1, init_arg => undef, default => sub { - return undef; + return yui::YUI::optionalWidgetFactory; }, ); +has 'mgaExternalFactory' => ( + is => 'ro', + isa => 'Maybe[yui::YMGAWidgetFactory]', + lazy => 1, + init_arg => undef, + builder => '_MGAFactoryInitialize' +); + +sub _MGAFactoryInitialize { + my $self = shift(); + + $self->factory(); # just to be sure default factory is initialized first + + my $mageiaPlugin = "mga"; + my $mgaFactory = yui::YExternalWidgets::externalWidgetFactory($mageiaPlugin); + return yui::YMGAWidgetFactory::getYMGAWidgetFactory($mgaFactory); +} + has 'dialog' => ( is => 'rw', isa => 'Maybe[yui::YDialog]', @@ -386,9 +404,6 @@ sub call { ## set icon if not already set by external launcher yui::YUI::app()->setApplicationIcon($self->icon()); - $self->factory(yui::YUI::widgetFactory); - $self->optFactory(yui::YUI::optionalWidgetFactory); - ## required fields die "required widgets missing from YOptionalFactory" if (!$self->checkFields()); |