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:
    4d6d464664
    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
This commit is contained in:
Mike Fleetwood 2019-04-17 20:00:11 +01:00
parent 1b17264603
commit 7ea91bca61
3 changed files with 22 additions and 20 deletions

View file

@ -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 ) ;

View file

@ -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 )

View file

@ -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();