From 0306ad0100b9d40606d723706f909438a27dfac1 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 27 Jul 2004 10:31:34 +0000 Subject: - add field {fs_type} partially replacing {pt_type} {pt_type} is always a number, {fs_type} is always a string - introduce set_isFormatted() (to ensure {notFormatted} but also {fs_type_from_magic} and {bad_fs_type_magic} are updated) - don't use 0x483 for ext3 anymore (same for reiserfs...), the type_name gives both a pt_type and a fs_type - many accessors from partition_table removed (type2fs(), fs2pt_type()) - remove isThisFs() (not useful anymore since we can use directly {fs_type}) - remove isFat() (inline the function) - other isXXX() from partition_table are moved to fs::type - part2name() is now fs::type::part2type_name - name2pt_type() is now fs::type::type_name2subpart() - partition_table::important_types() is now fs::type::type_names() - fsedit::typeOfPart() is now fs::type::fs_type_from_magic() - no need to truncate type_name since they are shorter --- perl-install/diskdrake/hd_gtk.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'perl-install/diskdrake/hd_gtk.pm') diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index 8479c3f3e..8aff39d06 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; @@ -292,7 +292,7 @@ sub create_buttons4partitions { last; } }); - $w->set_name("PART_" . part2name($entry)); + $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 +325,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 +339,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) && { 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); } } -- cgit v1.2.1