[gparted] Display "other" in the File System Support dialog (!13)



commit 4d6d46466478f656ce2ebb3c6b5a88cf0657667f
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Sep 8 11:44:45 2018 +0100

    Display "other" in the File System Support dialog (!13)
    
    To display the supported actions for all basic supported file systems to
    the users.
    
    Prepare the list of file system actions in Win_GParted because calling
    get_fs() for the "other" actions requires the gparted_core object and
    load_filesystems() currently doesn't have access to it.  One alternative
    would have been to make get_fs() and FILESYSTEMS static members of
    GParted_Core class.  Another alternative would have been to pass the
    gparted_core object to load_filesystems().  The chosen way seemed
    simplest.
    
    Closes !13 - Support copying and moving of unsupported partition content

 src/DialogFeatures.cc |  5 +----
 src/Win_GParted.cc    | 18 +++++++++++++++---
 2 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/DialogFeatures.cc b/src/DialogFeatures.cc
index a162647d..289fa287 100644
--- a/src/DialogFeatures.cc
+++ b/src/DialogFeatures.cc
@@ -156,10 +156,7 @@ void DialogFeatures::load_filesystems( const std::vector<FS> & FILESYSTEMS )
 
        //fill the features chart with valid file systems 
        for ( unsigned short t = 0; t < FILESYSTEMS .size() ; t++ )
-       {
-               if ( GParted_Core::supported_filesystem( FILESYSTEMS[t].filesystem ) )
-                       show_filesystem( FILESYSTEMS[t] );
-       }
+               show_filesystem( FILESYSTEMS[t] );
 }
                
 void DialogFeatures::show_filesystem( const FS & fs )
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index dec3ef98..3ac1aac7 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -1558,8 +1558,20 @@ void Win_GParted::menu_gparted_features()
 {
        DialogFeatures dialog ;
        dialog .set_transient_for( *this ) ;
-       
-       dialog .load_filesystems( gparted_core .get_filesystems() ) ;
+
+       // 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 );
        while ( dialog .run() == Gtk::RESPONSE_OK )
        {
                // Button [Rescan For Supported Actions] pressed in the dialog.  Rescan
@@ -1567,7 +1579,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( gparted_core .get_filesystems() ) ;
+               dialog.load_filesystems( show_fs_actions );
 
                //recreate format menu...
                menu_partition .items()[ MENU_FORMAT ] .remove_submenu() ;


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