diff options
author | Maarten Vanraes <alien@mageia.org> | 2016-05-10 19:08:03 +0200 |
---|---|---|
committer | Maarten Vanraes <alien@mageia.org> | 2016-05-14 09:25:25 +0200 |
commit | aec9c7f4bd4f3e4b6e54ab34ced613f5becfa674 (patch) | |
tree | e6ccdf86364f6e99cd81404ca8ce2eb2644467f1 /lib | |
parent | 711d8e99e724adefa0d8cd0079e2b371c8accf2d (diff) | |
download | manatools-aec9c7f4bd4f3e4b6e54ab34ced613f5becfa674.tar manatools-aec9c7f4bd4f3e4b6e54ab34ced613f5becfa674.tar.gz manatools-aec9c7f4bd4f3e4b6e54ab34ced613f5becfa674.tar.bz2 manatools-aec9c7f4bd4f3e4b6e54ab34ced613f5becfa674.tar.xz manatools-aec9c7f4bd4f3e4b6e54ab34ced613f5becfa674.zip |
selectItem helper attribute
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ManaTools/Module/Disk.pm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/ManaTools/Module/Disk.pm b/lib/ManaTools/Module/Disk.pm index 396fdbec..300696c6 100644 --- a/lib/ManaTools/Module/Disk.pm +++ b/lib/ManaTools/Module/Disk.pm @@ -180,6 +180,15 @@ has ioProperties => ( }, ); +has selectedItem => ( + is => 'rw', + isa => 'Maybe[ManaTools::Shared::disk_backend::IO]', + default => undef, + init_arg => undef, +); + +around 'selectedItem' => \&_selectedItem; + sub _SharedGUIInitialize { my $self = shift; @@ -218,6 +227,38 @@ sub start { $self->_adminDiskPanel(); } +sub _selectItem { + my $orig = shift; + my $self = shift; + my $old = $self->$orig(); + + return $old unless @_; + + my $new = shift; + my @parts = $new->findin(); + while (scalar(@parts) > 0) { + } + # if $new has children, get the first one instead + # if $new is an ancestor of $old, we're not gonna change it + return $self->$orig($new); +}; + +sub _showSelectedItem { + my $self = shift; + my $module = $self->module(); + my $io = $self->selectedItem(); + my $ioProperties = $module->ioProperties(); + $ioProperties->properties($io); + + my $propbox = $module->propertiesBox(); + # properties + # parent properties + + my $actionbox = $module->actionsBox(); + # actions + # parent actions +} + sub _rebuildTab { my $self = shift; my $eventHandler = shift; |