Add supported_filesystem() predicate method (#738471)

Helper to check whether a recognised file system type is supported by
GParted or not.  Supported means there is an implementation class and
will appear in the File System Support dialog.

Make supported_filesystem() a static member function so that it can be
called without a class object so that GParted_Core::GParted_Core()
initialiser isn't called multiple times.  This requires FILESYSTEM_MAP
to become a static member variable too.

Bug #738471 - ReFS file system is not recognised
This commit is contained in:
Mike Fleetwood 2014-10-13 13:03:47 +01:00 committed by Curtis Gedak
parent 58618572b5
commit 8b4b73a8f3
2 changed files with 11 additions and 2 deletions

View File

@ -60,7 +60,8 @@ public:
Glib::ustring get_libparted_version() ; Glib::ustring get_libparted_version() ;
Glib::ustring get_thread_status_message() ; Glib::ustring get_thread_status_message() ;
FileSystem * get_filesystem_object( FILESYSTEM filesystem ); static FileSystem * get_filesystem_object( FILESYSTEM filesystem );
static bool supported_filesystem( FILESYSTEM fstype );
static bool filesystem_resize_disallowed( const Partition & partition ) ; static bool filesystem_resize_disallowed( const Partition & partition ) ;
private: private:
//detectionstuff.. //detectionstuff..
@ -191,7 +192,7 @@ private:
static PedExceptionOption ped_exception_handler( PedException * e ) ; static PedExceptionOption ped_exception_handler( PedException * e ) ;
std::vector<FS> FILESYSTEMS ; std::vector<FS> FILESYSTEMS ;
std::map< FILESYSTEM, FileSystem * > FILESYSTEM_MAP ; static std::map< FILESYSTEM, FileSystem * > FILESYSTEM_MAP ;
std::vector<PedPartitionFlag> flags; std::vector<PedPartitionFlag> flags;
std::vector<Glib::ustring> device_paths ; std::vector<Glib::ustring> device_paths ;
bool probe_devices ; bool probe_devices ;

View File

@ -3217,6 +3217,12 @@ FileSystem * GParted_Core::get_filesystem_object( FILESYSTEM filesystem )
return NULL ; return NULL ;
} }
// Return true for file systems with an implementation class, false otherwise
bool GParted_Core::supported_filesystem( FILESYSTEM fstype )
{
return get_filesystem_object( fstype ) != NULL;
}
bool GParted_Core::filesystem_resize_disallowed( const Partition & partition ) bool GParted_Core::filesystem_resize_disallowed( const Partition & partition )
{ {
if ( partition .filesystem == FS_LVM2_PV ) if ( partition .filesystem == FS_LVM2_PV )
@ -3699,4 +3705,6 @@ GParted_Core::~GParted_Core()
Glib::Thread *GParted_Core::mainthread; Glib::Thread *GParted_Core::mainthread;
std::map< FILESYSTEM, FileSystem * > GParted_Core::FILESYSTEM_MAP;
} //GParted } //GParted