[ekiga] Presence: Migrated to DynamicObject/DynamicObjectStore.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Presence: Migrated to DynamicObject/DynamicObjectStore.
- Date: Thu, 12 Nov 2015 18:32:19 +0000 (UTC)
commit 63c5b60020b52a268f73d075b3c800324c30fc02
Author: Damien Sandras <dsandras seconix com>
Date: Sun May 31 14:52:19 2015 +0200
Presence: Migrated to DynamicObject/DynamicObjectStore.
We also make sure to "use" a DynamicObjectStore instead of purely
inheriting from that object.
lib/engine/presence/cluster-impl.h | 43 ++++++++++++++-----------------
lib/engine/presence/cluster.h | 4 +-
lib/engine/presence/heap-impl.h | 37 ++++++++++++---------------
lib/engine/presence/heap.h | 4 +--
lib/engine/presence/presence-core.cpp | 5 ---
lib/engine/presence/presence-core.h | 7 +++--
lib/engine/presence/presentity.h | 5 +---
lib/engine/presence/uri-presentity.cpp | 6 +++-
lib/engine/presence/uri-presentity.h | 3 +-
9 files changed, 49 insertions(+), 65 deletions(-)
---
diff --git a/lib/engine/presence/cluster-impl.h b/lib/engine/presence/cluster-impl.h
index 2942ab1..211b043 100644
--- a/lib/engine/presence/cluster-impl.h
+++ b/lib/engine/presence/cluster-impl.h
@@ -37,7 +37,7 @@
#include <vector>
-#include "reflister.h"
+#include "dynamic-object-store.h"
#include "cluster.h"
namespace Ekiga
@@ -65,15 +65,13 @@ namespace Ekiga
template<typename HeapType = Heap>
- class ClusterImpl:
- public Cluster,
- protected RefLister<HeapType>
+ class ClusterImpl: public Cluster
{
public:
- typedef typename RefLister<HeapType>::iterator iterator;
- typedef typename RefLister<HeapType>::const_iterator const_iterator;
+ typedef typename DynamicObjectStore<HeapType>::iterator iterator;
+ typedef typename DynamicObjectStore<HeapType>::const_iterator const_iterator;
ClusterImpl ();
@@ -87,13 +85,13 @@ namespace Ekiga
void remove_heap (boost::shared_ptr<HeapType> heap);
- using RefLister<HeapType>::add_connection;
-
iterator begin ();
iterator end ();
const_iterator begin () const;
const_iterator end () const;
+ DynamicObjectStore<HeapType> heaps;
+
private:
void common_removal_steps (boost::shared_ptr<HeapType> heap);
@@ -117,9 +115,9 @@ template<typename HeapType>
Ekiga::ClusterImpl<HeapType>::ClusterImpl ()
{
/* signal forwarding */
- RefLister<HeapType>::object_added.connect (boost::ref (heap_added));
- RefLister<HeapType>::object_removed.connect (boost::ref (heap_removed));
- RefLister<HeapType>::object_updated.connect (boost::ref (heap_updated));
+ heaps.object_added.connect (boost::ref (heap_added));
+ heaps.object_removed.connect (boost::ref (heap_removed));
+ heaps.object_updated.connect (boost::ref (heap_updated));
}
template<typename HeapType>
@@ -131,22 +129,19 @@ template<typename HeapType>
void
Ekiga::ClusterImpl<HeapType>::visit_heaps (boost::function1<bool, HeapPtr > visitor) const
{
- RefLister<HeapType>::visit_objects (visitor);
+ heaps.visit_objects (visitor);
}
template<typename HeapType>
void
Ekiga::ClusterImpl<HeapType>::add_heap (boost::shared_ptr<HeapType> heap)
{
- add_connection (heap, heap->presentity_added.connect (boost::bind (&ClusterImpl::on_presentity_added,
this, _1, heap)));
-
- add_connection (heap, heap->presentity_updated.connect (boost::bind (&ClusterImpl::on_presentity_updated,
this, _1, heap)));
-
- add_connection (heap, heap->presentity_removed.connect (boost::bind (&ClusterImpl::on_presentity_removed,
this, _1, heap)));
-
- add_connection (heap, heap->questions.connect (boost::ref (questions)));
+ heaps.add_connection (heap, heap->presentity_added.connect (boost::bind
(&ClusterImpl::on_presentity_added, this, _1, heap)));
+ heaps.add_connection (heap, heap->presentity_updated.connect (boost::bind
(&ClusterImpl::on_presentity_updated, this, _1, heap)));
+ heaps.add_connection (heap, heap->presentity_removed.connect (boost::bind
(&ClusterImpl::on_presentity_removed, this, _1, heap)));
+ heaps.add_connection (heap, heap->questions.connect (boost::ref (questions)));
- this->add_object (heap);
+ heaps.add_object (heap);
}
template<typename HeapType>
@@ -181,28 +176,28 @@ template<typename HeapType>
typename Ekiga::ClusterImpl<HeapType>::iterator
Ekiga::ClusterImpl<HeapType>::begin ()
{
- return RefLister<HeapType>::begin ();
+ return heaps.begin ();
}
template<typename HeapType>
typename Ekiga::ClusterImpl<HeapType>::const_iterator
Ekiga::ClusterImpl<HeapType>::begin () const
{
- return RefLister<HeapType>::begin ();
+ return heaps.begin ();
}
template<typename HeapType>
typename Ekiga::ClusterImpl<HeapType>::iterator
Ekiga::ClusterImpl<HeapType>::end ()
{
- return RefLister<HeapType>::end ();
+ return heaps.end ();
}
template<typename HeapType>
typename Ekiga::ClusterImpl<HeapType>::const_iterator
Ekiga::ClusterImpl<HeapType>::end () const
{
- return RefLister<HeapType>::end ();
+ return heaps.end ();
}
#endif
diff --git a/lib/engine/presence/cluster.h b/lib/engine/presence/cluster.h
index c56aff5..9aa3f0a 100644
--- a/lib/engine/presence/cluster.h
+++ b/lib/engine/presence/cluster.h
@@ -37,6 +37,7 @@
#define __CLUSTER_H__
#include "heap.h"
+#include "actor.h"
namespace Ekiga
{
@@ -46,8 +47,7 @@ namespace Ekiga
* @{
*/
- class Cluster:
- public virtual LiveObject
+ class Cluster: public virtual Actor
{
public:
diff --git a/lib/engine/presence/heap-impl.h b/lib/engine/presence/heap-impl.h
index 325c41b..f187943 100644
--- a/lib/engine/presence/heap-impl.h
+++ b/lib/engine/presence/heap-impl.h
@@ -36,7 +36,7 @@
#ifndef __HEAP_IMPL_H__
#define __HEAP_IMPL_H__
-#include "reflister.h"
+#include "dynamic-object-store.h"
#include "heap.h"
namespace Ekiga
@@ -63,15 +63,13 @@ namespace Ekiga
* backend.
*/
template<typename PresentityType = Presentity>
- class HeapImpl:
- public Heap,
- protected RefLister<PresentityType>
+ class HeapImpl: public Heap
{
public:
- typedef typename RefLister<PresentityType>::iterator iterator;
- typedef typename RefLister<PresentityType>::const_iterator const_iterator;
+ typedef typename DynamicObjectStore<PresentityType>::iterator iterator;
+ typedef typename DynamicObjectStore<PresentityType>::const_iterator const_iterator;
HeapImpl ();
@@ -87,9 +85,9 @@ namespace Ekiga
iterator end ();
- protected:
+ DynamicObjectStore<PresentityType> presentities;
- using RefLister<PresentityType>::add_connection;
+ protected:
void add_presentity (boost::shared_ptr<PresentityType> presentity);
@@ -107,9 +105,9 @@ template<typename PresentityType>
Ekiga::HeapImpl<PresentityType>::HeapImpl ()
{
/* this is signal forwarding */
- RefLister<PresentityType>::object_added.connect (boost::ref (presentity_added));
- RefLister<PresentityType>::object_removed.connect (boost::ref (presentity_removed));
- RefLister<PresentityType>::object_updated.connect (boost::ref (presentity_updated));
+ presentities.object_added.connect (boost::ref (presentity_added));
+ presentities.object_removed.connect (boost::ref (presentity_removed));
+ presentities.object_updated.connect (boost::ref (presentity_updated));
}
@@ -122,51 +120,50 @@ template<typename PresentityType>
void
Ekiga::HeapImpl<PresentityType>::visit_presentities (boost::function1<bool, PresentityPtr > visitor) const
{
- RefLister<PresentityType>::visit_objects (visitor);
+ presentities.visit_objects (visitor);
}
template<typename PresentityType>
typename Ekiga::HeapImpl<PresentityType>::iterator
Ekiga::HeapImpl<PresentityType>::begin ()
{
- return RefLister<PresentityType>::begin ();
+ return presentities.begin ();
}
template<typename PresentityType>
typename Ekiga::HeapImpl<PresentityType>::iterator
Ekiga::HeapImpl<PresentityType>::end ()
{
- return RefLister<PresentityType>::end ();
+ return presentities.end ();
}
template<typename PresentityType>
typename Ekiga::HeapImpl<PresentityType>::const_iterator
Ekiga::HeapImpl<PresentityType>::begin () const
{
- return RefLister<PresentityType>::begin ();
+ return presentities.begin ();
}
template<typename PresentityType>
typename Ekiga::HeapImpl<PresentityType>::const_iterator
Ekiga::HeapImpl<PresentityType>::end () const
{
- return RefLister<PresentityType>::end ();
+ return presentities.end ();
}
template<typename PresentityType>
void
Ekiga::HeapImpl<PresentityType>::add_presentity (boost::shared_ptr<PresentityType> presentity)
{
- presentity->questions.connect (boost::ref (questions));
-
- this->add_object (presentity);
+ presentity->questions.connect (boost::ref (Ekiga::Actor::questions));
+ presentities.add_object (presentity);
}
template<typename PresentityType>
void
Ekiga::HeapImpl<PresentityType>::remove_presentity (boost::shared_ptr<PresentityType> presentity)
{
- this->remove_object (presentity);
+ presentities.remove_object (presentity);
}
#endif
diff --git a/lib/engine/presence/heap.h b/lib/engine/presence/heap.h
index f228c55..a51ec28 100644
--- a/lib/engine/presence/heap.h
+++ b/lib/engine/presence/heap.h
@@ -47,9 +47,7 @@ namespace Ekiga
* @{
*/
- class Heap:
- public virtual LiveObject,
- public Actor
+ class Heap: public virtual Actor
{
public:
diff --git a/lib/engine/presence/presence-core.cpp b/lib/engine/presence/presence-core.cpp
index 8fd85ca..8ae32bf 100644
--- a/lib/engine/presence/presence-core.cpp
+++ b/lib/engine/presence/presence-core.cpp
@@ -48,7 +48,6 @@ Ekiga::PresenceCore::add_cluster (ClusterPtr cluster)
{
clusters.insert (cluster);
cluster_added (cluster);
- conns.add (cluster->updated.connect (boost::ref (updated)));
conns.add (cluster->heap_added.connect (boost::bind (boost::ref (heap_added), _1)));
conns.add (cluster->heap_updated.connect (boost::bind (boost::ref (heap_updated), _1)));
conns.add (cluster->heap_removed.connect (boost::bind (boost::ref (heap_removed), _1)));
@@ -56,8 +55,6 @@ Ekiga::PresenceCore::add_cluster (ClusterPtr cluster)
conns.add (cluster->presentity_updated.connect (boost::bind (boost::ref (presentity_updated), _1, _2)));
conns.add (cluster->presentity_removed.connect (boost::bind (boost::ref (presentity_removed), _1, _2)));
cluster->questions.connect (boost::ref (questions));
-
- updated ();
}
void
@@ -65,8 +62,6 @@ Ekiga::PresenceCore::remove_cluster (ClusterPtr cluster)
{
cluster_removed (cluster);
clusters.erase (cluster);
-
- updated ();
}
void
diff --git a/lib/engine/presence/presence-core.h b/lib/engine/presence/presence-core.h
index e912db1..d3b5bfd 100644
--- a/lib/engine/presence/presence-core.h
+++ b/lib/engine/presence/presence-core.h
@@ -116,7 +116,6 @@ namespace Ekiga
* special registering magic?
*/
class PresenceCore:
- public virtual LiveObject,
public URIActionProviderStore,
public Service
{
@@ -226,6 +225,10 @@ namespace Ekiga
boost::signals2::signal<void(std::string, std::string)> presence_received;
boost::signals2::signal<void(std::string, std::string)> status_received;
+ /** This chain allows the core to present forms to the user
+ */
+ ChainOfResponsibility<FormRequestPtr> questions;
+
private:
std::list<boost::shared_ptr<PresenceFetcher> > presence_fetchers;
@@ -256,8 +259,6 @@ namespace Ekiga
std::list<boost::shared_ptr<PresencePublisher> > presence_publishers;
void publish ();
- /*** LiveObject implementation ***/
-
public:
/*** Misc ***/
diff --git a/lib/engine/presence/presentity.h b/lib/engine/presence/presentity.h
index 1912452..fa6bace 100644
--- a/lib/engine/presence/presentity.h
+++ b/lib/engine/presence/presentity.h
@@ -38,7 +38,6 @@
#include <set>
#include <string>
-#include "live-object.h"
#include "actor.h"
namespace Ekiga
@@ -51,9 +50,7 @@ namespace Ekiga
/** A presentity is a piece of presence information for a single URI.
*/
- class Presentity:
- public Actor,
- public virtual LiveObject
+ class Presentity: public virtual Actor
{
public:
diff --git a/lib/engine/presence/uri-presentity.cpp b/lib/engine/presence/uri-presentity.cpp
index d31c577..d721760 100644
--- a/lib/engine/presence/uri-presentity.cpp
+++ b/lib/engine/presence/uri-presentity.cpp
@@ -111,7 +111,8 @@ Ekiga::URIPresentity::on_presence_received (std::string uri_,
if (uri == uri_) {
presence = presence_;
- updated ();
+ //updated ();
+ std::cout << "FIXME: Updated" << std::endl;
}
}
@@ -122,6 +123,7 @@ Ekiga::URIPresentity::on_status_received (std::string uri_,
if (uri == uri_) {
status = status_;
- updated ();
+ //updated ();
+ std::cout << "FIXME: Updated" << std::endl;
}
}
diff --git a/lib/engine/presence/uri-presentity.h b/lib/engine/presence/uri-presentity.h
index c69870a..712b71d 100644
--- a/lib/engine/presence/uri-presentity.h
+++ b/lib/engine/presence/uri-presentity.h
@@ -58,8 +58,7 @@ namespace Ekiga
/**
* This class implements an Ekiga::Presentity.
*/
- class URIPresentity:
- public Ekiga::Presentity
+ class URIPresentity: public Ekiga::Presentity
{
public:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]