Fixed a bunch of issues with min. and max. sizes of filesystems.

* Fixed a bunch of issues with min. and max. sizes of filesystems.
This commit is contained in:
Bart Hakvoort 2004-12-10 20:42:23 +00:00
parent f34442bee7
commit a42a0c2fee
7 changed files with 33 additions and 10 deletions

View File

@ -1,3 +1,7 @@
2004-12-09 Bart Hakvoort <gparted@users.sf.net>
* Fixed a bunch of issues with min. and max. sizes of filesystems.
2004-12-10 Gil Osher <dolfin@rpg.org.il> 2004-12-10 Gil Osher <dolfin@rpg.org.il>
* configure.in: Added 'he' (Hebrew) to ALL_LINGUAS. * configure.in: Added 'he' (Hebrew) to ALL_LINGUAS.

View File

@ -30,7 +30,7 @@ class Dialog_Partition_New : public Dialog_Base_Partition
{ {
public: public:
Dialog_Partition_New() ; Dialog_Partition_New() ;
void Set_Data( const Partition & partition, bool any_extended, unsigned short new_count, const std::vector <FS> & FILESYSTEMS, bool only_unformatted ); void Set_Data( const Partition & partition, bool any_extended, unsigned short new_count, const std::vector <FS> & FILESYSTEMS, bool only_unformatted, int cylinder_size );
Partition Get_New_Partition() ;//overridden function Partition Get_New_Partition() ;//overridden function
private: private:
@ -41,6 +41,7 @@ private:
Gtk::Menu menu_type, menu_filesystem; Gtk::Menu menu_type, menu_filesystem;
std::vector<FS> FILESYSTEMS ; std::vector<FS> FILESYSTEMS ;
int cylinder_size ;
//signal handlers //signal handlers
void optionmenu_changed( bool ); void optionmenu_changed( bool );

View File

@ -55,7 +55,7 @@ struct FS
FS( ) FS( )
{ {
read = create = resize = move = check = copy = false ; read = create = resize = move = check = copy = false ;
MIN = 1 ; MIN = 0 ;
MAX = 0 ; MAX = 0 ;
} }
}; };

View File

@ -37,14 +37,15 @@ Dialog_Partition_New::Dialog_Partition_New( )
frame_resizer_base ->set_used( 0 ) ; frame_resizer_base ->set_used( 0 ) ;
} }
void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_extended, unsigned short new_count, const std::vector <FS> & FILESYSTEMS, bool only_unformatted ) void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_extended, unsigned short new_count, const std::vector <FS> & FILESYSTEMS, bool only_unformatted, int cylinder_size )
{ {
this ->new_count = new_count; this ->new_count = new_count;
this ->selected_partition = partition; this ->selected_partition = partition;
this ->cylinder_size = cylinder_size ;
this ->FILESYSTEMS = FILESYSTEMS ; this ->FILESYSTEMS = FILESYSTEMS ;
this ->FILESYSTEMS .back( ) .filesystem = _("Unformatted") ; this ->FILESYSTEMS .back( ) .filesystem = _("Unformatted") ;
this ->FILESYSTEMS .back( ) .create = true ; this ->FILESYSTEMS .back( ) .create = true ;
FS fs ; fs.filesystem = "extended" ; FS fs ; fs.filesystem = "extended" ;
this ->FILESYSTEMS .push_back( fs ) ; this ->FILESYSTEMS .push_back( fs ) ;
@ -112,7 +113,11 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
//set first enabled filesystem //set first enabled filesystem
optionmenu_filesystem .set_history( first_creatable_fs ) ; optionmenu_filesystem .set_history( first_creatable_fs ) ;
optionmenu_changed( false ) ; optionmenu_changed( false ) ;
//euhrm, this wil only happen when there's a very small free space (usually the effect of a bad partitionmanager)
if ( selected_partition .Get_Length_MB( ) < cylinder_size )
frame_resizer_base ->set_sensitive( false ) ;
this ->show_all_children( ) ; this ->show_all_children( ) ;
} }
@ -185,17 +190,24 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
if ( ! type ) if ( ! type )
{ {
fs = FILESYSTEMS[ optionmenu_filesystem .get_history( ) ] ; fs = FILESYSTEMS[ optionmenu_filesystem .get_history( ) ] ;
if ( fs .MIN < cylinder_size )
fs .MIN = cylinder_size ;
if ( selected_partition .Get_Length_MB( ) < fs .MIN )
fs .MIN = selected_partition .Get_Length_MB( ) ;
fs .MAX = ( fs .MAX && ( fs .MAX - cylinder_size ) < TOTAL_MB ) ? fs .MAX - cylinder_size : TOTAL_MB ;
//needed vor upper limit check (see also Dialog_Base_Partition::on_signal_resize ) //needed vor upper limit check (see also Dialog_Base_Partition::on_signal_resize )
selected_partition .filesystem = fs .filesystem ; selected_partition .filesystem = fs .filesystem ;
//set new spinbutton ranges //set new spinbutton ranges
spinbutton_before .set_range( 0, TOTAL_MB - fs .MIN ) ; spinbutton_before .set_range( 0, TOTAL_MB - fs .MIN ) ;
spinbutton_size .set_range( fs .MIN, fs .MAX ? fs .MAX : TOTAL_MB ) ; spinbutton_size .set_range( fs .MIN, fs .MAX ) ;
spinbutton_after .set_range( 0, TOTAL_MB - fs .MIN ) ; spinbutton_after .set_range( 0, TOTAL_MB - fs .MIN ) ;
//set contents of label_minmax //set contents of label_minmax
Set_MinMax_Text( fs .MIN, fs .MAX ? fs .MAX : TOTAL_MB ) ; Set_MinMax_Text( fs .MIN, fs .MAX ) ;
} }
//set fitting resizer colors //set fitting resizer colors

View File

@ -303,7 +303,7 @@ bool GParted_Core::Create( const Glib::ustring & device_path, Partition & new_pa
if ( new_partition .type == GParted::EXTENDED ) if ( new_partition .type == GParted::EXTENDED )
return Create_Empty_Partition( device_path, new_partition ) ; return Create_Empty_Partition( device_path, new_partition ) ;
else if ( Create_Empty_Partition( device_path, new_partition ) > 0 ) else if ( Create_Empty_Partition( device_path, new_partition, ( new_partition .Get_Length_MB( ) - Get_Cylinder_Size( device_path ) ) < Get_FS( new_partition .filesystem, FILESYSTEMS ) .MIN ) > 0 )
{ {
set_proper_filesystem( new_partition .filesystem ) ; set_proper_filesystem( new_partition .filesystem ) ;

View File

@ -958,7 +958,13 @@ void Win_GParted::activate_new()
else if ( ! max_amount_prim_reached( ) ) else if ( ! max_amount_prim_reached( ) )
{ {
Dialog_Partition_New dialog; Dialog_Partition_New dialog;
dialog .Set_Data( selected_partition, any_extended, new_count, gparted_core .get_fs( ), devices [ current_device ] .readonly ) ;
//calculate cylindersize
long cylinder_size = Sector_To_MB( devices[ current_device ] .heads * devices[ current_device ] .sectors ) ;
if ( cylinder_size < 1 )
cylinder_size = 1 ;
dialog .Set_Data( selected_partition, any_extended, new_count, gparted_core .get_fs( ), devices [ current_device ] .readonly, cylinder_size ) ;
dialog .set_transient_for( *this ); dialog .set_transient_for( *this );
if ( dialog .run( ) == Gtk::RESPONSE_OK ) if ( dialog .run( ) == Gtk::RESPONSE_OK )

View File

@ -44,7 +44,7 @@ FS reiserfs::get_filesystem_support( )
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) && fs .resize ) if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) && fs .resize )
fs .copy = true ; fs .copy = true ;
fs .MIN = 40 ; fs .MIN = 32 ;
return fs ; return fs ;
} }