[gparted] Also rename FS.filesystem member to fstype (!52)



commit 58fb230fb00290678b17bfe039826fd8dbfb6387
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Thu Jun 13 07:59:59 2019 +0100

    Also rename FS.filesystem member to fstype (!52)
    
    Closes !52 - Rename members and variables currently named 'filesystem'

 include/FileSystem.h               |  4 ++--
 src/DialogFeatures.cc              |  9 +++++----
 src/Dialog_Partition_Copy.cc       |  2 +-
 src/Dialog_Partition_New.cc        | 32 ++++++++++++++++----------------
 src/SupportedFileSystems.cc        |  2 +-
 src/Win_GParted.cc                 |  6 +++---
 src/fat16.cc                       |  2 +-
 tests/test_SupportedFileSystems.cc |  4 ++--
 8 files changed, 31 insertions(+), 30 deletions(-)
---
diff --git a/include/FileSystem.h b/include/FileSystem.h
index a010f5a3..403d84cb 100644
--- a/include/FileSystem.h
+++ b/include/FileSystem.h
@@ -61,7 +61,7 @@ struct FS
                EXTERNAL  = 3
        };
 
-       FSType filesystem;
+       FSType fstype;
        Support busy;               // How to determine if partition/file system is busy
        Support read;               // Can and how to read sector usage while inactive
        Support read_label;
@@ -80,7 +80,7 @@ struct FS
        Support online_grow;
        Support online_shrink;
 
-       FS( FSType fstype = FS_UNSUPPORTED ) : filesystem( fstype )
+       FS(FSType fstype_ = FS_UNSUPPORTED) : fstype(fstype_)
        {
                busy = read = read_label = write_label = read_uuid = write_uuid = create =
                create_with_label = grow = shrink = move = check = copy = remove = online_read =
diff --git a/src/DialogFeatures.cc b/src/DialogFeatures.cc
index 94c431a4..0a303e89 100644
--- a/src/DialogFeatures.cc
+++ b/src/DialogFeatures.cc
@@ -170,14 +170,14 @@ void DialogFeatures::load_filesystems(const std::vector<FS>& fss)
        // Fill the features chart with fully supported file systems.
        for (unsigned i = 0; i < fss.size(); i++)
        {
-               if (GParted_Core::supported_filesystem(fss[i].filesystem))
+               if (GParted_Core::supported_filesystem(fss[i].fstype))
                        load_one_filesystem(fss[i]);
        }
 
        // Find and add "other" at the end, for all the basic supported file systems.
        for (unsigned i = 0; i < fss.size(); i++)
        {
-               if (fss[i].filesystem == FS_OTHER)
+               if (fss[i].fstype == FS_OTHER)
                {
                        load_one_filesystem(fss[i]);
                        break;
@@ -189,7 +189,7 @@ void DialogFeatures::load_filesystems(const std::vector<FS>& fss)
 void DialogFeatures::load_one_filesystem(const FS& fs)
 {
        treerow = *( liststore_filesystems ->append() );
-       treerow[ treeview_filesystems_columns .filesystem ] = Utils::get_filesystem_string( fs .filesystem ) ;
+       treerow[treeview_filesystems_columns.filesystem] = Utils::get_filesystem_string(fs.fstype);
 
        treerow[ treeview_filesystems_columns .create ] = fs .create ? icon_yes : icon_no ; 
        treerow[ treeview_filesystems_columns .grow ] = fs .grow ? icon_yes : icon_no ; 
@@ -202,9 +202,10 @@ void DialogFeatures::load_one_filesystem(const FS& fs)
        treerow[ treeview_filesystems_columns .label ] = fs .write_label ? icon_yes : icon_no ; 
        treerow[ treeview_filesystems_columns .uuid ] = fs .write_uuid ? icon_yes : icon_no ;
 
-       treerow[ treeview_filesystems_columns .software ] = Utils::get_filesystem_software( fs .filesystem ) ;
+       treerow[treeview_filesystems_columns.software] = Utils::get_filesystem_software(fs.fstype);
 }
 
+
 DialogFeatures::~DialogFeatures() 
 {
 }
diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc
index 39e068c8..d04df622 100644
--- a/src/Dialog_Partition_Copy.cc
+++ b/src/Dialog_Partition_Copy.cc
@@ -88,7 +88,7 @@ void Dialog_Partition_Copy::set_data( const Partition & selected_partition, cons
                fs_limits.max_size = copied_partition.get_byte_length();
        }
 
-       if (fs.filesystem == FS_XFS)  // Bit hackish, but most effective, since it's a unique situation.
+       if (fs.fstype == FS_XFS)  // Bit hackish, but most effective, since it's a unique situation.
                fs_limits.min_size = std::max( fs_limits.min_size, min_resize * copied_partition.sector_size 
);
        else
                fs_limits.min_size = COPIED_LENGTH_MB * MEBIBYTE;
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index beff15f0..873124b9 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -72,26 +72,26 @@ void Dialog_Partition_New::set_data( const Device & device,
        this->FILESYSTEMS.clear();
        for ( unsigned i = 0 ; i < FILESYSTEMS.size() ; i ++ )
        {
-               if ( GParted_Core::supported_filesystem( FILESYSTEMS[i].filesystem ) &&
-                    FILESYSTEMS[i].filesystem != FS_LUKS                               )
+               if (GParted_Core::supported_filesystem(FILESYSTEMS[i].fstype) &&
+                   FILESYSTEMS[i].fstype != FS_LUKS                            )
                        this->FILESYSTEMS.push_back( FILESYSTEMS[i] );
        }
 
        FS fs_tmp ;
        //... add FS_CLEARED
-       fs_tmp .filesystem = FS_CLEARED ;
+       fs_tmp.fstype = FS_CLEARED;
        fs_tmp .create = FS::GPARTED ;
        this ->FILESYSTEMS .push_back( fs_tmp ) ;
 
        //... add FS_UNFORMATTED
-       fs_tmp.filesystem = FS_UNFORMATTED;
+       fs_tmp.fstype = FS_UNFORMATTED;
        fs_tmp .create = FS::GPARTED ;
        this ->FILESYSTEMS .push_back( fs_tmp ) ;
 
        // ... finally add FS_EXTENDED.  Needed so that when creating an extended
        // partition it is identified correctly before the operation is applied.
        fs_tmp = FS();
-       fs_tmp.filesystem = FS_EXTENDED;
+       fs_tmp.fstype = FS_EXTENDED;
        fs_tmp.create = FS::NONE;
        this ->FILESYSTEMS .push_back( fs_tmp ) ;
 
@@ -244,7 +244,7 @@ const Partition & Dialog_Partition_New::Get_New_Partition()
        new_partition->Set( device_path,
                            Glib::ustring::compose( _("New Partition #%1"), new_count ),
                            new_count, part_type,
-                           FILESYSTEMS[combo_filesystem.get_active_row_number()].filesystem,
+                           FILESYSTEMS[combo_filesystem.get_active_row_number()].fstype,
                            new_start, new_end,
                            sector_size,
                            inside_extended, false );
@@ -352,7 +352,7 @@ void Dialog_Partition_New::combobox_changed(bool type)
        if ( ! type )
        {
                fs = FILESYSTEMS[combo_filesystem.get_active_row_number()];
-               fs_limits = GParted_Core::get_filesystem_limits( fs.filesystem, *new_partition );
+               fs_limits = GParted_Core::get_filesystem_limits(fs.fstype, *new_partition);
 
                if ( fs_limits.min_size < MEBIBYTE )
                        fs_limits.min_size = MEBIBYTE;
@@ -389,12 +389,12 @@ void Dialog_Partition_New::combobox_changed(bool type)
                frame_resizer_base->override_default_rgb_unused_color(color_temp);
 
                //Partition color
-               color_temp.set(Utils::get_color(fs.filesystem));
+               color_temp.set(Utils::get_color(fs.fstype));
                frame_resizer_base->set_rgb_partition_color(color_temp);
        }
 
        // Maximum length of the file system label varies according to the selected file system type.
-       filesystem_label_entry.set_max_length( Utils::get_filesystem_label_maxlength( fs.filesystem ) );
+       filesystem_label_entry.set_max_length(Utils::get_filesystem_label_maxlength(fs.fstype));
 
        frame_resizer_base->redraw();
 }
@@ -410,18 +410,18 @@ void Dialog_Partition_New::build_filesystems_combo(bool only_unformatted)
        for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) ; t++ ) 
        {
                //skip extended
-               if (FILESYSTEMS[t].filesystem == FS_EXTENDED)
+               if (FILESYSTEMS[t].fstype == FS_EXTENDED)
                        continue ;
-               combo_filesystem.items().push_back(Utils::get_filesystem_string(FILESYSTEMS[t].filesystem));
+               combo_filesystem.items().push_back(Utils::get_filesystem_string(FILESYSTEMS[t].fstype));
                combo_filesystem.items().back().set_sensitive(
                        ! only_unformatted && FILESYSTEMS[ t ] .create &&
-                       new_partition->get_byte_length() >= get_filesystem_min_limit( 
FILESYSTEMS[t].filesystem ) );
+                       new_partition->get_byte_length() >= get_filesystem_min_limit(FILESYSTEMS[t].fstype));
                //use ext4/3/2 as first/second/third choice default file system
                //(Depends on ordering in FILESYSTEMS for preference)
-               if ( ( FILESYSTEMS[ t ] .filesystem == FS_EXT2 ||
-                      FILESYSTEMS[ t ] .filesystem == FS_EXT3 ||
-                      FILESYSTEMS[ t ] .filesystem == FS_EXT4    ) &&
-                    combo_filesystem.items().back().sensitive()       )
+               if ((FILESYSTEMS[t].fstype == FS_EXT2 ||
+                    FILESYSTEMS[t].fstype == FS_EXT3 ||
+                    FILESYSTEMS[t].fstype == FS_EXT4   )      &&
+                   combo_filesystem.items().back().sensitive()  )
                {
                        first_creatable_fs = combo_filesystem.items().size() - 1;
                        set_first=true;
diff --git a/src/SupportedFileSystems.cc b/src/SupportedFileSystems.cc
index 80b28e02..2ea7b21a 100644
--- a/src/SupportedFileSystems.cc
+++ b/src/SupportedFileSystems.cc
@@ -149,7 +149,7 @@ const FS& SupportedFileSystems::get_fs_support(FSType fstype) const
 {
        for (unsigned int i = 0; i < m_fs_support.size(); i++)
        {
-               if (m_fs_support[i].filesystem == fstype)
+               if (m_fs_support[i].fstype == fstype)
                        return m_fs_support[i];
        }
 
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 159afcb4..649b84ba 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -534,9 +534,9 @@ Gtk::Menu * Win_GParted::create_format_menu()
 
        for ( unsigned int t = 0 ; t < fss .size() ; t++ )
        {
-               if ( GParted_Core::supported_filesystem( fss[t].filesystem ) &&
-                    fss[t].filesystem != FS_LUKS                               )
-                       create_format_menu_add_item( fss[t].filesystem, fss[t].create );
+               if (GParted_Core::supported_filesystem(fss[t].fstype) &&
+                   fss[t].fstype != FS_LUKS                            )
+                       create_format_menu_add_item(fss[t].fstype, fss[t].create);
        }
        //Add cleared at the end of the list
        create_format_menu_add_item( FS_CLEARED, true ) ;
diff --git a/src/fat16.cc b/src/fat16.cc
index 8cda7f16..5825c9d8 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -107,7 +107,7 @@ FS fat16::get_filesystem_support()
        fs.copy = FS::GPARTED;
        fs .online_read = FS::GPARTED ;
 
-       if ( fs .filesystem == FS_FAT16 )
+       if (fs.fstype == FS_FAT16)
        {
                fs_limits.min_size = 16 * MEBIBYTE;
                fs_limits.max_size = (4096 - 1) * MEBIBYTE;  // Maximum seems to be just less than 4096 MiB.
diff --git a/tests/test_SupportedFileSystems.cc b/tests/test_SupportedFileSystems.cc
index c80050fd..99fc66bd 100644
--- a/tests/test_SupportedFileSystems.cc
+++ b/tests/test_SupportedFileSystems.cc
@@ -346,8 +346,8 @@ std::vector<FSType> SupportedFileSystemsTest::get_supported_fstypes()
        const std::vector<FS>& fss = s_supported_filesystems->get_all_fs_support();
        for (unsigned int i = 0; i < fss.size(); i++)
        {
-               if (s_supported_filesystems->supported_filesystem(fss[i].filesystem))
-                       v.push_back(fss[i].filesystem);
+               if (s_supported_filesystems->supported_filesystem(fss[i].fstype))
+                       v.push_back(fss[i].fstype);
        }
        return v;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]