From f5ba53fb3e40e0c0ed4bd3acc18fa395e1008bb9 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Mon, 12 Jun 2023 08:57:45 +0100 Subject: [PATCH] Return const reference from OperationDetail::get_progressbar() The only use of the reference returned from OperationDetail::get_progressbar() is to call const methods ProgressBar::running(), ::get_fraction() and ::get_text(). Therefore make OperationDetail::get_progressbar() return a const reference. --- include/OperationDetail.h | 2 +- src/Dialog_Progress.cc | 2 +- src/OperationDetail.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/OperationDetail.h b/include/OperationDetail.h index c22e74c2..baa04f8c 100644 --- a/include/OperationDetail.h +++ b/include/OperationDetail.h @@ -82,7 +82,7 @@ private: void add_child_implement( const OperationDetail & operationdetail ); void on_update( const OperationDetail & operationdetail ) ; void cancel( bool force ); - ProgressBar & get_progressbar() const; + const ProgressBar& get_progressbar() const; Glib::ustring description ; OperationDetailStatus status ; diff --git a/src/Dialog_Progress.cc b/src/Dialog_Progress.cc index f114258c..1d89bcec 100644 --- a/src/Dialog_Progress.cc +++ b/src/Dialog_Progress.cc @@ -165,7 +165,7 @@ void Dialog_Progress::on_signal_update( const OperationDetail & operationdetail if ( operationdetail .get_status() == STATUS_EXECUTE ) label_current_sub_text = operationdetail .get_description() ; - ProgressBar & progressbar_src = operationdetail.get_progressbar(); + const ProgressBar& progressbar_src = operationdetail.get_progressbar(); if ( progressbar_src.running() ) { if ( pulsetimer.connected() ) diff --git a/src/OperationDetail.cc b/src/OperationDetail.cc index 7447d90c..cdadb443 100644 --- a/src/OperationDetail.cc +++ b/src/OperationDetail.cc @@ -227,7 +227,7 @@ void OperationDetail::cancel( bool force ) signal_cancel.emit( force ); } -ProgressBar & OperationDetail::get_progressbar() const +const ProgressBar& OperationDetail::get_progressbar() const { return single_progressbar; }