gparted r1070 - in trunk: . src



Author: gedakc
Date: Mon Feb 16 19:53:43 2009
New Revision: 1070
URL: http://svn.gnome.org/viewvc/gparted?rev=1070&view=rev

Log:
Enhanced move/resize functionality - Only move start sector if dialog space before value is changed.

Modified:
   trunk/ChangeLog
   trunk/src/Dialog_Base_Partition.cc
   trunk/src/GParted_Core.cc

Modified: trunk/src/Dialog_Base_Partition.cc
==============================================================================
--- trunk/src/Dialog_Base_Partition.cc	(original)
+++ trunk/src/Dialog_Base_Partition.cc	Mon Feb 16 19:53:43 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
+/* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Bart Hakvoort
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -152,6 +152,10 @@
 	//set indicator of whether to use strict sector values, or to round to cylinders
 	selected_partition .strict = ! checkbutton_round_to_cylinders .get_active() ;
 
+	//if the original before value has not changed, then set indicator to keep start sector unchanged
+	if ( ORIG_BEFORE == spinbutton_before .get_value_as_int() )
+		selected_partition .strict_start = TRUE ;
+
 	return selected_partition ;
 }
 

Modified: trunk/src/GParted_Core.cc
==============================================================================
--- trunk/src/GParted_Core.cc	(original)
+++ trunk/src/GParted_Core.cc	Mon Feb 16 19:53:43 2009
@@ -314,7 +314,7 @@
 		} else {
 			diff = partition .sector_start % device .cylsize ;
 		}
-		if ( diff )
+		if ( diff && ! partition .strict_start  )
 		{
 			if ( diff < ( device .cylsize / 2 ) )
 				partition .sector_start -= diff ;
@@ -1242,7 +1242,10 @@
 			  	Partition & partition_new,
 			  	OperationDetail & operationdetail ) 
 {
-	if ( partition_new .strict || calculate_exact_geom( partition_old, partition_new, operationdetail ) )
+	if (   partition_new .strict
+		|| partition_new .strict_start
+		|| calculate_exact_geom( partition_old, partition_new, operationdetail )
+	   )
 	{
 		if ( partition_old .type == TYPE_EXTENDED )
 			return resize_move_partition( partition_old, partition_new, operationdetail ) ;
@@ -1299,8 +1302,8 @@
 		//(maybe i should do some reading on how non-msdos disklabels deal with metadata....)
 		if ( partition_new .sector_start < partition_old .sector_start )
 		{
-	       		if ( resize_move_partition( partition_old, partition_new, operationdetail ) )
-	       	   	{
+			if ( resize_move_partition( partition_old, partition_new, operationdetail ) )
+			{
 				if ( ! move_filesystem( partition_old, partition_new, operationdetail ) )
 				{
 					operationdetail .add_child( OperationDetail( _("rollback last change to the partition table") ) ) ;
@@ -1315,13 +1318,13 @@
 			}
 		}
 		else
-	       		succes = move_filesystem( partition_old, partition_new, operationdetail ) &&
-	       			 resize_move_partition( partition_old, partition_new, operationdetail ) ;
+			succes = move_filesystem( partition_old, partition_new, operationdetail ) &&
+				resize_move_partition( partition_old, partition_new, operationdetail ) ;
 
 		succes = succes &&
-			 update_bootsector( partition_new, operationdetail ) &&
-	       		 check_repair_filesystem( partition_new, operationdetail ) &&
-	       		 maximize_filesystem( partition_new, operationdetail ) ;
+			update_bootsector( partition_new, operationdetail ) &&
+			check_repair_filesystem( partition_new, operationdetail ) &&
+			maximize_filesystem( partition_new, operationdetail ) ;
 	}
 
 	return succes ;
@@ -1581,10 +1584,14 @@
 		
 		if ( lp_partition )
 		{
-			PedGeometry *geom = ped_geometry_new( lp_device,
-							      partition_new .sector_start,
-							      partition_new .get_length() ) ;
-			constraint = ped_constraint_exact( geom ) ;
+			if ( partition_new .strict || partition_new .strict_start ) {
+				PedGeometry *geom = ped_geometry_new( lp_device,
+									  partition_new .sector_start,
+									  partition_new .get_length() ) ;
+				constraint = ped_constraint_exact( geom ) ;
+			}
+			else
+				constraint = ped_constraint_any( lp_device ) ;
 
 			if ( constraint )
 			{



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