boost::shared_mutex big_mutex;
-Clients clients;
-
-Client::Client(const string& name)
- : name(name), zombie(false)
+Client::Client(const string& name, const Clients& clients)
+ : name(name), zombie(false), clients(clients)
{
}
bool background_comparison = true;
it->getConfigInfo().getValue("BACKGROUND_COMPARISON", background_comparison);
if (background_comparison)
- backgrounds.add_task(it, snap1, snap2);
+ clients.backgrounds().add_task(it, snap1, snap2);
DBus::MessageMethodReturn reply(msg);
}
hoho << "backgrounds:";
- for (Backgrounds::const_iterator it = backgrounds.begin(); it != backgrounds.end(); ++it)
+ for (Backgrounds::const_iterator it = clients.backgrounds().begin(); it != clients.backgrounds().end(); ++it)
{
std::ostringstream s;
s << " name:'" << it->meta_snapper->configName() << "'";
}
+Clients::Clients(Backgrounds& backgrounds)
+ : bgs(backgrounds)
+{
+}
+
+
+Backgrounds&
+Clients::backgrounds() const
+{
+ return bgs;
+}
+
+
Clients::iterator
Clients::find(const string& name)
{
{
assert(find(name) == entries.end());
- entries.emplace_back(name);
+ entries.emplace_back(name, *this);
return --entries.end();
}
extern boost::shared_mutex big_mutex;
+class Backgrounds;
+class Clients;
+
struct NoComparison : Exception
{
void dispatch(DBus::Connection& conn, DBus::Message& msg);
- Client(const string& name);
+ Client(const string& name, const Clients& clients);
~Client();
list<Comparison*>::iterator find_comparison(Snapper* snapper, unsigned int number1,
void worker();
+ const Clients& clients;
+
};
class Clients
{
public:
+ Clients(Backgrounds& backgrounds);
typedef list<Client>::iterator iterator;
typedef list<Client>::const_iterator const_iterator;
bool has_zombies() const;
+ Backgrounds& backgrounds() const;
+
private:
list<Client> entries;
-};
-
+ Backgrounds& bgs;
-extern Clients clients;
+};
#endif
void periodic();
milliseconds periodic_timeout();
+private:
+
+ Backgrounds backgrounds;
+ Clients clients;
+
};
MyMainLoop::MyMainLoop(DBusBusType type)
- : MainLoop(type)
+ : MainLoop(type), backgrounds(), clients(backgrounds)
{
}