[ekiga] Use Ekiga::scoped_connections in the presence core
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Use Ekiga::scoped_connections in the presence core
- Date: Sat, 9 Feb 2013 22:51:54 +0000 (UTC)
commit 2ddd5e774ee6f37df36c58c368ff1c0e95f665f4
Author: Julien Puydt <jpuydt free fr>
Date: Sat Feb 9 23:07:36 2013 +0100
Use Ekiga::scoped_connections in the presence core
lib/engine/presence/presence-core.cpp | 26 ++++++++++----------------
lib/engine/presence/presence-core.h | 11 ++---------
2 files changed, 12 insertions(+), 25 deletions(-)
---
diff --git a/lib/engine/presence/presence-core.cpp b/lib/engine/presence/presence-core.cpp
index 93de347..61bda5d 100644
--- a/lib/engine/presence/presence-core.cpp
+++ b/lib/engine/presence/presence-core.cpp
@@ -44,13 +44,7 @@ Ekiga::PresenceCore::PresenceCore (Ekiga::ServiceCore& core)
boost::shared_ptr<Ekiga::PersonalDetails> details = core.get<Ekiga::PersonalDetails> ("personal-details");
if (details)
- conns.push_back (details->updated.connect (boost::bind (boost::bind (&Ekiga::PresenceCore::publish, this, _1), details)));
-}
-
-Ekiga::PresenceCore::~PresenceCore ()
-{
- for (std::list<boost::signals::connection>::iterator iter = conns.begin (); iter != conns.end (); ++iter)
- iter->disconnect ();
+ conns.add (details->updated.connect (boost::bind (boost::bind (&Ekiga::PresenceCore::publish, this, _1), details)));
}
void
@@ -58,13 +52,13 @@ Ekiga::PresenceCore::add_cluster (ClusterPtr cluster)
{
clusters.insert (cluster);
cluster_added (cluster);
- conns.push_back (cluster->updated.connect (boost::ref (updated)));
- conns.push_back (cluster->heap_added.connect (boost::bind (&Ekiga::PresenceCore::on_heap_added, this, _1, cluster)));
- conns.push_back (cluster->heap_updated.connect (boost::bind (&Ekiga::PresenceCore::on_heap_updated, this, _1, cluster)));
- conns.push_back (cluster->heap_removed.connect (boost::bind (&Ekiga::PresenceCore::on_heap_removed, this, _1, cluster)));
- conns.push_back (cluster->presentity_added.connect (boost::bind (&Ekiga::PresenceCore::on_presentity_added, this, _1, _2, cluster)));
- conns.push_back (cluster->presentity_updated.connect (boost::bind (&Ekiga::PresenceCore::on_presentity_updated, this, _1, _2, cluster)));
- conns.push_back (cluster->presentity_removed.connect (boost::bind (&Ekiga::PresenceCore::on_presentity_removed, this, _1, _2, cluster)));
+ conns.add (cluster->updated.connect (boost::ref (updated)));
+ conns.add (cluster->heap_added.connect (boost::bind (&Ekiga::PresenceCore::on_heap_added, this, _1, cluster)));
+ conns.add (cluster->heap_updated.connect (boost::bind (&Ekiga::PresenceCore::on_heap_updated, this, _1, cluster)));
+ conns.add (cluster->heap_removed.connect (boost::bind (&Ekiga::PresenceCore::on_heap_removed, this, _1, cluster)));
+ conns.add (cluster->presentity_added.connect (boost::bind (&Ekiga::PresenceCore::on_presentity_added, this, _1, _2, cluster)));
+ conns.add (cluster->presentity_updated.connect (boost::bind (&Ekiga::PresenceCore::on_presentity_updated, this, _1, _2, cluster)));
+ conns.add (cluster->presentity_removed.connect (boost::bind (&Ekiga::PresenceCore::on_presentity_removed, this, _1, _2, cluster)));
cluster->questions.connect (boost::ref (questions));
updated ();
@@ -165,8 +159,8 @@ void
Ekiga::PresenceCore::add_presence_fetcher (boost::shared_ptr<PresenceFetcher> fetcher)
{
presence_fetchers.push_back (fetcher);
- conns.push_back (fetcher->presence_received.connect (boost::bind (&Ekiga::PresenceCore::on_presence_received, this, _1, _2)));
- conns.push_back (fetcher->status_received.connect (boost::bind (&Ekiga::PresenceCore::on_status_received, this, _1, _2)));
+ conns.add (fetcher->presence_received.connect (boost::bind (&Ekiga::PresenceCore::on_presence_received, this, _1, _2)));
+ conns.add (fetcher->status_received.connect (boost::bind (&Ekiga::PresenceCore::on_status_received, this, _1, _2)));
for (std::map<std::string, uri_info>::const_iterator iter
= uri_infos.begin ();
iter != uri_infos.end ();
diff --git a/lib/engine/presence/presence-core.h b/lib/engine/presence/presence-core.h
index 2260642..3c70873 100644
--- a/lib/engine/presence/presence-core.h
+++ b/lib/engine/presence/presence-core.h
@@ -39,6 +39,7 @@
#define __PRESENCE_CORE_H__
#include "services.h"
+#include "scoped-connections.h"
#include "cluster.h"
#include "account-core.h"
@@ -74,10 +75,6 @@ namespace Ekiga
{
public:
- /** The destructor.
- */
- virtual ~PresenceFetcher () {}
-
/** Triggers presence fetching for the given uri
* (notice: the PresenceFetcher should count how many times it was
* requested presence for an uri, in case several presentities share it)
@@ -144,10 +141,6 @@ namespace Ekiga
*/
PresenceCore (ServiceCore& core);
- /** The destructor.
- */
- ~PresenceCore ();
-
/*** Service Implementation ***/
public:
/** Returns the name of the service.
@@ -321,7 +314,7 @@ namespace Ekiga
private:
- std::list<boost::signals::connection> conns;
+ Ekiga::scoped_connections conns;
};
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]