:get_fs now returns a const reference. in copy and resizedialog

* Gparted_Core::get_fs now returns a const reference.
* in copy and resizedialog filesystems with MAX set now have a max size of MAX - one cylinder .
This commit is contained in:
Bart Hakvoort 2004-12-15 20:43:58 +00:00
parent 6830d475cf
commit 10e8f3338d
9 changed files with 21 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2004-12-15 Bart Hakvoort <gparted@users.sf.net>
* Gparted_Core::get_fs now returns a const reference.
* in copy and resizedialog filesystems with MAX set now have a max size of MAX - one cylinder .
2004-12-15 Bart Hakvoort <gparted@users.sf.net> 2004-12-15 Bart Hakvoort <gparted@users.sf.net>
* (all filesystem classes): fixed bug with thousand separator (#161362). * (all filesystem classes): fixed bug with thousand separator (#161362).

View File

@ -81,6 +81,7 @@ protected:
bool fixed_start, GRIP ; bool fixed_start, GRIP ;
double before_value ; double before_value ;
FS fs ; FS fs ;
short BUF ; //used in resize and copy ( safety reasons )
private: private:
void Check_Change() ; void Check_Change() ;

View File

@ -26,7 +26,7 @@ namespace GParted
class Dialog_Partition_Copy : public Dialog_Base_Partition class Dialog_Partition_Copy : public Dialog_Base_Partition
{ {
public: public:
Dialog_Partition_Copy( std::vector<FS> FILESYSTEMS ) ; Dialog_Partition_Copy( std::vector<FS> FILESYSTEMS, Sector cylinder_size ) ;
void Set_Data( const Partition & selected_partition, const Partition & copied_partition ); void Set_Data( const Partition & selected_partition, const Partition & copied_partition );
Partition Get_New_Partition( ) ; Partition Get_New_Partition( ) ;

View File

@ -33,8 +33,6 @@ private:
void Resize_Move_Normal( const std::vector <Partition> & partitions ) ; void Resize_Move_Normal( const std::vector <Partition> & partitions ) ;
void Resize_Move_Extended( const std::vector <Partition> & partitions ) ; void Resize_Move_Extended( const std::vector <Partition> & partitions ) ;
short BUF ; //added to the min. size a filesystem can be..( safety reasons )
}; };
} //GParted } //GParted

View File

@ -57,7 +57,7 @@ public:
bool Set_Disklabel( const Glib::ustring & device_path, const Glib::ustring & disklabel ) ; bool Set_Disklabel( const Glib::ustring & device_path, const Glib::ustring & disklabel ) ;
std::vector<FS> get_fs( ) ; const std::vector<FS> & get_fs( ) const ;
Glib::RefPtr<Gtk::TextBuffer> get_textbuffer( ) ; Glib::RefPtr<Gtk::TextBuffer> get_textbuffer( ) ;
private: private:

View File

@ -20,10 +20,16 @@
namespace GParted namespace GParted
{ {
Dialog_Partition_Copy::Dialog_Partition_Copy( std::vector<FS> FILESYSTEMS ) Dialog_Partition_Copy::Dialog_Partition_Copy( std::vector<FS> FILESYSTEMS, Sector cylinder_size )
{ {
this ->FILESYSTEMS = FILESYSTEMS ; this ->FILESYSTEMS = FILESYSTEMS ;
//some disk have a small cylindersize, for safetyreasons i keep this size at >=1
if ( cylinder_size < 2048 )
cylinder_size = 2048 ;
BUF = Sector_To_MB( cylinder_size ) ;
Set_Resizer( false ) ; Set_Resizer( false ) ;
Set_Confirm_Button( PASTE ) ; Set_Confirm_Button( PASTE ) ;
} }
@ -50,8 +56,7 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
frame_resizer_base ->set_x_end( ( Round( (double) (copied_partition .sector_end - copied_partition .sector_start) / ( (double)total_length/500) )) ) ; frame_resizer_base ->set_x_end( ( Round( (double) (copied_partition .sector_end - copied_partition .sector_start) / ( (double)total_length/500) )) ) ;
frame_resizer_base ->set_used( Round( (double) copied_partition .sectors_used / ( (double)total_length/500) ) ) ; frame_resizer_base ->set_used( Round( (double) copied_partition .sectors_used / ( (double)total_length/500) ) ) ;
if ( ! fs .MAX ) fs .MAX = ( ! fs .MAX || fs .MAX > TOTAL_MB ) ? TOTAL_MB : fs .MAX -= BUF ;
fs .MAX = TOTAL_MB ;
fs .MIN = copied_partition .Get_Length_MB( ) +1 ; fs .MIN = copied_partition .Get_Length_MB( ) +1 ;

View File

@ -129,8 +129,9 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
else //only grow.. else //only grow..
fs .MIN = selected_partition .Get_Length_MB( ) ; fs .MIN = selected_partition .Get_Length_MB( ) ;
if ( ! fs .MAX || fs .MAX > TOTAL_MB ) //if ( ! fs .MAX || fs .MAX > TOTAL_MB )
fs .MAX = TOTAL_MB ; // fs .MAX = TOTAL_MB ;
fs .MAX = ( ! fs .MAX || fs .MAX > TOTAL_MB ) ? TOTAL_MB : fs .MAX -= BUF/2 ;
//set values of spinbutton_before //set values of spinbutton_before
if ( ! fixed_start ) if ( ! fixed_start )

View File

@ -470,7 +470,7 @@ bool GParted_Core::Set_Disklabel( const Glib::ustring & device_path, const Glib:
return return_value ; return return_value ;
} }
std::vector<FS> GParted_Core::get_fs( ) const std::vector<FS> & GParted_Core::get_fs( ) const
{ {
return FILESYSTEMS ; return FILESYSTEMS ;
} }

View File

@ -927,7 +927,7 @@ void Win_GParted::activate_paste()
{ {
if ( ! max_amount_prim_reached( ) ) if ( ! max_amount_prim_reached( ) )
{ {
Dialog_Partition_Copy dialog( gparted_core .get_fs( ) ) ; Dialog_Partition_Copy dialog( gparted_core .get_fs( ), devices[ current_device ] .heads * devices[ current_device ] .sectors ) ;
copied_partition .error .clear( ) ; //we don't need the errors of the source partition. copied_partition .error .clear( ) ; //we don't need the errors of the source partition.
dialog .Set_Data( selected_partition, copied_partition ) ; dialog .Set_Data( selected_partition, copied_partition ) ;
dialog .set_transient_for( *this ); dialog .set_transient_for( *this );