[gparted] Skip move action because linux-swap contains no data (#589555)



commit 232800d6cdd811390e4d901d127cf478b7d1999b
Author: Curtis Gedak <gedakc gmail com>
Date:   Tue Oct 19 13:43:42 2010 -0600

    Skip move action because linux-swap contains no data (#589555)
    
    Closes bug #589555 - Moving a swap partition needlessly copies
                         all "data" on it

 src/GParted_Core.cc |    5 +++++
 src/linux_swap.cc   |   14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index f5e5bf2..b900e73 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1860,6 +1860,11 @@ bool GParted_Core::move_filesystem( const Partition & partition_old,
 								  	 operationdetail .get_last_child() ) ;
 			break ;
 		case GParted::FS::EXTERNAL:
+			succes = set_proper_filesystem( partition_new .filesystem ) &&
+			         p_filesystem ->move( partition_old
+			                            , partition_new
+			                            , operationdetail .get_last_child()
+			                            ) ;
 			break ;
 	}
 
diff --git a/src/linux_swap.cc b/src/linux_swap.cc
index d604684..3b0d292 100644
--- a/src/linux_swap.cc
+++ b/src/linux_swap.cc
@@ -41,7 +41,7 @@ FS linux_swap::get_filesystem_support()
 		fs .write_label = FS::EXTERNAL ;
 
 	fs .copy = GParted::FS::EXTERNAL ;
-	fs .move = GParted::FS::GPARTED ;
+	fs .move = GParted::FS::EXTERNAL ;
 	
 	return fs ;
 }
@@ -98,6 +98,18 @@ bool linux_swap::move( const Partition & partition_new
                      , OperationDetail & operationdetail
                      )
 {
+	//Since linux-swap does not contain data, do not actually move the partition
+	operationdetail .add_child(
+	    OperationDetail(
+	                     /* TO TRANSLATORS: looks like   Partition move action skipped because linux-swap file system does not contain data */
+	                     String::ucompose( _("Partition move action skipped because %1 file system does not contain data")
+	                                     , Utils::get_filesystem_string( FS_LINUX_SWAP )
+	                                     )
+	                   , STATUS_NONE
+	                   , FONT_ITALIC
+	                   )
+	                          ) ;
+
 	return true ;
 }
 



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