From ef4d052aecde0c2d76f962c597380576fdec4a8c Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Tue, 24 Apr 2012 21:58:30 +0000 Subject: reuse code from hd_gtk, fixes display of "Use free space" solution --- perl-install/diskdrake/hd_gtk.pm | 24 +++++++++++++++++------- perl-install/fs/partitioning_wizard.pm | 5 ++--- perl-install/install/NEWS | 1 + 3 files changed, 20 insertions(+), 10 deletions(-) (limited to 'perl-install') diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index 3ccc84d12..8b205df29 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -250,13 +250,8 @@ sub current_kind_changed { my ($_in, $kind) = @_; $_->destroy foreach $kind->{display_box}->get_children; - - my $v = $kind->{val}; - my @parts = - $kind->{type} eq 'raid' ? grep { $_ } @$v : - $kind->{type} eq 'loopback' ? @$v : fs::get::hds_fstab_and_holes($v); - my $totalsectors = - $kind->{type} =~ /raid|loopback/ ? sum(map { $_->{size} } @parts) : $v->{totalsectors}; + my @parts = kind2parts($kind); + my $totalsectors = kind2sectors($kind, @parts); create_buttons4partitions($kind, $totalsectors, @parts); } @@ -433,6 +428,21 @@ sub createOrChangeType { } } +sub kind2parts { + my ($kind) = @_; + my $v = $kind->{val}; + my @parts = + $kind->{type} eq 'raid' ? grep { $_ } @$v : + $kind->{type} eq 'loopback' ? @$v : fs::get::hds_fstab_and_holes($v); + @parts; +} + +sub kind2sectors { + my ($kind, @parts) = @_; + my $v = $kind->{val}; + $kind->{type} =~ /raid|loopback/ ? sum(map { $_->{size} } @parts) : $v->{totalsectors}; +} + ################################################################################ # lvms: helpers ################################################################################ diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm index 7712301c3..58acbf54d 100644 --- a/perl-install/fs/partitioning_wizard.pm +++ b/perl-install/fs/partitioning_wizard.pm @@ -287,10 +287,9 @@ sub warn_reboot_needed { sub create_display_box { my ($kind, $resize, $fill_empty, $button) = @_; - # perl_checker: require UNIVERSAL - my @parts = fs::get::hds_fstab_and_holes($kind->{val}) if UNIVERSAL::can($kind->{val}, 'first_usable_sector,'); - my $totalsectors = $kind->{val}{totalsectors}; + my @parts = diskdrake::hd_gtk::kind2parts($kind); + my $totalsectors = diskdrake::hd_gtk::kind2sectors($kind, @parts); my $width = 540; my $minwidth = 40; diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 0263453f3..66b06878f 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -7,6 +7,7 @@ o systemd support (mga#3253, mga#3740, mga#4910, mga#5122) - partitioning wizard: o fix removing several notebook pages + o reuse code from hd_gtk, fixes display of "Use free space" solution Version 14.10 - 23 April 2012 -- cgit v1.2.1