[gparted] Fix File System Support dialog not showing changes after rescan (!38)



commit 7ea91bca61c592423ec2d2ce508bb720b9809cec
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Wed Apr 17 20:00:11 2019 +0100

    Fix File System Support dialog not showing changes after rescan (!38)
    
    Open the File System Support dialog, either add or remove some file
    system specific commands used by GParted and press the
    [Rescan For Supported Actions] button.  The supported actions don't
    change.  However after just closing and reopening the dialog, the
    supported actions do reflect the added or removed file system specific
    commands.
    
    Bisected to this commit:
        4d6d46466478f656ce2ebb3c6b5a88cf0657667f
        Display "other" in the File System Support dialog (!13)
    
    The problem is that commit made a subset copy of the
    GParted_Core::FILESYSTEMS vector, obtained from get_filesystems(), so
    when the rescan ran and the FILESYSTEMS vector was updated with new
    supported actions, the dialog still displayed the original subset copy,
    so didn't reflect the changed supported actions.
    
    Fix by passing a reference to the GParted_Core::FILESYSTEMS vector,
    obtained from get_filesystems(), and perform the necessary filtering
    inside the dialog, like before the above faulty commit.  Additionally
    finding and adding "other" file system to the end of the list.
    
    Closes !38 - Fixes for minor issues with File System Support rescanning

 include/DialogFeatures.h |  4 ++--
 src/DialogFeatures.cc    | 22 ++++++++++++++++++----
 src/Win_GParted.cc       | 16 ++--------------
 3 files changed, 22 insertions(+), 20 deletions(-)
---
diff --git a/include/DialogFeatures.h b/include/DialogFeatures.h
index ae8a8c73..ec83fc25 100644
--- a/include/DialogFeatures.h
+++ b/include/DialogFeatures.h
@@ -36,8 +36,8 @@ public:
        DialogFeatures() ;
        ~DialogFeatures() ;
 
-       void load_filesystems( const std::vector<FS> & FILESYSTEMS ) ;
-       
+       void load_filesystems(const std::vector<FS>& fss);
+
 private:
        void show_filesystem( const FS & fs ) ;
 
diff --git a/src/DialogFeatures.cc b/src/DialogFeatures.cc
index 71ffc5fa..b168d504 100644
--- a/src/DialogFeatures.cc
+++ b/src/DialogFeatures.cc
@@ -152,13 +152,27 @@ DialogFeatures::DialogFeatures()
        show_all_children() ;
 }
 
-void DialogFeatures::load_filesystems( const std::vector<FS> & FILESYSTEMS )
+
+void DialogFeatures::load_filesystems(const std::vector<FS>& fss)
 {
        liststore_filesystems ->clear() ;
 
-       //fill the features chart with valid file systems 
-       for ( unsigned short t = 0; t < FILESYSTEMS .size() ; t++ )
-               show_filesystem( FILESYSTEMS[t] );
+       // 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))
+                       show_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)
+               {
+                       show_filesystem(fss[i]);
+                       break;
+               }
+       }
 }
                
 void DialogFeatures::show_filesystem( const FS & fs )
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index c99d2185..75c1248e 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -1682,19 +1682,7 @@ void Win_GParted::menu_gparted_features()
        DialogFeatures dialog ;
        dialog .set_transient_for( *this ) ;
 
-       // Create the list of fully supported file system action, adding "other" at the
-       // end for all the basic supported file systems, ready for showing in the dialog.
-       const std::vector<FS> fs_actions = gparted_core.get_filesystems();
-       std::vector<FS> show_fs_actions;
-       show_fs_actions.reserve( fs_actions.size() );
-       for ( unsigned i = 0 ; i < fs_actions.size() ; i ++ )
-       {
-               if ( GParted_Core::supported_filesystem( fs_actions[i].filesystem ) )
-                       show_fs_actions.push_back( fs_actions[i] );
-       }
-       show_fs_actions.push_back( gparted_core.get_fs( FS_OTHER ) );
-
-       dialog.load_filesystems( show_fs_actions );
+       dialog.load_filesystems(gparted_core.get_filesystems());
        while ( dialog .run() == Gtk::RESPONSE_OK )
        {
                // Button [Rescan For Supported Actions] pressed in the dialog.  Rescan
@@ -1702,7 +1690,7 @@ void Win_GParted::menu_gparted_features()
                // view accordingly in the dialog.
                GParted_Core::find_supported_core();
                gparted_core .find_supported_filesystems() ;
-               dialog.load_filesystems( show_fs_actions );
+               dialog.load_filesystems(gparted_core.get_filesystems());
 
                //recreate format menu...
                partitionmenu_items[MENU_FORMAT]->unset_submenu();


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