[ekiga] Use Ekiga::scoped_connections in the contact core



commit 8c184976c20ad5edd6a8c154f71f406fc1ca078c
Author: Julien Puydt <jpuydt free fr>
Date:   Sat Feb 9 23:07:17 2013 +0100

    Use Ekiga::scoped_connections in the contact core

 lib/engine/addressbook/contact-core.cpp |   20 +++++++-------------
 lib/engine/addressbook/contact-core.h   |    7 ++-----
 2 files changed, 9 insertions(+), 18 deletions(-)
---
diff --git a/lib/engine/addressbook/contact-core.cpp b/lib/engine/addressbook/contact-core.cpp
index 00eb282..3dc8e72 100644
--- a/lib/engine/addressbook/contact-core.cpp
+++ b/lib/engine/addressbook/contact-core.cpp
@@ -48,12 +48,6 @@ on_search ()
 }
 */
 
-Ekiga::ContactCore::~ContactCore ()
-{
-  for (std::list<boost::signals::connection>::iterator iter = conns.begin (); iter != conns.end (); ++iter)
-    iter->disconnect ();
-}
-
 bool
 Ekiga::ContactCore::populate_menu (MenuBuilder &builder)
 {
@@ -79,13 +73,13 @@ Ekiga::ContactCore::add_source (SourcePtr source)
 {
   sources.push_back (source);
   source_added (source);
-  conns.push_back (source->updated.connect (boost::ref (updated)));
-  conns.push_back (source->book_added.connect (boost::bind (boost::ref (book_added), source, _1)));
-  conns.push_back (source->book_removed.connect (boost::bind (boost::ref (book_removed), source, _1)));
-  conns.push_back (source->book_updated.connect (boost::bind (boost::ref (book_updated), source, _1)));
-  conns.push_back (source->contact_added.connect (boost::bind (boost::ref (contact_added), source, _1, _2)));
-  conns.push_back (source->contact_removed.connect (boost::bind (boost::ref (contact_removed), source, _1, _2)));
-  conns.push_back (source->contact_updated.connect (boost::bind (boost::ref (contact_updated), source, _1, _2)));
+  conns.add (source->updated.connect (boost::ref (updated)));
+  conns.add (source->book_added.connect (boost::bind (boost::ref (book_added), source, _1)));
+  conns.add (source->book_removed.connect (boost::bind (boost::ref (book_removed), source, _1)));
+  conns.add (source->book_updated.connect (boost::bind (boost::ref (book_updated), source, _1)));
+  conns.add (source->contact_added.connect (boost::bind (boost::ref (contact_added), source, _1, _2)));
+  conns.add (source->contact_removed.connect (boost::bind (boost::ref (contact_removed), source, _1, _2)));
+  conns.add (source->contact_updated.connect (boost::bind (boost::ref (contact_updated), source, _1, _2)));
   source->questions.connect (boost::ref (questions));
 
   updated ();
diff --git a/lib/engine/addressbook/contact-core.h b/lib/engine/addressbook/contact-core.h
index 4eab107..098bb03 100644
--- a/lib/engine/addressbook/contact-core.h
+++ b/lib/engine/addressbook/contact-core.h
@@ -38,6 +38,7 @@
 
 #include "services.h"
 #include "source.h"
+#include "scoped-connections.h"
 
 /* declaration of a few helper classes */
 namespace Ekiga
@@ -76,10 +77,6 @@ namespace Ekiga
     ContactCore ()
     {}
 
-    /** The destructor.
-     */
-    ~ContactCore ();
-
 
     /*** Service Implementation ***/
 
@@ -174,7 +171,7 @@ namespace Ekiga
     std::list<boost::shared_ptr<ContactDecorator> > contact_decorators;
 
     /*** Misc stuff ***/
-    std::list<boost::signals::connection> conns;
+    Ekiga::scoped_connections conns;
   };
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]