improved errorhandling a bit. At the initialscan we store errors/warnings
* improved errorhandling a bit. At the initialscan we store errors/warnings now in a list per partition and show the in the partitioninfo dialog. While executing an operation we collect all libparted exceptions in a list and attach this list to the operationdetails when everything is done.
This commit is contained in:
parent
b823356110
commit
677a21f50a
|
@ -1,3 +1,12 @@
|
|||
2006-07-30 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* improved errorhandling a bit. At the initialscan we store
|
||||
errors/warnings now in a list per partition and show the in the
|
||||
partitioninfo dialog.
|
||||
While executing an operation we collect all libparted exceptions in
|
||||
a list and attach this list to the operationdetails when everything
|
||||
is done.
|
||||
|
||||
2006-07-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* renamed some enums
|
||||
|
|
|
@ -52,6 +52,7 @@ private:
|
|||
Partition partition ;
|
||||
|
||||
Gtk::HBox *hbox ;
|
||||
Gtk::VBox *vbox ;
|
||||
Gtk::DrawingArea drawingarea ;
|
||||
Gtk::Frame *frame ;
|
||||
Gtk::Image *image;
|
||||
|
|
|
@ -66,6 +66,7 @@ private:
|
|||
Glib::RefPtr<Gdk::Pixbuf> icon_execute ;
|
||||
Glib::RefPtr<Gdk::Pixbuf> icon_succes ;
|
||||
Glib::RefPtr<Gdk::Pixbuf> icon_error ;
|
||||
Glib::RefPtr<Gdk::Pixbuf> icon_info ;
|
||||
Glib::RefPtr<Gdk::Pixbuf> icon_n_a ;
|
||||
|
||||
Glib::RefPtr<Gtk::TreeStore> treestore_operations;
|
||||
|
|
|
@ -31,7 +31,8 @@ enum OperationDetailStatus {
|
|||
STATUS_EXECUTE = 1,
|
||||
STATUS_SUCCES = 2,
|
||||
STATUS_ERROR = 3,
|
||||
STATUS_N_A = 4
|
||||
STATUS_INFO = 4,
|
||||
STATUS_N_A = 5
|
||||
};
|
||||
|
||||
enum Font {
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
Gdk::Color color;
|
||||
bool inside_extended;
|
||||
bool busy;
|
||||
Glib::ustring error;
|
||||
std::vector<Glib::ustring> messages ;
|
||||
std::vector<Glib::ustring> flags ;
|
||||
|
||||
std::vector<Partition> logicals ;
|
||||
|
|
|
@ -35,8 +35,8 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
|
|||
//add label for detail and fill with relevant info
|
||||
Display_Info() ;
|
||||
|
||||
//display error (if any)
|
||||
if ( partition .error != "" )
|
||||
//display messages (if any)
|
||||
if ( partition .messages .size() > 0 )
|
||||
{
|
||||
frame = manage( new Gtk::Frame() );
|
||||
frame ->set_border_width( 10 );
|
||||
|
@ -45,12 +45,23 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
|
|||
|
||||
hbox = manage( new Gtk::HBox() );
|
||||
hbox ->pack_start( *image, Gtk::PACK_SHRINK ) ;
|
||||
hbox ->pack_start( * Utils::mk_label( "<b> " + static_cast<Glib::ustring>(_( "Warning:") ) + " </b>" ),
|
||||
hbox ->pack_start( * Utils::mk_label( "<b> " + Glib::ustring(_("Warning:") ) + " </b>" ),
|
||||
Gtk::PACK_SHRINK ) ;
|
||||
|
||||
|
||||
frame ->set_label_widget( *hbox ) ;
|
||||
frame ->add( * Utils::mk_label(
|
||||
"<i>" + partition .error + "</i>", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true ) ) ;
|
||||
//FIXME: for more clarity we should add a listview here with alternating rowcolors..
|
||||
//that way it's easier to tell messages apart..
|
||||
vbox = manage( new Gtk::VBox( false, 4 ) );
|
||||
vbox ->set_border_width( 5 ) ;
|
||||
for ( unsigned int t = 0 ; t < partition .messages .size() ; t++ )
|
||||
vbox ->pack_start( * Utils::mk_label( "<i>" + partition .messages[t] + "</i>",
|
||||
true,
|
||||
Gtk::ALIGN_LEFT,
|
||||
Gtk::ALIGN_CENTER,
|
||||
true ),
|
||||
Gtk::PACK_SHRINK ) ;
|
||||
frame ->add( *vbox ) ;
|
||||
|
||||
this ->get_vbox() ->pack_start( *frame, Gtk::PACK_SHRINK ) ;
|
||||
}
|
||||
|
@ -137,7 +148,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
this ->get_vbox() ->pack_start( *table, Gtk::PACK_SHRINK ) ;
|
||||
|
||||
//filesystem
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Filesystem:") ) + "</b>" ),
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Filesystem:") ) + "</b>" ),
|
||||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL ) ;
|
||||
|
@ -147,7 +158,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
Gtk::FILL ) ;
|
||||
|
||||
//size
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Size:") ) + "</b>" ),
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Size:") ) + "</b>" ),
|
||||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL) ;
|
||||
|
@ -163,7 +174,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
Utils::round( partition .sectors_used / static_cast<double>( partition .get_length() ) * 100 ) ;
|
||||
|
||||
//used
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Used:") ) + "</b>" ),
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Used:") ) + "</b>" ),
|
||||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL ) ;
|
||||
|
@ -177,7 +188,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
Gtk::FILL ) ;
|
||||
|
||||
//unused
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Unused:") ) + "</b>" ),
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Unused:") ) + "</b>" ),
|
||||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL ) ;
|
||||
|
@ -194,7 +205,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
//flags
|
||||
if ( partition.type != GParted::TYPE_UNALLOCATED )
|
||||
{
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Flags:") ) + "</b>" ),
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Flags:") ) + "</b>" ),
|
||||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL ) ;
|
||||
|
@ -210,7 +221,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
if ( partition .type != GParted::TYPE_UNALLOCATED && partition .status != GParted::STAT_NEW )
|
||||
{
|
||||
//path
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Path:") ) + "</b>",
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Path:") ) + "</b>",
|
||||
true,
|
||||
Gtk::ALIGN_LEFT,
|
||||
Gtk::ALIGN_TOP ),
|
||||
|
@ -224,7 +235,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
|
||||
//status
|
||||
Glib::ustring str_temp ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Status:") ) + "</b>" ),
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Status:") ) + "</b>" ),
|
||||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL ) ;
|
||||
|
@ -252,7 +263,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
|
||||
//first sector
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("First Sector:") ) + "</b>" ),
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("First Sector:") ) + "</b>" ),
|
||||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL ) ;
|
||||
|
@ -262,7 +273,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
Gtk::FILL ) ;
|
||||
|
||||
//last sector
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Last Sector:") ) + "</b>" ),
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Last Sector:") ) + "</b>" ),
|
||||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL ) ;
|
||||
|
@ -272,7 +283,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
Gtk::FILL ) ;
|
||||
|
||||
//total sectors
|
||||
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Total Sectors:") ) + "</b>" ),
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Total Sectors:") ) + "</b>" ),
|
||||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL ) ;
|
||||
|
|
|
@ -61,7 +61,8 @@ void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partitio
|
|||
|
||||
void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partition> & partitions )
|
||||
{
|
||||
if ( ! selected_partition .error .empty() )
|
||||
//little bit of paranoia ;)
|
||||
if ( selected_partition .sectors_used == -1 )
|
||||
fs .shrink = GParted::FS::NONE ;
|
||||
|
||||
//see if we need a fixed_start
|
||||
|
|
|
@ -61,6 +61,7 @@ Dialog_Progress::Dialog_Progress( const std::vector<Operation *> & operations )
|
|||
icon_execute = render_icon( Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
|
||||
icon_succes = render_icon( Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
|
||||
icon_error = render_icon( Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
|
||||
icon_info = render_icon( Gtk::Stock::INFO, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
|
||||
icon_n_a = render_icon( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
|
||||
|
||||
treestore_operations = Gtk::TreeStore::create( treeview_operations_columns );
|
||||
|
@ -141,6 +142,10 @@ void Dialog_Progress::update_operation_details( const Gtk::TreeRow & treerow,
|
|||
case STATUS_ERROR:
|
||||
treerow[ treeview_operations_columns .status_icon ] = icon_error ;
|
||||
|
||||
break ;
|
||||
case STATUS_INFO:
|
||||
treerow[ treeview_operations_columns .status_icon ] = icon_info ;
|
||||
|
||||
break ;
|
||||
case STATUS_N_A:
|
||||
treerow[ treeview_operations_columns .status_icon ] = icon_n_a ;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <cerrno>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
Glib::ustring ped_error ; //see e.g. ped_exception_handler()
|
||||
std::vector<Glib::ustring> libparted_messages ; //see ped_exception_handler()
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
@ -283,31 +283,49 @@ bool GParted_Core::snap_to_cylinder( const Device & device, Partition & partitio
|
|||
|
||||
bool GParted_Core::apply_operation_to_disk( Operation * operation )
|
||||
{
|
||||
bool succes = false ;
|
||||
libparted_messages .clear() ;
|
||||
|
||||
switch ( operation ->type )
|
||||
{
|
||||
case OPERATION_DELETE:
|
||||
return Delete( operation ->partition_original, operation ->operation_detail .sub_details ) ;
|
||||
succes = Delete( operation ->partition_original, operation ->operation_detail .sub_details ) ;
|
||||
break ;
|
||||
case OPERATION_CREATE:
|
||||
return create( operation ->device,
|
||||
operation ->partition_new,
|
||||
operation ->operation_detail .sub_details ) ;
|
||||
succes = create( operation ->device,
|
||||
operation ->partition_new,
|
||||
operation ->operation_detail .sub_details ) ;
|
||||
break ;
|
||||
case OPERATION_RESIZE_MOVE:
|
||||
return resize_move( operation ->device,
|
||||
operation ->partition_original,
|
||||
operation ->partition_new,
|
||||
operation ->operation_detail .sub_details ) ;
|
||||
succes = resize_move( operation ->device,
|
||||
operation ->partition_original,
|
||||
operation ->partition_new,
|
||||
operation ->operation_detail .sub_details ) ;
|
||||
break ;
|
||||
case OPERATION_FORMAT:
|
||||
return format( operation ->partition_new, operation ->operation_detail .sub_details ) ;
|
||||
succes = format( operation ->partition_new, operation ->operation_detail .sub_details ) ;
|
||||
break ;
|
||||
case OPERATION_COPY:
|
||||
operation ->partition_new .add_path( operation ->partition_original .get_path(), true ) ;
|
||||
return copy( static_cast<OperationCopy*>( operation ) ->partition_copied,
|
||||
operation ->partition_new,
|
||||
static_cast<OperationCopy*>( operation ) ->partition_copied .get_length(),
|
||||
static_cast<OperationCopy*>( operation ) ->block_size,
|
||||
operation ->operation_detail .sub_details ) ;
|
||||
succes = copy( static_cast<OperationCopy*>( operation ) ->partition_copied,
|
||||
operation ->partition_new,
|
||||
static_cast<OperationCopy*>( operation ) ->partition_copied .get_length(),
|
||||
static_cast<OperationCopy*>( operation ) ->block_size,
|
||||
operation ->operation_detail .sub_details ) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
if ( ! succes && libparted_messages .size() > 0 )
|
||||
{
|
||||
operation ->operation_detail .sub_details .push_back(
|
||||
OperationDetail( _("libparted messages"), STATUS_INFO ) ) ;
|
||||
|
||||
for ( unsigned int t = 0 ; t < libparted_messages .size() ; t++ )
|
||||
operation ->operation_detail .sub_details .back() .sub_details .push_back(
|
||||
OperationDetail( libparted_messages[ t ], STATUS_NONE, FONT_ITALIC ) ) ;
|
||||
}
|
||||
|
||||
return succes ;
|
||||
}
|
||||
|
||||
bool GParted_Core::set_disklabel( const Glib::ustring & device_path, const Glib::ustring & disklabel )
|
||||
|
@ -563,6 +581,7 @@ void GParted_Core::set_device_partitions( Device & device )
|
|||
lp_partition = ped_disk_next_partition( lp_disk, NULL ) ;
|
||||
while ( lp_partition )
|
||||
{
|
||||
libparted_messages .clear() ;
|
||||
partition_temp .Reset() ;
|
||||
|
||||
switch ( lp_partition ->type )
|
||||
|
@ -613,6 +632,10 @@ void GParted_Core::set_device_partitions( Device & device )
|
|||
break;
|
||||
}
|
||||
|
||||
partition_temp .messages .insert( partition_temp .messages .end(),
|
||||
libparted_messages. begin(),
|
||||
libparted_messages .end() ) ;
|
||||
|
||||
//if there's an end, there's a partition ;)
|
||||
if ( partition_temp .sector_end > -1 )
|
||||
{
|
||||
|
@ -683,13 +706,15 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
|
|||
return GParted::FS_REISER4 ;
|
||||
|
||||
//no filesystem found....
|
||||
partition_temp .error = _( "Unable to detect filesystem! Possible reasons are:" ) ;
|
||||
partition_temp .error += "\n-";
|
||||
partition_temp .error += _( "The filesystem is damaged" ) ;
|
||||
partition_temp .error += "\n-" ;
|
||||
partition_temp .error += _( "The filesystem is unknown to GParted" ) ;
|
||||
partition_temp .error += "\n-";
|
||||
partition_temp .error += _( "There is no filesystem available (unformatted)" ) ;
|
||||
temp = _( "Unable to detect filesystem! Possible reasons are:" ) ;
|
||||
temp += "\n-";
|
||||
temp += _( "The filesystem is damaged" ) ;
|
||||
temp += "\n-" ;
|
||||
temp += _( "The filesystem is unknown to GParted" ) ;
|
||||
temp += "\n-";
|
||||
temp += _( "There is no filesystem available (unformatted)" ) ;
|
||||
|
||||
partition_temp .messages .push_back( temp ) ;
|
||||
|
||||
return GParted::FS_UNKNOWN ;
|
||||
}
|
||||
|
@ -764,7 +789,7 @@ void GParted_Core::set_mountpoints( std::vector<Partition> & partitions )
|
|||
}
|
||||
|
||||
if ( partitions[ t ] .get_mountpoints() .empty() )
|
||||
partitions[ t ] .error = _("Unable to find mountpoint") ;
|
||||
partitions[ t ] .messages .push_back( _("Unable to find mountpoint") ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -785,8 +810,6 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions )
|
|||
temp = _("Unable to read the contents of this filesystem!") ;
|
||||
temp += "\n" ;
|
||||
temp += _("Because of this some operations may be unavailable.") ;
|
||||
temp += "\n\n" ;
|
||||
temp += _("Did you install the correct plugin for this filesystem?") ;
|
||||
|
||||
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
|
||||
{
|
||||
|
@ -803,11 +826,11 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions )
|
|||
if ( statvfs( partitions[ t ] .get_mountpoint() .c_str(), &sfs ) == 0 )
|
||||
partitions[ t ] .Set_Unused( sfs .f_bfree * (sfs .f_bsize / 512) ) ;
|
||||
else
|
||||
partitions[ t ] .error =
|
||||
partitions[ t ] .messages .push_back(
|
||||
"statvfs (" +
|
||||
partitions[ t ] .get_mountpoint() +
|
||||
"): " +
|
||||
Glib::strerror( errno ) ;
|
||||
Glib::strerror( errno ) ) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -827,8 +850,8 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions )
|
|||
}
|
||||
}
|
||||
|
||||
if ( partitions[ t ] .sectors_used == -1 && partitions[ t ] .error .empty() )
|
||||
partitions[ t ] .error = temp ;
|
||||
if ( partitions[ t ] .sectors_used == -1 )
|
||||
partitions[ t ] .messages .push_back( temp ) ;
|
||||
|
||||
}
|
||||
else if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
|
||||
|
@ -866,9 +889,6 @@ void GParted_Core::LP_set_used_sectors( Partition & partition )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( partition .sectors_used == -1 )
|
||||
partition .error = ped_error ;
|
||||
}
|
||||
|
||||
void GParted_Core::set_flags( Partition & partition )
|
||||
|
@ -883,7 +903,6 @@ bool GParted_Core::create( const Device & device,
|
|||
Partition & new_partition,
|
||||
std::vector<OperationDetail> & operation_details )
|
||||
{
|
||||
|
||||
if ( new_partition .type == GParted::TYPE_EXTENDED )
|
||||
{
|
||||
return create_partition( new_partition, operation_details ) ;
|
||||
|
@ -907,7 +926,6 @@ bool GParted_Core::create_partition( Partition & new_partition,
|
|||
operation_details .push_back( OperationDetail( _("create empty partition") ) ) ;
|
||||
|
||||
new_partition .partition_number = 0 ;
|
||||
ped_error .clear() ;
|
||||
|
||||
if ( open_device_and_disk( new_partition .device_path ) )
|
||||
{
|
||||
|
@ -1007,10 +1025,6 @@ bool GParted_Core::create_partition( Partition & new_partition,
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( ! ped_error .empty() )
|
||||
operation_details .back() .sub_details .push_back(
|
||||
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
|
||||
|
||||
operation_details .back() .status = STATUS_ERROR ;
|
||||
|
||||
return false ;
|
||||
|
@ -1290,10 +1304,6 @@ bool GParted_Core::move_filesystem_using_gparted( const Partition & partition_ol
|
|||
if ( ! error_message .empty() )
|
||||
operation_details .push_back(
|
||||
OperationDetail( error_message, STATUS_NONE, FONT_ITALIC ) ) ;
|
||||
|
||||
if ( ! ped_error .empty() )
|
||||
operation_details .push_back(
|
||||
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1337,9 +1347,6 @@ bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & par
|
|||
close_device_and_disk() ;
|
||||
}
|
||||
|
||||
if ( ! return_value && ! ped_error .empty() )
|
||||
operation_details .push_back( OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
|
||||
|
||||
return return_value ;
|
||||
}
|
||||
|
||||
|
@ -1467,7 +1474,6 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
|
|||
|
||||
PedConstraint *constraint = NULL ;
|
||||
lp_partition = NULL ;
|
||||
ped_error .clear() ;
|
||||
|
||||
if ( open_device_and_disk( partition_old .device_path ) )
|
||||
{
|
||||
|
@ -1513,9 +1519,6 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
|
|||
STATUS_NONE,
|
||||
FONT_ITALIC ) ) ;
|
||||
}
|
||||
else if ( ! ped_error .empty() )
|
||||
operation_details .back() .sub_details .push_back(
|
||||
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
|
||||
|
||||
if ( partition_old .type == GParted::TYPE_EXTENDED )
|
||||
{
|
||||
|
@ -1744,10 +1747,6 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
|
|||
if ( ! error_message .empty() )
|
||||
operation_details .push_back(
|
||||
OperationDetail( error_message, STATUS_NONE, FONT_ITALIC ) ) ;
|
||||
|
||||
if ( ! ped_error .empty() )
|
||||
operation_details .push_back(
|
||||
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
|
||||
}
|
||||
|
||||
//close the devices..
|
||||
|
@ -1879,7 +1878,6 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
|
|||
STATUS_NONE,
|
||||
FONT_ITALIC ) ) ;
|
||||
|
||||
ped_error .clear() ;
|
||||
bool succes = false ;
|
||||
if ( open_device_and_disk( partition_old .device_path ) )
|
||||
{
|
||||
|
@ -1905,6 +1903,7 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
|
|||
//FIXME: if we insert a weird partitionnew geom here (e.g. start > end)
|
||||
//ped_disk_set_partition_geom() will still return true (althoug an lp exception is written
|
||||
//to stdout.. see if this also affect create_partition and resize_move_partition
|
||||
//sended a patch to fix this to libparted list. will probably be in 1.7.2
|
||||
if ( ped_disk_set_partition_geom( lp_disk,
|
||||
lp_partition,
|
||||
constraint,
|
||||
|
@ -1935,9 +1934,6 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
|
|||
STATUS_NONE,
|
||||
FONT_ITALIC ) ) ;
|
||||
}
|
||||
else if ( ! ped_error .empty() )
|
||||
operation_details .back() .sub_details .push_back(
|
||||
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
|
||||
|
||||
operation_details .back() .status = succes ? STATUS_SUCCES : STATUS_ERROR ;
|
||||
return succes ;
|
||||
|
@ -2018,9 +2014,6 @@ bool GParted_Core::erase_filesystem_signatures( const Partition & partition )
|
|||
|
||||
//FIXME open_device( _and_disk) and the close functions should take an PedDevice * and PedDisk * as argument
|
||||
//basicly we should get rid of these global lp_device and lp_disk
|
||||
//also, it would be cool to create another open_device_and_disk() which also accepts an operation_details....
|
||||
//we don't have to show the opening as an operation in itself, but we could use it to report errors which might
|
||||
//occur while opening the device or disk.
|
||||
bool GParted_Core::open_device( const Glib::ustring & device_path )
|
||||
{
|
||||
lp_device = ped_device_get( device_path .c_str() );
|
||||
|
@ -2078,7 +2071,8 @@ bool GParted_Core::commit()
|
|||
PedExceptionOption GParted_Core::ped_exception_handler( PedException * e )
|
||||
{
|
||||
std::cout << e ->message << std::endl ;
|
||||
ped_error = e ->message ;
|
||||
|
||||
libparted_messages .push_back( e->message ) ;
|
||||
|
||||
return PED_EXCEPTION_UNHANDLED ;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ Partition::Partition( const Glib::ustring & path )
|
|||
void Partition::Reset()
|
||||
{
|
||||
paths .clear() ;
|
||||
error .clear() ;
|
||||
messages .clear() ;
|
||||
status = GParted::STAT_REAL ;
|
||||
type = GParted::TYPE_UNALLOCATED ;
|
||||
filesystem = GParted::FS_UNALLOCATED ;
|
||||
|
|
|
@ -152,7 +152,7 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition
|
|||
treerow[ treeview_detail_columns .icon1 ] =
|
||||
render_icon( Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_BUTTON );
|
||||
|
||||
if ( ! partition .error .empty() )
|
||||
if ( partition .messages .size() > 0 )
|
||||
{
|
||||
if ( ! static_cast< Glib::RefPtr<Gdk::Pixbuf> >( treerow[ treeview_detail_columns .icon1 ] ) )
|
||||
treerow[ treeview_detail_columns .icon1 ] =
|
||||
|
|
|
@ -1289,8 +1289,8 @@ void Win_GParted::activate_paste()
|
|||
{
|
||||
Dialog_Partition_Copy dialog( gparted_core .get_fs( copied_partition .filesystem ),
|
||||
devices[ current_device ] .cylsize ) ;
|
||||
//we don't need the errors/mountpoints of the source partition.
|
||||
copied_partition .error .clear() ;
|
||||
//we don't need the messages/mountpoints of the source partition.
|
||||
copied_partition .messages .clear() ;
|
||||
copied_partition .clear_mountpoints() ;
|
||||
dialog .Set_Data( selected_partition, copied_partition ) ;
|
||||
dialog .set_transient_for( *this );
|
||||
|
@ -1308,7 +1308,7 @@ void Win_GParted::activate_paste()
|
|||
partition_new .filesystem = copied_partition .filesystem ;
|
||||
partition_new .color = copied_partition .color ;
|
||||
partition_new .set_used( copied_partition .sectors_used ) ;
|
||||
partition_new .error .clear() ;
|
||||
partition_new .messages .clear() ;
|
||||
partition_new .status = GParted::STAT_COPY ;
|
||||
|
||||
//FIXME: in this case there's no window presented to the user, so he cannot choose the blocksize
|
||||
|
|
|
@ -69,7 +69,7 @@ void ext2::Set_Used_Sectors( Partition & partition )
|
|||
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
|
||||
}
|
||||
else
|
||||
partition .error = error ;
|
||||
partition .messages .push_back( error ) ;
|
||||
}
|
||||
|
||||
bool ext2::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
|
||||
|
|
|
@ -70,7 +70,7 @@ void ext3::Set_Used_Sectors( Partition & partition )
|
|||
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
|
||||
}
|
||||
else
|
||||
partition .error = error ;
|
||||
partition .messages .push_back( error ) ;
|
||||
}
|
||||
|
||||
bool ext3::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
|
||||
|
|
|
@ -70,7 +70,7 @@ void fat16::Set_Used_Sectors( Partition & partition )
|
|||
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
|
||||
}
|
||||
else
|
||||
partition .error = error ;
|
||||
partition .messages .push_back( error ) ;
|
||||
}
|
||||
|
||||
bool fat16::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
|
||||
|
|
|
@ -69,7 +69,7 @@ void fat32::Set_Used_Sectors( Partition & partition )
|
|||
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
|
||||
}
|
||||
else
|
||||
partition .error = error ;
|
||||
partition .messages .push_back( error ) ;
|
||||
}
|
||||
|
||||
bool fat32::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
|
||||
|
|
|
@ -90,7 +90,7 @@ void jfs::Set_Used_Sectors( Partition & partition )
|
|||
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
|
||||
}
|
||||
else
|
||||
partition .error = error ;
|
||||
partition .messages .push_back( error ) ;
|
||||
}
|
||||
|
||||
bool jfs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
|
||||
|
|
|
@ -67,7 +67,7 @@ void ntfs::Set_Used_Sectors( Partition & partition )
|
|||
partition .Set_Unused( N ) ;
|
||||
}
|
||||
else
|
||||
partition .error = error ;
|
||||
partition .messages .push_back( error ) ;
|
||||
}
|
||||
|
||||
bool ntfs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
|
||||
|
|
|
@ -68,7 +68,7 @@ void reiser4::Set_Used_Sectors( Partition & partition )
|
|||
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
|
||||
}
|
||||
else
|
||||
partition .error = error ;
|
||||
partition .messages .push_back( error ) ;
|
||||
}
|
||||
|
||||
bool reiser4::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
|
||||
|
|
|
@ -73,7 +73,7 @@ void reiserfs::Set_Used_Sectors( Partition & partition )
|
|||
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
|
||||
}
|
||||
else
|
||||
partition .error = error ;
|
||||
partition .messages .push_back( error ) ;
|
||||
}
|
||||
|
||||
bool reiserfs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
|
||||
|
|
|
@ -92,7 +92,7 @@ void xfs::Set_Used_Sectors( Partition & partition )
|
|||
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
|
||||
}
|
||||
else
|
||||
partition .error = error ;
|
||||
partition .messages .push_back( error ) ;
|
||||
}
|
||||
|
||||
bool xfs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
|
||||
|
|
Loading…
Reference in New Issue