Identify libparted messages as either success or error (#790842)

All libparted messages were reported as informational, even for a step
which failed.  Instead identify libparted messages as either
informational or errors depending on whether this step was successful
or not respectively.

Bug 790842 - Report libparted messages into operation details at the
             point at which they occur
This commit is contained in:
Mike Fleetwood 2017-11-26 13:23:31 +00:00 committed by Curtis Gedak
parent b4cd5da4f7
commit 0688662055
4 changed files with 6 additions and 5 deletions

View file

@ -208,7 +208,7 @@ private:
static void init_filesystems();
static void fini_filesystems();
void capture_libparted_messages( OperationDetail & operationdetail );
void capture_libparted_messages( OperationDetail & operationdetail, bool success );
static bool flush_device( PedDevice * lp_device );
static bool get_device( const Glib::ustring & device_path, PedDevice *& lp_device, bool flush = false );

View file

@ -75,7 +75,7 @@ public:
sigc::signal< void, const OperationDetail & > signal_update ;
sigc::signal< void, bool > signal_cancel;
sigc::signal< void, OperationDetail & > signal_capture_errors;
sigc::signal< void, OperationDetail &, bool > signal_capture_errors;
char cancelflag;
private:

View file

@ -4100,11 +4100,12 @@ void GParted_Core::fini_filesystems()
}
}
void GParted_Core::capture_libparted_messages( OperationDetail & operationdetail )
void GParted_Core::capture_libparted_messages( OperationDetail & operationdetail, bool success )
{
if ( libparted_messages.size() > 0 )
{
operationdetail.add_child( OperationDetail( _("libparted messages"), STATUS_INFO ) );
operationdetail.add_child( OperationDetail( _("libparted messages"),
success ? STATUS_INFO : STATUS_ERROR ) );
for ( unsigned int i = 0 ; i < libparted_messages.size() ; i++ )
operationdetail.get_last_child().add_child(
OperationDetail( libparted_messages[i], STATUS_NONE, FONT_ITALIC ) );

View file

@ -109,7 +109,7 @@ void OperationDetail::set_status( OperationDetailStatus status )
void OperationDetail::set_success_and_capture_errors( bool success )
{
set_status( success ? STATUS_SUCCES : STATUS_ERROR );
signal_capture_errors.emit( *this );
signal_capture_errors.emit( *this, success );
no_more_children = true;
}