ekiga r5970 - in trunk: . lib/engine/addressbook/skel lib/engine/display/skel lib/engine/framework lib/engine/gui/gtk-frontend lib/engine/presence/avahi lib/engine/presence/skel lib/engine/protocol/skel



Author: jpuydt
Date: Fri Feb 15 20:06:35 2008
New Revision: 5970
URL: http://svn.gnome.org/viewvc/ekiga?rev=5970&view=rev

Log:
Better (can-stop) visitors


Modified:
   trunk/ChangeLog
   trunk/lib/engine/addressbook/skel/book-impl.h
   trunk/lib/engine/addressbook/skel/book.h
   trunk/lib/engine/addressbook/skel/contact-core.cpp
   trunk/lib/engine/addressbook/skel/contact-core.h
   trunk/lib/engine/addressbook/skel/source-impl.h
   trunk/lib/engine/addressbook/skel/source.h
   trunk/lib/engine/display/skel/display-core.cpp
   trunk/lib/engine/display/skel/display-core.h
   trunk/lib/engine/framework/lister.h
   trunk/lib/engine/gui/gtk-frontend/addressbook-window.cpp
   trunk/lib/engine/gui/gtk-frontend/book-view-gtk.cpp
   trunk/lib/engine/gui/gtk-frontend/chat-window-page.cpp
   trunk/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
   trunk/lib/engine/presence/avahi/avahi-cluster.cpp
   trunk/lib/engine/presence/avahi/avahi-cluster.h
   trunk/lib/engine/presence/skel/cluster-impl.h
   trunk/lib/engine/presence/skel/cluster.h
   trunk/lib/engine/presence/skel/heap-impl.h
   trunk/lib/engine/presence/skel/heap.h
   trunk/lib/engine/presence/skel/presence-core.cpp
   trunk/lib/engine/presence/skel/presence-core.h
   trunk/lib/engine/protocol/skel/call-core.cpp
   trunk/lib/engine/protocol/skel/call-core.h

Modified: trunk/lib/engine/addressbook/skel/book-impl.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/book-impl.h	(original)
+++ trunk/lib/engine/addressbook/skel/book-impl.h	Fri Feb 15 20:06:35 2008
@@ -94,7 +94,7 @@
     /** Visit all contacts of the book and trigger the given callback.
      * @param The callback.
      */
-    void visit_contacts (sigc::slot<void, Contact &> visitor);
+    void visit_contacts (sigc::slot<bool, Contact &> visitor);
 
   protected:
 
@@ -160,7 +160,7 @@
 
 template<typename ContactType>
 void
-Ekiga::BookImpl<ContactType>::visit_contacts (sigc::slot<void, Contact &> visitor)
+Ekiga::BookImpl<ContactType>::visit_contacts (sigc::slot<bool, Contact &> visitor)
 {
   Lister<ContactType>::visit_objects (visitor);
 }

Modified: trunk/lib/engine/addressbook/skel/book.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/book.h	(original)
+++ trunk/lib/engine/addressbook/skel/book.h	Fri Feb 15 20:06:35 2008
@@ -62,7 +62,7 @@
      * the descendant of the Ekiga::Book.
      * @param The callback.
      */
-    virtual void visit_contacts (sigc::slot<void, Contact &>) = 0;
+    virtual void visit_contacts (sigc::slot<bool, Contact &>) = 0;
 
 
     /** Create the menu for that book and its actions.

Modified: trunk/lib/engine/addressbook/skel/contact-core.cpp
==============================================================================
--- trunk/lib/engine/addressbook/skel/contact-core.cpp	(original)
+++ trunk/lib/engine/addressbook/skel/contact-core.cpp	Fri Feb 15 20:06:35 2008
@@ -87,12 +87,14 @@
 }
 
 void
-Ekiga::ContactCore::visit_sources (sigc::slot<void, Source &> visitor)
+Ekiga::ContactCore::visit_sources (sigc::slot<bool, Source &> visitor)
 {
+  bool go_on = true;
+
   for (std::set<Source *>::iterator iter = sources.begin ();
-       iter != sources.end ();
+       iter != sources.end () && go_on;
        iter++)
-    visitor (*(*iter));
+    go_on = visitor (*(*iter));
 }
 
 

Modified: trunk/lib/engine/addressbook/skel/contact-core.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/contact-core.h	(original)
+++ trunk/lib/engine/addressbook/skel/contact-core.h	Fri Feb 15 20:06:35 2008
@@ -107,7 +107,7 @@
      * ContactCore service.
      * @param The callback.
      */
-    void visit_sources (sigc::slot<void, Source &> visitor);
+    void visit_sources (sigc::slot<bool, Source &> visitor);
 
 
     /** This signal is emitted when a Ekiga::Source has been

Modified: trunk/lib/engine/addressbook/skel/source-impl.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/source-impl.h	(original)
+++ trunk/lib/engine/addressbook/skel/source-impl.h	Fri Feb 15 20:06:35 2008
@@ -102,7 +102,7 @@
     /** Visit all books of the source and trigger the given callback.
      * @param The callback.
      */
-    void visit_books (sigc::slot<void, Book &> visitor);
+    void visit_books (sigc::slot<bool, Book &> visitor);
 
   protected:
 
@@ -206,7 +206,7 @@
 
 template<typename BookType>
 void
-Ekiga::SourceImpl<BookType>::visit_books (sigc::slot<void, Book &> visitor)
+Ekiga::SourceImpl<BookType>::visit_books (sigc::slot<bool, Book &> visitor)
 {
   Lister<BookType>::visit_objects (visitor);
 }

Modified: trunk/lib/engine/addressbook/skel/source.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/source.h	(original)
+++ trunk/lib/engine/addressbook/skel/source.h	Fri Feb 15 20:06:35 2008
@@ -56,7 +56,7 @@
      * the descendant of the Ekiga::Source.
      * @param The callback.
      */
-    virtual void visit_books (sigc::slot<void, Book &>) = 0;
+    virtual void visit_books (sigc::slot<bool, Book &>) = 0;
 
 
     /** Create the menu for that source and its actions.

Modified: trunk/lib/engine/display/skel/display-core.cpp
==============================================================================
--- trunk/lib/engine/display/skel/display-core.cpp	(original)
+++ trunk/lib/engine/display/skel/display-core.cpp	Fri Feb 15 20:06:35 2008
@@ -68,12 +68,14 @@
 }
 
 
-void DisplayCore::visit_managers (sigc::slot<void, DisplayManager &> visitor)
+void DisplayCore::visit_managers (sigc::slot<bool, DisplayManager &> visitor)
 {
+  bool go_on = true;
+
   for (std::set<DisplayManager *>::iterator iter = managers.begin ();
-       iter != managers.end ();
+       iter != managers.end () && go_on;
        iter++)
-    visitor (*(*iter));
+    go_on = visitor (*(*iter));
 }
 
 

Modified: trunk/lib/engine/display/skel/display-core.h
==============================================================================
--- trunk/lib/engine/display/skel/display-core.h	(original)
+++ trunk/lib/engine/display/skel/display-core.h	Fri Feb 15 20:06:35 2008
@@ -98,7 +98,7 @@
       /** Triggers a callback for all Ekiga::DisplayManager sources of the
        * DisplayCore service.
        */
-      void visit_managers (sigc::slot<void, DisplayManager &> visitor);
+      void visit_managers (sigc::slot<bool, DisplayManager &> visitor);
 
       /** This signal is emitted when a Ekiga::DisplayManager has been
        * added to the DisplayCore Service.

Modified: trunk/lib/engine/framework/lister.h
==============================================================================
--- trunk/lib/engine/framework/lister.h	(original)
+++ trunk/lib/engine/framework/lister.h	Fri Feb 15 20:06:35 2008
@@ -87,7 +87,7 @@
 
     /** Allows listing all objects
      */
-    void visit_objects (sigc::slot<void, ObjectType &> visitor);
+    void visit_objects (sigc::slot<bool, ObjectType &> visitor);
 
     /** Returns a const iterator to the first object of the collection.
      */
@@ -197,10 +197,12 @@
 
 template<typename ObjectType>
 void
-Ekiga::Lister<ObjectType>::visit_objects (sigc::slot<void, ObjectType &> visitor)
+Ekiga::Lister<ObjectType>::visit_objects (sigc::slot<bool, ObjectType &> visitor)
 {
-  for (unsigned int ii = 0; ii < objects.size (); ii++)
-    visitor (*objects[ii]);
+  bool go_on = true;
+  for (unsigned int ii = 0;
+       ii < objects.size () && go_on; ii++)
+    go_on = visitor (*objects[ii]);
 }
 
 

Modified: trunk/lib/engine/gui/gtk-frontend/addressbook-window.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/addressbook-window.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/addressbook-window.cpp	Fri Feb 15 20:06:35 2008
@@ -103,7 +103,7 @@
  * BEHAVIOR     : 
  * PRE          : The given GtkWidget pointer must be an SearchBook GObject.
  */
-static void visit_books (Ekiga::Book &book,
+static bool visit_books (Ekiga::Book &book,
 			 Ekiga::Source *source,
 			 gpointer data);
 
@@ -258,11 +258,13 @@
 }
 
 
-static void visit_books (Ekiga::Book &book,
+static bool visit_books (Ekiga::Book &book,
 			 Ekiga::Source *source,
 			 gpointer data)
 {
   on_book_added (*source, book, data);
+
+  return true;
 }
 
 
@@ -745,8 +747,8 @@
   conn = core.questions.connect (sigc::bind (sigc::ptr_fun (on_handle_questions), (gpointer) self));
   self->priv->connections.push_back (conn);
 
-  core.visit_sources (sigc::bind (sigc::ptr_fun (on_source_added),
-                                  (gpointer) self));
+  core.visit_sources (sigc::bind_return (sigc::bind (sigc::ptr_fun (on_source_added),
+						     (gpointer) self), true));
 
   return GTK_WIDGET (self);
 }

Modified: trunk/lib/engine/gui/gtk-frontend/book-view-gtk.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/book-view-gtk.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/book-view-gtk.cpp	Fri Feb 15 20:06:35 2008
@@ -87,7 +87,7 @@
 
 void SignalCentralizer::repopulate (Ekiga::Book &book)
 {
-  book.visit_contacts (sigc::mem_fun (this, &SignalCentralizer::on_contact_added));
+  book.visit_contacts (sigc::bind_return (sigc::mem_fun (this, &SignalCentralizer::on_contact_added), true));
 }
 
 

Modified: trunk/lib/engine/gui/gtk-frontend/chat-window-page.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/chat-window-page.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/chat-window-page.cpp	Fri Feb 15 20:06:35 2008
@@ -160,7 +160,7 @@
  *                the monitored Ekiga::Heap to the list of active Heaps.
  * PRE          : The ChatWindowPage as last parameter.
  */
-static void on_heap_visited (Ekiga::Heap &heap,
+static bool on_heap_visited (Ekiga::Heap &heap,
                              Ekiga::Cluster *cluster,
                              gpointer data);
 
@@ -182,7 +182,7 @@
  *                Presentities.
  * PRE          : The ChatWindowPage as last parameter.
  */
-static void on_presentity_visited (Ekiga::Presentity &presentity,
+static bool on_presentity_visited (Ekiga::Presentity &presentity,
                                    Ekiga::Cluster *cluster,
                                    Ekiga::Heap *heap,
                                    gpointer data);
@@ -451,12 +451,14 @@
 }
 
 
-static void
+static bool
 on_heap_visited (Ekiga::Heap &heap,
                  Ekiga::Cluster *cluster,
                  gpointer data)
 {
   on_heap_added (*cluster, heap, data);
+
+  return true;
 }
 
 
@@ -469,13 +471,15 @@
 }
 
 
-static void
+static bool
 on_presentity_visited (Ekiga::Presentity &presentity,
                        Ekiga::Cluster *cluster,
                        Ekiga::Heap *heap,
                        gpointer data)
 {
   on_presentity_added (*cluster, *heap, presentity, data);
+
+  return true;
 }
 
 
@@ -873,7 +877,7 @@
   conn = presence_core->presentity_removed.connect (sigc::bind (sigc::ptr_fun (on_presentity_removed), (gpointer) self));
   self->priv->connections.push_back (conn);
 
-  presence_core->visit_clusters (sigc::bind (sigc::ptr_fun (on_cluster_added), (gpointer) self));
+  presence_core->visit_clusters (sigc::bind_return (sigc::bind (sigc::ptr_fun (on_cluster_added), (gpointer) self), true));
 
   return GTK_WIDGET (self);
 }

Modified: trunk/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp	Fri Feb 15 20:06:35 2008
@@ -153,7 +153,7 @@
  * BEHAVIOR     : Adds in the cluster heaps
  * PRE          : /
  */
-static void visit_heaps (Ekiga::Heap &heap,
+static bool visit_heaps (Ekiga::Heap &heap,
 			 Ekiga::Cluster *cluster,
 			 gpointer data);
 
@@ -190,7 +190,7 @@
  * BEHAVIOR     : Adds in the heap presentities
  * PRE          : /
  */
-static void visit_presentities (Ekiga::Presentity &presentity,
+static bool visit_presentities (Ekiga::Presentity &presentity,
 				Ekiga::Cluster *cluster,
 				Ekiga::Heap *heap,
 				gpointer data);
@@ -482,13 +482,15 @@
 				   &cluster, data));
 }
 
-static void
+static bool
 visit_heaps (Ekiga::Heap &heap,
 	     Ekiga::Cluster *cluster,
 	     gpointer data)
 {
   on_heap_updated (*cluster, heap, data);
   heap.visit_presentities (sigc::bind (sigc::ptr_fun (visit_presentities), cluster, &heap, data));
+
+  return true;
 }
 
 static void
@@ -533,13 +535,15 @@
 }
 
 
-static void
+static bool
 visit_presentities (Ekiga::Presentity &presentity,
 		    Ekiga::Cluster *cluster,
 		    Ekiga::Heap *heap,
 		    gpointer data)
 {
   on_presentity_added (*cluster, *heap, presentity, data);
+
+  return true;
 }
 
 static void
@@ -1061,8 +1065,8 @@
   conn = core.questions.add_handler (sigc::bind (sigc::ptr_fun (on_handle_questions), (gpointer) self));
   self->priv->connections.push_back (conn);
 
-  core.visit_clusters (sigc::bind (sigc::ptr_fun (on_cluster_added),
-				   (gpointer)self));
+  core.visit_clusters (sigc::bind_return (sigc::bind (sigc::ptr_fun (on_cluster_added),
+						      (gpointer)self), true));
 
   return (GtkWidget *) self;
 }

Modified: trunk/lib/engine/presence/avahi/avahi-cluster.cpp
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-cluster.cpp	(original)
+++ trunk/lib/engine/presence/avahi/avahi-cluster.cpp	Fri Feb 15 20:06:35 2008
@@ -52,9 +52,9 @@
 }
 
 void
-Avahi::Cluster::visit_heaps (sigc::slot<void, Heap &> visitor)
+Avahi::Cluster::visit_heaps (sigc::slot<bool, Heap &> visitor)
 {
-  visitor (*heap);
+  (void)visitor (*heap);
 }
 
 bool

Modified: trunk/lib/engine/presence/avahi/avahi-cluster.h
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-cluster.h	(original)
+++ trunk/lib/engine/presence/avahi/avahi-cluster.h	Fri Feb 15 20:06:35 2008
@@ -59,7 +59,7 @@
 
     ~Cluster ();
 
-    void visit_heaps (sigc::slot<void, Heap &> visitor);
+    void visit_heaps (sigc::slot<bool, Heap &> visitor);
 
     bool populate_menu (Ekiga::MenuBuilder &builder);
 

Modified: trunk/lib/engine/presence/skel/cluster-impl.h
==============================================================================
--- trunk/lib/engine/presence/skel/cluster-impl.h	(original)
+++ trunk/lib/engine/presence/skel/cluster-impl.h	Fri Feb 15 20:06:35 2008
@@ -81,7 +81,7 @@
 
     virtual ~ClusterImpl ();
 
-    void visit_heaps (sigc::slot<void, Heap &> visitor);
+    void visit_heaps (sigc::slot<bool, Heap &> visitor);
 
   protected:
 
@@ -124,7 +124,7 @@
 
 template<typename HeapType>
 void
-Ekiga::ClusterImpl<HeapType>::visit_heaps (sigc::slot<void, Heap &> visitor)
+Ekiga::ClusterImpl<HeapType>::visit_heaps (sigc::slot<bool, Heap &> visitor)
 {
   Lister<HeapType>::visit_objects (visitor);
 }

Modified: trunk/lib/engine/presence/skel/cluster.h
==============================================================================
--- trunk/lib/engine/presence/skel/cluster.h	(original)
+++ trunk/lib/engine/presence/skel/cluster.h	Fri Feb 15 20:06:35 2008
@@ -59,7 +59,7 @@
     /** Get the list of Heaps by visiting them with a callback.
      * @param The callback used to know about heaps.
      */
-    virtual void visit_heaps (sigc::slot<void, Heap &>) = 0;
+    virtual void visit_heaps (sigc::slot<bool, Heap &>) = 0;
 
     /** Populates a menu with the actions possible on the Cluster.
      * @param The builder to populate.

Modified: trunk/lib/engine/presence/skel/heap-impl.h
==============================================================================
--- trunk/lib/engine/presence/skel/heap-impl.h	(original)
+++ trunk/lib/engine/presence/skel/heap-impl.h	Fri Feb 15 20:06:35 2008
@@ -79,7 +79,7 @@
 
     ~HeapImpl ();
 
-    void visit_presentities (sigc::slot<void, Presentity &> visitor);
+    void visit_presentities (sigc::slot<bool, Presentity &> visitor);
 
     const_iterator begin () const;
 
@@ -120,7 +120,7 @@
 
 template<typename PresentityType>
 void
-Ekiga::HeapImpl<PresentityType>::visit_presentities (sigc::slot<void, Presentity &> visitor)
+Ekiga::HeapImpl<PresentityType>::visit_presentities (sigc::slot<bool, Presentity &> visitor)
 {
   Lister<PresentityType>::visit_objects (visitor);
 }

Modified: trunk/lib/engine/presence/skel/heap.h
==============================================================================
--- trunk/lib/engine/presence/skel/heap.h	(original)
+++ trunk/lib/engine/presence/skel/heap.h	Fri Feb 15 20:06:35 2008
@@ -65,7 +65,7 @@
     /** Get the list of Presentities by visiting them with a callback.
      * @param The callback user to know about presentities.
      */
-    virtual void visit_presentities (sigc::slot<void, Presentity &>) = 0;
+    virtual void visit_presentities (sigc::slot<bool, Presentity &>) = 0;
 
     /** Populates a menu with the actions possible on the Heap.
      * @param The builder to populate.

Modified: trunk/lib/engine/presence/skel/presence-core.cpp
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.cpp	(original)
+++ trunk/lib/engine/presence/skel/presence-core.cpp	Fri Feb 15 20:06:35 2008
@@ -102,12 +102,13 @@
 }
 
 void
-Ekiga::PresenceCore::visit_clusters (sigc::slot<void, Cluster &> visitor)
+Ekiga::PresenceCore::visit_clusters (sigc::slot<bool, Cluster &> visitor)
 {
+  bool go_on = true;
   for (std::set<Cluster *>::iterator iter = clusters.begin ();
-       iter != clusters.end ();
+       iter != clusters.end () && go_on;
        iter++)
-    visitor (*(*iter));
+    go_on = visitor (*(*iter));
 }
 
 bool

Modified: trunk/lib/engine/presence/skel/presence-core.h
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.h	(original)
+++ trunk/lib/engine/presence/skel/presence-core.h	Fri Feb 15 20:06:35 2008
@@ -179,7 +179,7 @@
      * PresenceCore service.
      * @param The callback.
      */
-    void visit_clusters (sigc::slot<void, Cluster &> visitor);
+    void visit_clusters (sigc::slot<bool, Cluster &> visitor);
 
     /** This signal is emitted when an Ekiga::Cluster has been added
      * to the PresenceCore Service.

Modified: trunk/lib/engine/protocol/skel/call-core.cpp
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.cpp	(original)
+++ trunk/lib/engine/protocol/skel/call-core.cpp	Fri Feb 15 20:06:35 2008
@@ -62,12 +62,14 @@
 }
 
 
-void CallCore::visit_managers (sigc::slot<void, CallManager &> visitor)
+void CallCore::visit_managers (sigc::slot<bool, CallManager &> visitor)
 {
+  bool go_on = true;
+
   for (std::set<CallManager *>::iterator iter = managers.begin ();
-       iter != managers.end ();
+       iter != managers.end () && go_on;
        iter++)
-    visitor (*(*iter));
+    go_on = visitor (*(*iter));
 }
 
 

Modified: trunk/lib/engine/protocol/skel/call-core.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.h	(original)
+++ trunk/lib/engine/protocol/skel/call-core.h	Fri Feb 15 20:06:35 2008
@@ -95,7 +95,7 @@
       /** Triggers a callback for all Ekiga::CallManager sources of the
        * CallCore service.
        */
-      void visit_managers (sigc::slot<void, CallManager &> visitor);
+      void visit_managers (sigc::slot<bool, CallManager &> visitor);
 
       /** This signal is emitted when a Ekiga::CallManager has been
        * added to the CallCore Service.



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