cleanups correct partitiontype is now set after creation or conversion.
* include/FileSystem.h: cleanups * include/GParted_Core.h, src/GParted_Core.cc: correct partitiontype is now set after creation or conversion. (#322281)
This commit is contained in:
parent
d8efdb266c
commit
1382c7bc17
|
@ -1,3 +1,9 @@
|
|||
2005-11-24 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
* include/FileSystem.h: cleanups
|
||||
* include/GParted_Core.h,
|
||||
src/GParted_Core.cc: correct partitiontype is now set after creation
|
||||
or conversion. (#322281)
|
||||
|
||||
2005-11-18 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
* configure.in: added mk to ALL_LINGUAS on request of Arangel
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ inline bool open_device_and_disk( const Glib::ustring & device_path, PedDevice *
|
|||
if ( open_device( device_path, device ) )
|
||||
disk = ped_disk_new( device );
|
||||
|
||||
//if ! disk and writeable it's probably a HD without disklabel. We return true here and deal with them in GParted_Core::get_devices
|
||||
//if ! disk and writeable it's probably a HD without disklabel.
|
||||
//We return true here and deal with them in GParted_Core::get_devices
|
||||
if ( ! disk && ( strict || device ->read_only ) )
|
||||
{
|
||||
ped_device_destroy( device ) ;
|
||||
|
|
|
@ -77,6 +77,7 @@ private:
|
|||
|
||||
void Show_Error( Glib::ustring message ) ;
|
||||
void set_proper_filesystem( const Glib::ustring & filesystem ) ;
|
||||
void set_partition_type( const Glib::ustring & device_path, const Partition & partition ) ;
|
||||
|
||||
Glib::RefPtr<Gtk::TextBuffer> textbuffer;
|
||||
|
||||
|
|
|
@ -365,10 +365,13 @@ bool GParted_Core::Create( const Device & device, Partition & new_partition )
|
|||
{
|
||||
set_proper_filesystem( new_partition .filesystem ) ;
|
||||
|
||||
//most likely this means the user created an unformatted partition, however in theory, it could also screw some errorhandling.
|
||||
//most likely this means the user created an unformatted partition,
|
||||
//however in theory, it could also screw some errorhandling.
|
||||
if ( ! p_filesystem )
|
||||
return true ;
|
||||
|
||||
set_partition_type( device .path, new_partition ) ;
|
||||
|
||||
return p_filesystem ->Create( new_partition ) ;
|
||||
}
|
||||
|
||||
|
@ -388,6 +391,8 @@ bool GParted_Core::Convert_FS( const Glib::ustring & device_path, const Partitio
|
|||
close_device_and_disk( device, disk ) ;
|
||||
}
|
||||
|
||||
set_partition_type( device_path, partition ) ;
|
||||
|
||||
set_proper_filesystem( partition .filesystem ) ;
|
||||
|
||||
return p_filesystem ->Create( partition ) ;
|
||||
|
@ -775,4 +780,27 @@ void GParted_Core::set_proper_filesystem( const Glib::ustring & filesystem )
|
|||
p_filesystem ->textbuffer = textbuffer ;
|
||||
}
|
||||
|
||||
|
||||
void GParted_Core::set_partition_type( const Glib::ustring & device_path, const Partition & partition )
|
||||
{
|
||||
if ( open_device_and_disk( device_path, device, disk ) )
|
||||
{
|
||||
PedFileSystemType * fs_type = ped_file_system_type_get( partition .filesystem .c_str() ) ;
|
||||
|
||||
//default is Linux (83)
|
||||
if ( ! fs_type )
|
||||
fs_type = ped_file_system_type_get( "ext2" ) ;
|
||||
|
||||
if ( fs_type )
|
||||
{
|
||||
c_partition = ped_disk_get_partition_by_sector( disk, (partition .sector_end + partition .sector_start) / 2 ) ;
|
||||
|
||||
if ( c_partition && ped_partition_set_system( c_partition, fs_type ) && Commit( disk ) )
|
||||
sleep( 1 ) ; //paranoia: give the OS some time to update nodes in /dev
|
||||
}
|
||||
|
||||
close_device_and_disk( device, disk ) ;
|
||||
}
|
||||
}
|
||||
|
||||
} //GParted
|
||||
|
|
Loading…
Reference in New Issue