: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>
* (all filesystem classes): fixed bug with thousand separator (#161362).

View file

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

View file

@ -26,7 +26,7 @@ namespace GParted
class Dialog_Partition_Copy : public Dialog_Base_Partition
{
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 );
Partition Get_New_Partition( ) ;

View file

@ -33,8 +33,6 @@ private:
void Resize_Move_Normal( 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

View file

@ -57,7 +57,7 @@ public:
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( ) ;
private:

View file

@ -20,10 +20,16 @@
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 ;
//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_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_used( Round( (double) copied_partition .sectors_used / ( (double)total_length/500) ) ) ;
if ( ! fs .MAX )
fs .MAX = TOTAL_MB ;
fs .MAX = ( ! fs .MAX || fs .MAX > TOTAL_MB ) ? TOTAL_MB : fs .MAX -= BUF ;
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..
fs .MIN = selected_partition .Get_Length_MB( ) ;
if ( ! fs .MAX || fs .MAX > TOTAL_MB )
fs .MAX = TOTAL_MB ;
//if ( ! fs .MAX || 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
if ( ! fixed_start )

View file

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

View file

@ -927,7 +927,7 @@ void Win_GParted::activate_paste()
{
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.
dialog .Set_Data( selected_partition, copied_partition ) ;
dialog .set_transient_for( *this );