Scroom  0.14
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 = boost::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 = boost::shared_ptr<ProgressBarPulser>

Member Function Documentation

◆ doWork()

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

Implements WorkInterface.

79  {
80  boost::mutex::scoped_lock const lock(mut);
81 
82  while(current == progressbars.end() || *current == NULL)
83  {
84  if(progressbars.empty())
85  {
86  return false;
87  }
88 
89  if(current == progressbars.end())
90  {
91  current = progressbars.begin();
92  }
93  else if(*current == NULL)
94  {
95  current = progressbars.erase(current);
96  }
97  else
98  {
99  defect();
100  }
101  }
102 
103  gtk_progress_bar_pulse(*current);
104  ++current;
105  return true;
106  }

◆ start()

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

◆ stop()

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

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:
anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::progressbars
std::list< GtkProgressBar * > progressbars
Definition: progressbarmanager.cc:28
on_idle
gboolean on_idle(gpointer user_data)
Definition: callbacks.cc:272
WorkInterface
Definition: workinterface.hh:12
anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::mut
boost::mutex mut
Definition: progressbarmanager.cc:27
anonymous_namespace{progressbarmanager.cc}::ProgressBarPulser::current
std::list< GtkProgressBar * >::iterator current
Definition: progressbarmanager.cc:29
defect
#define defect()
Definition: assertions.hh:40