[gparted] Add supported_filesystem() predicate method (#738471)



commit 8b4b73a8f3d26f201453c2182f22ab9b0344d67a
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Mon Oct 13 13:03:47 2014 +0100

    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

 include/GParted_Core.h |    5 +++--
 src/GParted_Core.cc    |    8 ++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/include/GParted_Core.h b/include/GParted_Core.h
index afbef92..2dfa665 100644
--- a/include/GParted_Core.h
+++ b/include/GParted_Core.h
@@ -60,7 +60,8 @@ public:
        Glib::ustring get_libparted_version() ;
        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 ) ;
 private:
        //detectionstuff..
@@ -191,7 +192,7 @@ private:
        static PedExceptionOption ped_exception_handler( PedException * e ) ;
 
        std::vector<FS> FILESYSTEMS ;
-       std::map< FILESYSTEM, FileSystem * > FILESYSTEM_MAP ;
+       static std::map< FILESYSTEM, FileSystem * > FILESYSTEM_MAP ;
        std::vector<PedPartitionFlag> flags;
        std::vector<Glib::ustring> device_paths ;
        bool probe_devices ;
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 12e796e..c893a88 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -3217,6 +3217,12 @@ FileSystem * GParted_Core::get_filesystem_object( FILESYSTEM filesystem )
            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 )
 {
        if ( partition .filesystem == FS_LVM2_PV )
@@ -3699,4 +3705,6 @@ GParted_Core::~GParted_Core()
 
 Glib::Thread *GParted_Core::mainthread;
 
+std::map< FILESYSTEM, FileSystem * > GParted_Core::FILESYSTEM_MAP;
+
 } //GParted


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