[gparted] Query and pass struct FS_Limits into Dialog_Partition_Copy (#787204)



commit 285c24a82a783b6173971c62fa1323d1a469958b
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri Jan 12 10:56:53 2018 +0000

    Query and pass struct FS_Limits into Dialog_Partition_Copy (#787204)
    
    Refactor Win_GParted::activate_paste() to query the file system size
    limits using the new get_filesystem_limits() method and pass those
    limits into the the dialog class as struct FS_Limits.
    
    Bug 787204 - Minimum and maximum size of the UDF partition/disk

 include/Dialog_Partition_Copy.h |    4 +++-
 src/Dialog_Partition_Copy.cc    |    5 +++--
 src/Win_GParted.cc              |    8 ++++++++
 3 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/include/Dialog_Partition_Copy.h b/include/Dialog_Partition_Copy.h
index 31030f0..03e2048 100644
--- a/include/Dialog_Partition_Copy.h
+++ b/include/Dialog_Partition_Copy.h
@@ -20,6 +20,7 @@
 
 #include "Dialog_Base_Partition.h"
 #include "Partition.h"
+#include "Utils.h"
 
 namespace GParted
 {
@@ -27,7 +28,8 @@ namespace GParted
 class Dialog_Partition_Copy : public Dialog_Base_Partition
 {
 public:
-       Dialog_Partition_Copy( const FS & fs, const Partition & selected_partition,
+       Dialog_Partition_Copy( const FS & fs, const FS_Limits & fs_limits,
+                              const Partition & selected_partition,
                               const Partition & copied_partition );
        ~Dialog_Partition_Copy();
 
diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc
index ee59961..eddc2c6 100644
--- a/src/Dialog_Partition_Copy.cc
+++ b/src/Dialog_Partition_Copy.cc
@@ -23,11 +23,12 @@
 namespace GParted
 {
 
-Dialog_Partition_Copy::Dialog_Partition_Copy( const FS & fs, const Partition & selected_partition,
+Dialog_Partition_Copy::Dialog_Partition_Copy( const FS & fs, const FS_Limits & fs_limits,
+                                              const Partition & selected_partition,
                                               const Partition & copied_partition )
 {
        this ->fs = fs ;
-       fs_limits = FS_Limits( fs.MIN, fs.MAX );
+       this->fs_limits = fs_limits;
 
        Set_Resizer( false ) ;  
        Set_Confirm_Button( PASTE ) ;
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index bac0e17..1f66c2f 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -40,6 +40,7 @@
 #include "Partition.h"
 #include "PartitionVector.h"
 #include "LVM2_PV_Info.h"
+#include "Utils.h"
 #include "../config.h"
 
 #include <gtkmm/aboutdialog.h>
@@ -1933,6 +1934,12 @@ void Win_GParted::activate_paste()
        {
                if ( ! max_amount_prim_reached() )
                {
+                       const FileSystem *filesystem_object = gparted_core.get_filesystem_object(
+                                                                             
copied_filesystem_ptn.filesystem );
+                       FS_Limits fs_limits;
+                       if ( filesystem_object != NULL )
+                               fs_limits = filesystem_object->get_filesystem_limits();
+
                        // We don't want the messages, mount points or name of the source
                        // partition for the new partition being created.
                        Partition * part_temp = copied_filesystem_ptn.clone();
@@ -1941,6 +1948,7 @@ void Win_GParted::activate_paste()
                        part_temp->name.clear();
 
                        Dialog_Partition_Copy dialog( gparted_core.get_fs( copied_filesystem_ptn.filesystem ),
+                                                     fs_limits,
                                                      *selected_partition_ptr,
                                                      *part_temp );
                        delete part_temp;


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