Display progress from the single ProgressBar in the GUI (#760709)

Change the Applying pending operations dialog so that it takes it source
of progress from the single ProgressBar object, rather than the fraction
value in every OperationDetail object.  Also remove ProgressBar
debugging now that it is being used to drive the UI.

NOTE:
This temporarily causes the existing file system specific progress bars
to not be shown because they still update via the fraction member in
each OperationDetail object, rather than the new ProgressBar.  This will
be corrected in following commits.

Bug 760709 - Add progress bars to XFS and EXT2/3/4 file system specific
             copy methods
This commit is contained in:
Mike Fleetwood 2016-01-11 14:21:11 +00:00 committed by Curtis Gedak
parent c3669c3a96
commit b0d9d2de7e
2 changed files with 19 additions and 15 deletions

View File

@ -16,6 +16,8 @@
*/
#include "../include/Dialog_Progress.h"
#include "../include/OperationDetail.h"
#include "../include/ProgressBar.h"
#include <gtkmm/stock.h>
#include <gtkmm/main.h>
@ -148,16 +150,26 @@ void Dialog_Progress::on_signal_update( const OperationDetail & operationdetail
}
//update the gui elements..
progress_text = operationdetail.progress_text;
if ( operationdetail .get_status() == STATUS_EXECUTE )
label_current_sub_text = operationdetail .get_description() ;
if ( operationdetail.fraction >= 0 ) {
pulsetimer.disconnect();
progressbar_current.set_fraction( operationdetail.fraction > 1.0 ? 1.0 : operationdetail.fraction );
} else if( !pulsetimer.connected() )
pulsetimer = Glib::signal_timeout().connect( sigc::mem_fun(*this, &Dialog_Progress::pulsebar_pulse), 100 );
ProgressBar & progressbar_src = operationdetail.get_progressbar();
if ( progressbar_src.running() )
{
if ( pulsetimer.connected() )
pulsetimer.disconnect();
progressbar_current.set_fraction( progressbar_src.get_fraction() );
progress_text = progressbar_src.get_text();
}
else
{
if ( ! pulsetimer.connected() )
{
pulsetimer = Glib::signal_timeout().connect(
sigc::mem_fun( *this, &Dialog_Progress::pulsebar_pulse ), 100 );
progress_text.clear();
}
}
update_gui_elements();
}
else//it's an new od which needs to be added to the model.

View File

@ -33,10 +33,6 @@ ProgressBar::~ProgressBar()
void ProgressBar::start( double target, ProgressBar_Text text_mode )
{
std::cout << "DEBUG: ProgressBar::start(target=" << target
<< ", text_mode=" << (text_mode==PROGRESSBAR_TEXT_NONE ? "PROGRESSBAR_TEXT_NONE" :
"PROGRESSBAR_TEXT_BLOCK_COPY") << ")"
<< std::endl;
m_running = true;
m_target = target;
m_progress = 0.0;
@ -47,19 +43,15 @@ void ProgressBar::start( double target, ProgressBar_Text text_mode )
void ProgressBar::update( double progress )
{
std::cout << "DEBUG: ProgressBar::update(progress=" << progress << ")";
if ( m_running )
{
m_progress = progress;
do_update();
std::cout << " m_fraction=" << m_fraction << " m_text=\"" << m_text << "\"";
}
std::cout << std::endl;
}
void ProgressBar::stop()
{
std::cout << "DEBUG: ProgressBar::stop()" << std::endl;
m_running = false;
m_timer.stop();
do_update();