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



commit 068866205531d49f4a090aab0c1b4aa6aee9b2be
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun Nov 26 13:23:31 2017 +0000

    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

 include/GParted_Core.h    |    2 +-
 include/OperationDetail.h |    2 +-
 src/GParted_Core.cc       |    5 +++--
 src/OperationDetail.cc    |    2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/include/GParted_Core.h b/include/GParted_Core.h
index db09d5e..84a451d 100644
--- a/include/GParted_Core.h
+++ b/include/GParted_Core.h
@@ -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 
);
diff --git a/include/OperationDetail.h b/include/OperationDetail.h
index a1a224a..564268a 100644
--- a/include/OperationDetail.h
+++ b/include/OperationDetail.h
@@ -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:
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 1b61711..6e041a5 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -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 ) );
diff --git a/src/OperationDetail.cc b/src/OperationDetail.cc
index 1a06f16..7bd8067 100644
--- a/src/OperationDetail.cc
+++ b/src/OperationDetail.cc
@@ -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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]