"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Dialog_Partition_New.cc" between
gparted-1.2.0.tar.gz and gparted-1.3.0.tar.gz

About: GParted is a graphical partition editor for creating, reorganizing, and deleting disk partitions (using GNU libparted).

Dialog_Partition_New.cc  (gparted-1.2.0):Dialog_Partition_New.cc  (gparted-1.3.0)
skipping to change at line 35 skipping to change at line 35
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
namespace GParted namespace GParted
{ {
Dialog_Partition_New::Dialog_Partition_New( const Device & device, Dialog_Partition_New::Dialog_Partition_New( const Device & device,
const Partition & selected_partition , const Partition & selected_partition ,
bool any_extended, bool any_extended,
unsigned short new_count, unsigned short new_count,
const std::vector<FS> & FILESYSTEMS ) const std::vector<FS> & FILESYSTEMS )
: Dialog_Base_Partition(device) : Dialog_Base_Partition(device), default_fs(-1)
{ {
/*TO TRANSLATORS: dialogtitle */ /*TO TRANSLATORS: dialogtitle */
this ->set_title( _("Create new Partition") ) ; this ->set_title( _("Create new Partition") ) ;
Set_Resizer( false ) ; Set_Resizer( false ) ;
Set_Confirm_Button( NEW ) ; Set_Confirm_Button( NEW ) ;
//set used (in pixels)... //set used (in pixels)...
frame_resizer_base ->set_used( 0 ) ; frame_resizer_base ->set_used( 0 ) ;
set_data(device, selected_partition, any_extended, new_count, FILESYSTEMS ); set_data(device, selected_partition, any_extended, new_count, FILESYSTEMS );
skipping to change at line 180 skipping to change at line 180
(*it)->set_vexpand(); (*it)->set_vexpand();
//set some widely used values... //set some widely used values...
MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( s elected_partition ); MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( s elected_partition );
START = selected_partition.sector_start; START = selected_partition.sector_start;
total_length = selected_partition.sector_end - selected_partition.sector_ start; total_length = selected_partition.sector_end - selected_partition.sector_ start;
TOTAL_MB = Utils::round( Utils::sector_to_unit( selected_partition.get_se ctor_length(), TOTAL_MB = Utils::round( Utils::sector_to_unit( selected_partition.get_se ctor_length(),
selected_partition.sector _size, UNIT_MIB ) ); selected_partition.sector _size, UNIT_MIB ) );
MB_PER_PIXEL = TOTAL_MB / 500.00 ; MB_PER_PIXEL = TOTAL_MB / 500.00 ;
//set first enabled file system // Set default creatable file system.
combo_filesystem.set_active(first_creatable_fs); // (As the change signal for combo_filesystem has already been connected,
combobox_changed(false); // combobox_changed(false) is automatically called by setting the active
// selection. This is needed to initialise everything correctly).
combo_filesystem.set_active(default_fs);
//set spinbuttons initial values //set spinbuttons initial values
spinbutton_after .set_value( 0 ) ; spinbutton_after .set_value( 0 ) ;
spinbutton_size.set_value( ceil( fs_limits.max_size / double(MEBIBYTE) ) ); spinbutton_size.set_value( ceil( fs_limits.max_size / double(MEBIBYTE) ) );
spinbutton_before .set_value( MIN_SPACE_BEFORE_MB ) ; spinbutton_before .set_value( MIN_SPACE_BEFORE_MB ) ;
//Disable resizing when the total area is less than two mebibytes //Disable resizing when the total area is less than two mebibytes
if ( TOTAL_MB < 2 ) if ( TOTAL_MB < 2 )
frame_resizer_base ->set_sensitive( false ) ; frame_resizer_base ->set_sensitive( false ) ;
skipping to change at line 326 skipping to change at line 328
new_partition->sector_size, new_partition->sector_size,
true ); true );
new_partition->logicals.push_back_adopt( unallocated ); new_partition->logicals.push_back_adopt( unallocated );
} }
Dialog_Base_Partition::snap_to_alignment(m_device, *new_partition); Dialog_Base_Partition::snap_to_alignment(m_device, *new_partition);
return *new_partition; return *new_partition;
} }
void Dialog_Partition_New::combobox_changed(bool type) void Dialog_Partition_New::combobox_changed(bool combo_type_changed)
{ {
g_assert( new_partition != NULL ); // Bug: Not initialised by constructo r calling set_data() g_assert( new_partition != NULL ); // Bug: Not initialised by constructo r calling set_data()
// combo_type // combo_type
if ( type ) if (combo_type_changed)
{ {
if (combo_type.get_active_row_number() == TYPE_EXTENDED && if (combo_type.get_active_row_number() == TYPE_EXTENDED &&
combo_filesystem.items().size() < FILESYSTEMS.size() ) combo_filesystem.items().size() < FILESYSTEMS.size() )
{ {
combo_filesystem.items().push_back(Utils::get_filesystem_ string(FS_EXTENDED)); combo_filesystem.items().push_back(Utils::get_filesystem_ string(FS_EXTENDED));
combo_filesystem.set_active(combo_filesystem.items().back ()); combo_filesystem.set_active(combo_filesystem.items().back ());
combo_filesystem.set_sensitive(false); combo_filesystem.set_sensitive(false);
} }
else if (combo_type.get_active_row_number() != TYPE_EXTENDED && else if (combo_type.get_active_row_number() != TYPE_EXTENDED &&
combo_filesystem.items().size() == FILESYSTEMS.size() ) combo_filesystem.items().size() == FILESYSTEMS.size() )
{ {
combo_filesystem.set_active(default_fs);
combo_filesystem.items().erase(combo_filesystem.items().b ack()); combo_filesystem.items().erase(combo_filesystem.items().b ack());
combo_filesystem.set_sensitive(true); combo_filesystem.set_sensitive(true);
combo_filesystem.set_active(first_creatable_fs);
} }
} }
// combo_filesystem and combo_alignment // combo_filesystem and combo_alignment
if ( ! type ) if (! combo_type_changed)
{ {
fs = FILESYSTEMS[combo_filesystem.get_active_row_number()]; fs = FILESYSTEMS[combo_filesystem.get_active_row_number()];
fs_limits = GParted_Core::get_filesystem_limits(fs.fstype, *new_p artition); fs_limits = GParted_Core::get_filesystem_limits(fs.fstype, *new_p artition);
if ( fs_limits.min_size < MEBIBYTE ) if ( fs_limits.min_size < MEBIBYTE )
fs_limits.min_size = MEBIBYTE; fs_limits.min_size = MEBIBYTE;
if ( new_partition->get_byte_length() < fs_limits.min_size ) if ( new_partition->get_byte_length() < fs_limits.min_size )
fs_limits.min_size = new_partition->get_byte_length(); fs_limits.min_size = new_partition->get_byte_length();
skipping to change at line 405 skipping to change at line 407
filesystem_label_entry.set_max_length(Utils::get_filesystem_label_maxleng th(fs.fstype)); filesystem_label_entry.set_max_length(Utils::get_filesystem_label_maxleng th(fs.fstype));
frame_resizer_base->redraw(); frame_resizer_base->redraw();
} }
void Dialog_Partition_New::build_filesystems_combo(bool only_unformatted) void Dialog_Partition_New::build_filesystems_combo(bool only_unformatted)
{ {
g_assert( new_partition != NULL ); // Bug: Not initialised by constructo r calling set_data() g_assert( new_partition != NULL ); // Bug: Not initialised by constructo r calling set_data()
combo_filesystem.items().clear(); combo_filesystem.items().clear();
bool set_first=false; // Fill the file system combobox
//fill the file system menu with the file systems (except for extended)
for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) ; t++ ) for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) ; t++ )
{ {
//skip extended // Skip extended which is only added by combobox_changed() while
partition
// type = extended.
if (FILESYSTEMS[t].fstype == FS_EXTENDED) if (FILESYSTEMS[t].fstype == FS_EXTENDED)
continue ; continue ;
combo_filesystem.items().push_back(Utils::get_filesystem_string(F ILESYSTEMS[t].fstype)); combo_filesystem.items().push_back(Utils::get_filesystem_string(F ILESYSTEMS[t].fstype));
combo_filesystem.items().back().set_sensitive(
! only_unformatted && FILESYSTEMS[ t ] .create && if (FILESYSTEMS[t].fstype == FS_UNFORMATTED)
new_partition->get_byte_length() >= get_filesystem_min_li {
mit(FILESYSTEMS[t].fstype)); // Unformatted is always available
combo_filesystem.items().back().set_sensitive(true);
}
else
{
combo_filesystem.items().back().set_sensitive(
! only_unformatted
&&
FILESYSTEMS[t].create
&&
new_partition->get_byte_length() >= get_filesyste
m_min_limit(FILESYSTEMS[t].fstype) );
}
//use ext4/3/2 as first/second/third choice default file system //use ext4/3/2 as first/second/third choice default file system
//(Depends on ordering in FILESYSTEMS for preference) //(Depends on ordering in FILESYSTEMS for preference)
if ((FILESYSTEMS[t].fstype == FS_EXT2 || if ((FILESYSTEMS[t].fstype == FS_EXT2 ||
FILESYSTEMS[t].fstype == FS_EXT3 || FILESYSTEMS[t].fstype == FS_EXT3 ||
FILESYSTEMS[t].fstype == FS_EXT4 ) && FILESYSTEMS[t].fstype == FS_EXT4 ) &&
combo_filesystem.items().back().sensitive() ) combo_filesystem.items().back().sensitive() )
{ {
first_creatable_fs = combo_filesystem.items().size() - 1; default_fs = combo_filesystem.items().size() - 1;
set_first=true;
} }
} }
//unformatted is always available if (default_fs < 0)
combo_filesystem.items().back().set_sensitive(true);
if(!set_first)
{ {
//find and set first enabled file system as last choice default // Find and set first enabled file system as last choice default.
Note
// that unformatted will always be available.
for (unsigned int t = 0; t < combo_filesystem.items().size(); t++ ) for (unsigned int t = 0; t < combo_filesystem.items().size(); t++ )
if (combo_filesystem.items()[t].sensitive()) if (combo_filesystem.items()[t].sensitive())
{ {
first_creatable_fs = t ; default_fs = t;
break ; break ;
} }
} }
} }
Byte_Value Dialog_Partition_New::get_filesystem_min_limit( FSType fstype ) Byte_Value Dialog_Partition_New::get_filesystem_min_limit( FSType fstype )
{ {
return GParted_Core::get_filesystem_limits( fstype, *new_partition ).min_ size; return GParted_Core::get_filesystem_limits( fstype, *new_partition ).min_ size;
} }
 End of changes. 15 change blocks. 
23 lines changed or deleted 38 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)