diff options
Diffstat (limited to 'perl-install/diskdrake/hd_gtk.pm')
| -rw-r--r-- | perl-install/diskdrake/hd_gtk.pm | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index 8ec9e80be..a9ebdc769 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -5,8 +5,8 @@ use strict; use common; use ugtk2 qw(:helpers :wrappers :create); -use partition_table qw(:types); -use partition_table::raw; +use partition_table; +use fs::type; use detect_devices; use diskdrake::interactive; use run_program; @@ -16,7 +16,6 @@ use raid; use any; use log; use fsedit; -use fs; my ($width, $height, $minwidth) = (400, 50, 5); my ($all_hds, $in, $do_force_reload, $current_kind, $current_entry, $update_all); @@ -76,7 +75,7 @@ sub main { $update_all = sub { $lock and return; $lock = 1; - partition_table::assign_device_numbers($_) foreach fsedit::all_hds($all_hds); + partition_table::assign_device_numbers($_) foreach fs::get::hds($all_hds); create_automatic_notebooks($notebook_widget); general_action_box($general_action_box, $nowizard, $interactive_help); per_kind_action_box($per_kind_action_box, $current_kind); @@ -217,7 +216,7 @@ sub current_kind_changed { my $v = $kind->{val}; my @parts = $kind->{type} eq 'raid' ? grep { $_ } @$v : - $kind->{type} eq 'loopback' ? @$v : fsedit::get_fstab_and_holes($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}; create_buttons4partitions($kind, $totalsectors, @parts); @@ -245,7 +244,7 @@ sub create_automatic_notebooks { }; $may_add->(hd2kind($_)) foreach @{$all_hds->{hds}}; $may_add->(lvm2kind($_)) foreach @{$all_hds->{lvms}}; - $may_add->(raid2kind()) if any { $_ } @{$all_hds->{raids}}; + $may_add->(raid2kind()) if @{$all_hds->{raids}}; $may_add->(loopback2kind()) if @{$all_hds->{loopbacks}}; @notebook = grep_index { @@ -292,7 +291,7 @@ sub create_buttons4partitions { last; } }); - $w->set_name("PART_" . pt_type2name($entry->{pt_type})); + $w->set_name("PART_" . fs::type::part2type_name($entry)); $w->set_size_request($entry->{size} * $ratio + $minwidth, 0); gtkpack__($kind->{display_box}, $w); $w->grab_focus if $current_entry && fsedit::are_same_partitions($current_entry, $entry); @@ -325,12 +324,12 @@ sub hd2kind { sub filesystems_button_box() { my @types = (N_("Ext2"), N_("Journalised FS"), N_("Swap"), arch() =~ /sparc/ ? N_("SunOS") : arch() eq "ppc" ? N_("HFS") : N_("Windows"), N_("Other"), N_("Empty")); - my %name2pt_type = (Ext2 => 0x83, 'Journalised FS' => 0x483, Swap => 0x82, Other => 1, "Windows" => 0xb, HFS => 0x402); + my %name2fs_type = (Ext2 => 'ext2', 'Journalised FS' => 'ext3', Swap => 'swap', Other => 'other', "Windows" => 'vfat', HFS => 'hfs'); gtkpack(Gtk2::HBox->new(0,0), N("Filesystem types:"), map { my $w = Gtk2::Button->new(translate($_)); - my $t = $name2pt_type{$_}; + my $t = $name2fs_type{$_}; $w->signal_connect(clicked => sub { try_('', \&createOrChangeType, $t, current_hd(), current_part()) }); $w->can_focus(0); $w->set_name($_); @@ -339,20 +338,20 @@ sub filesystems_button_box() { } sub createOrChangeType { - my ($in, $pt_type, $hd, $part, $all_hds) = @_; + my ($in, $fs_type, $hd, $part, $all_hds) = @_; - $part ||= !fsedit::get_fstab($hd) && + $part ||= !fs::get::hds_fstab($hd) && { pt_type => 0, start => 1, size => $hd->{totalsectors} - 1 }; $part or return; - if ($pt_type == 1) { + if ($fs_type eq 'other') { $in->ask_warn('', N("Use ``%s'' instead", $part->{pt_type} ? N("Type") : N("Create"))); - } elsif (!$pt_type) { + } elsif (!$fs_type) { $in->ask_warn('', N("Use ``%s'' instead", N("Delete"))) if $part->{pt_type}; } elsif ($part->{pt_type}) { - return if $pt_type == $part->{pt_type}; + return if $fs_type eq $part->{fs_type}; $in->ask_warn('', isBusy($part) ? N("Use ``Unmount'' first") : N("Use ``%s'' instead", N("Type"))); } else { - $part->{pt_type} = $pt_type; + fs::type::set_fs_type($part, $fs_type); diskdrake::interactive::Create($in, $hd, $part, $all_hds); } } |
