[gparted] Disable extended option for non-MSDOS and non-DVH disk types (#583906)



commit 70584176de46dc1cd5a99fc2f1d3834a1b68cba6
Author: Curtis Gedak <gedakc gmail com>
Date:   Wed Feb 24 11:39:42 2010 -0700

    Disable extended option for non-MSDOS and non-DVH disk types (#583906)
    
    According to parted documentation, only "msdos" and "dvh" disk
    types (or partition table types) support extended partitions.
    All other disk types support primary partitions only.

 include/Dialog_Partition_New.h |    5 +++--
 src/Dialog_Partition_New.cc    |   13 ++++++++++---
 src/Win_GParted.cc             |    3 ++-
 3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/include/Dialog_Partition_New.h b/include/Dialog_Partition_New.h
index ffd0dc5..d0a5934 100644
--- a/include/Dialog_Partition_New.h
+++ b/include/Dialog_Partition_New.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2004 Bart
- * Copyright (C) 2008 Curtis Gedak
+ * Copyright (C) 2008, 2009, 2010 Curtis Gedak
  *
  *  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
@@ -36,7 +36,8 @@ public:
 		       unsigned short new_count,
 		       const std::vector<FS> & FILESYSTEMS,
 		       bool only_unformatted,
-		       Sector cylinder_size );
+		       Sector cylinder_size,
+		       Glib::ustring disktype );
 	Partition Get_New_Partition() ;//overridden function
 
 private:
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index 26508a0..19bbf89 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -1,5 +1,5 @@
 /* Copyright (C) 2004 Bart
- * Copyright (C) 2008, 2009 Curtis Gedak
+ * Copyright (C) 2008, 2009, 2010 Curtis Gedak
  *
  *  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
@@ -37,7 +37,8 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
 				     unsigned short new_count, 
 				     const std::vector<FS> & FILESYSTEMS,
 				     bool only_unformatted,
-				     Sector cylinder_size )
+				     Sector cylinder_size,
+				     Glib::ustring disktype )
 {
 	this ->new_count = new_count;
 	this ->selected_partition = partition;
@@ -85,7 +86,13 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
 	menu_type .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("Extended Partition") ) ) ;
 	
 	//determine which PartitionType is allowed
-	if ( partition .inside_extended )
+	if ( disktype != "msdos" && disktype != "dvh" )
+	{
+		menu_type .items()[ 1 ] .set_sensitive( false ); 
+		menu_type .items()[ 2 ] .set_sensitive( false );
+		menu_type .set_active( 0 );
+	}
+	else if ( partition .inside_extended )
 	{
 		menu_type .items()[ 0 ] .set_sensitive( false ); 
 		menu_type .items()[ 2 ] .set_sensitive( false );
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index d13643b..69c3de2 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -1516,7 +1516,8 @@ void Win_GParted::activate_new()
 				  new_count,
 				  gparted_core .get_filesystems(),
 				  devices[ current_device ] .readonly,
-				  devices[ current_device ] .cylsize ) ;
+				  devices[ current_device ] .cylsize,
+				  devices[ current_device ] .disktype ) ;
 		
 		dialog .set_transient_for( *this );
 		



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