Scroom 0.14-48-ga0fee447
Loading...
Searching...
No Matches
anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser Class Reference
Inheritance diagram for anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser:
Inheritance graph
Collaboration diagram for anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser:
Collaboration graph

Public Types

using Ptr = std::shared_ptr< ProgressBarPulser >
 

Public Member Functions

void start (GtkProgressBar *progressBar)
 
void stop (GtkProgressBar *progressBar)
 
bool doWork () override
 

Private Attributes

boost::mutex mut
 
std::list< GtkProgressBar * > progressbars
 
std::list< GtkProgressBar * >::iterator current
 

Member Typedef Documentation

◆ Ptr

using anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::Ptr = std::shared_ptr<ProgressBarPulser>

Member Function Documentation

◆ doWork()

bool anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::doWork ( )
overridevirtual

Implements WorkInterface.

80 {
81 boost::mutex::scoped_lock const lock(mut);
82
83 while(current == progressbars.end() || *current == nullptr)
84 {
85 if(progressbars.empty())
86 {
87 return false;
88 }
89
90 if(current == progressbars.end())
91 {
92 current = progressbars.begin();
93 }
94 else if(*current == nullptr)
95 {
97 }
98 else
99 {
100 defect();
101 }
102 }
103
104 gtk_progress_bar_pulse(*current);
105 ++current;
106 return true;
107 }
#define defect()
Definition assertions.hh:45
std::list< GtkProgressBar * >::iterator current
Definition progressbarmanager.cc:30
boost::mutex mut
Definition progressbarmanager.cc:28
std::list< GtkProgressBar * > progressbars
Definition progressbarmanager.cc:29

◆ start()

void anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::start ( GtkProgressBar *  progressBar)
54 {
55 boost::mutex::scoped_lock const lock(mut);
56
57 progressbars.push_back(progressBar_);
58
59 if(progressbars.size() == 1)
60 {
61 current = progressbars.begin();
62 g_timeout_add(100, on_idle, static_cast<WorkInterface*>(this));
63 }
64 }
gboolean on_idle(gpointer user_data)
Definition callbacks.cc:278
Definition workinterface.hh:13
Here is the call graph for this function:

◆ stop()

void anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::stop ( GtkProgressBar *  progressBar)
67 {
68 boost::mutex::scoped_lock const lock(mut);
69
70 for(GtkProgressBar*& p: progressbars)
71 {
72 if(p == progressBar_)
73 {
74 p = nullptr;
75 }
76 }
77 }
PresentationInterfaceStub::Ptr const p
Definition determine-size-test.cc:172

Member Data Documentation

◆ current

std::list<GtkProgressBar*>::iterator anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::current
private

◆ mut

boost::mutex anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::mut
private

◆ progressbars

std::list<GtkProgressBar*> anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::progressbars
private

The documentation for this class was generated from the following file: