[ekiga] Opal: Removed the CallCore ready signal. Implement it as a RefLister.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Opal: Removed the CallCore ready signal. Implement it as a RefLister.
- Date: Sun, 25 Jan 2015 16:40:06 +0000 (UTC)
commit 181aa63c0eea5246935b23f0aeb4b527123cf23d
Author: Damien Sandras <dsandras seconix com>
Date: Sun Jan 25 16:54:25 2015 +0100
Opal: Removed the CallCore ready signal. Implement it as a RefLister.
lib/engine/components/opal/opal-bank.cpp | 26 ++---------------
lib/engine/components/opal/opal-bank.h | 1 -
lib/engine/protocol/call-core.cpp | 45 ++++++++++-------------------
lib/engine/protocol/call-core.h | 16 +++-------
lib/engine/protocol/call-manager.h | 3 +-
plugins/avahi/avahi-publisher.cpp | 4 +-
6 files changed, 28 insertions(+), 67 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index a7cbe98..bec0855 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -55,7 +55,6 @@ Opal::Bank::Bank (Ekiga::ServiceCore& core,
#endif
Opal::Sip::EndPoint* _sip_endpoint):
presence_core(core.get<Ekiga::PresenceCore> ("presence-core")),
- call_core(core.get<Ekiga::CallCore> ("call-core")),
notification_core(core.get<Ekiga::NotificationCore> ("notification-core")),
personal_details(core.get<Ekiga::PersonalDetails> ("personal-details")),
audiooutput_core(core.get<Ekiga::AudioOutputCore> ("audiooutput-core")),
@@ -64,8 +63,6 @@ Opal::Bank::Bank (Ekiga::ServiceCore& core,
#endif
sip_endpoint(_sip_endpoint)
{
- is_ready = false;
-
std::list<std::string> accounts;
protocols_settings = new Ekiga::Settings (PROTOCOLS_SCHEMA);
@@ -121,16 +118,13 @@ Opal::Bank::Bank (Ekiga::ServiceCore& core,
boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
if (pcore)
pcore->add_presence_fetcher (account);
+ if (account->is_enabled ())
+ account->enable ();
}
}
// FIXME
sip_endpoint->mwi_event.connect (boost::bind(&Opal::Bank::on_mwi_event, this, _1, _2));
-
- // Enable accounts when the manager is ready
- boost::shared_ptr<Ekiga::CallCore> ccore = call_core.lock ();
- if (ccore)
- ccore->ready.connect (boost::bind (&Opal::Bank::set_ready, this));
}
@@ -291,25 +285,11 @@ Opal::Bank::add (Account::Type acc_type,
if (pcore)
pcore->add_presence_fetcher (account);
- if (is_ready && enabled)
+ if (enabled)
account->enable ();
}
-void
-Opal::Bank::set_ready ()
-{
- is_ready = true;
- for (iterator iter = begin ();
- iter != end ();
- ++iter) {
-
- if ((*iter)->is_enabled ())
- (*iter)->enable ();
- }
-}
-
-
Opal::AccountPtr
Opal::Bank::find_account (const std::string& _aor)
{
diff --git a/lib/engine/components/opal/opal-bank.h b/lib/engine/components/opal/opal-bank.h
index feb05ff..ab42e5e 100644
--- a/lib/engine/components/opal/opal-bank.h
+++ b/lib/engine/components/opal/opal-bank.h
@@ -136,7 +136,6 @@ private:
bool is_ready;
boost::weak_ptr<Ekiga::PresenceCore> presence_core;
- boost::weak_ptr<Ekiga::CallCore> call_core;
boost::shared_ptr<Ekiga::NotificationCore> notification_core;
boost::shared_ptr<Ekiga::PersonalDetails> personal_details;
boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core;
diff --git a/lib/engine/protocol/call-core.cpp b/lib/engine/protocol/call-core.cpp
index f28bd78..2e523d3 100644
--- a/lib/engine/protocol/call-core.cpp
+++ b/lib/engine/protocol/call-core.cpp
@@ -47,54 +47,52 @@ using namespace Ekiga;
CallCore::CallCore (boost::shared_ptr<Ekiga::FriendOrFoe> iff_): iff(iff_)
{
- nr_ready = 0;
}
void CallCore::add_manager (boost::shared_ptr<CallManager> manager)
{
- managers.insert (manager);
manager_added (manager);
- manager->ready.connect (boost::bind (&CallCore::on_manager_ready, this, manager));
+ add_object (manager);
}
void CallCore::remove_manager (boost::shared_ptr<CallManager> manager)
{
manager_removed (manager);
- managers.erase (manager);
+ remove_object (manager);
}
CallCore::iterator CallCore::begin ()
{
- return managers.begin ();
+ return RefLister<CallManager>::begin ();
}
CallCore::const_iterator CallCore::begin () const
{
- return managers.begin ();
+ return RefLister<CallManager>::begin ();
}
CallCore::iterator CallCore::end ()
{
- return managers.end ();
+ return RefLister<CallManager>::end ();
}
CallCore::const_iterator CallCore::end () const
{
- return managers.end ();
+ return RefLister<CallManager>::end ();
}
bool CallCore::dial (const std::string & uri)
{
- for (std::set<boost::shared_ptr<CallManager> >::iterator iter = managers.begin ();
- iter != managers.end ();
+ for (CallCore::iterator iter = begin ();
+ iter != end ();
iter++) {
if ((*iter)->dial (uri))
return true;
@@ -106,8 +104,8 @@ bool CallCore::dial (const std::string & uri)
void CallCore::hang_up ()
{
- for (std::set<boost::shared_ptr<CallManager> >::iterator iter = managers.begin ();
- iter != managers.end ();
+ for (CallCore::iterator iter = begin ();
+ iter != end ();
iter++)
(*iter)->hang_up ();
}
@@ -115,8 +113,8 @@ void CallCore::hang_up ()
bool CallCore::is_supported_uri (const std::string & uri)
{
- for (std::set<boost::shared_ptr<CallManager> >::iterator iter = managers.begin ();
- iter != managers.end ();
+ for (CallCore::iterator iter = begin ();
+ iter != end ();
iter++) {
if ((*iter)->is_supported_uri (uri))
return true;
@@ -130,8 +128,8 @@ Ekiga::CodecList
CallCore::get_codecs () const
{
Ekiga::CodecList codecs;
- for (std::set<boost::shared_ptr<CallManager> >::iterator iter = managers.begin ();
- iter != managers.end ();
+ for (CallCore::const_iterator iter = begin ();
+ iter != end ();
iter++) {
codecs.append ((*iter)->get_codecs ());
}
@@ -143,8 +141,8 @@ CallCore::get_codecs () const
void
CallCore::set_codecs (Ekiga::CodecList & codecs)
{
- for (std::set<boost::shared_ptr<CallManager> >::iterator iter = managers.begin ();
- iter != managers.end ();
+ for (CallCore::iterator iter = begin ();
+ iter != end ();
iter++) {
(*iter)->set_codecs (codecs);
}
@@ -188,17 +186,6 @@ void CallCore::remove_call (boost::shared_ptr<Call> call)
}
-void CallCore::on_manager_ready (boost::shared_ptr<CallManager> manager)
-{
- manager_ready (manager);
- nr_ready++;
-
- if (nr_ready >= managers.size ()) {
- ready ();
- }
-}
-
-
void CallCore::on_call_removed (boost::shared_ptr<Call> call)
{
remove_call (call);
diff --git a/lib/engine/protocol/call-core.h b/lib/engine/protocol/call-core.h
index c4fe66b..8815ba8 100644
--- a/lib/engine/protocol/call-core.h
+++ b/lib/engine/protocol/call-core.h
@@ -41,6 +41,7 @@
#include "chain-of-responsibility.h"
#include "services.h"
#include "scoped-connections.h"
+#include "reflister.h"
#include "friend-or-foe/friend-or-foe.h"
#include "call.h"
@@ -66,12 +67,13 @@ namespace Ekiga
class CallManager;
class CallCore:
- public Service
+ public Service,
+ protected RefLister<CallManager>
{
public:
- typedef std::set<boost::shared_ptr<CallManager> >::iterator iterator;
- typedef std::set<boost::shared_ptr<CallManager> >::const_iterator const_iterator;
+ typedef RefLister<CallManager>::iterator iterator;
+ typedef RefLister<CallManager>::const_iterator const_iterator;
/** The constructor
*/
@@ -179,24 +181,16 @@ namespace Ekiga
boost::signals2::signal<void(boost::shared_ptr<Call>, std::string, Call::StreamType)> stream_paused;
boost::signals2::signal<void(boost::shared_ptr<Call>, std::string, Call::StreamType)> stream_resumed;
- /*** Misc ***/
- boost::signals2::signal<void(boost::shared_ptr<CallManager>)> manager_ready;
- boost::signals2::signal<void(void)> ready;
-
/** This chain allows the CallCore to report errors to the user
*/
ChainOfResponsibility<std::string> errors;
private:
- void on_manager_ready (boost::shared_ptr<CallManager> manager);
-
void on_call_removed (boost::shared_ptr<Call> call);
boost::shared_ptr<Ekiga::FriendOrFoe> iff;
- std::set<boost::shared_ptr<CallManager> > managers;
std::map<std::string, boost::shared_ptr<Ekiga::scoped_connections> > call_connections;
- unsigned nr_ready;
};
/**
diff --git a/lib/engine/protocol/call-manager.h b/lib/engine/protocol/call-manager.h
index f69caeb..7dca8f4 100644
--- a/lib/engine/protocol/call-manager.h
+++ b/lib/engine/protocol/call-manager.h
@@ -56,7 +56,8 @@ namespace Ekiga
* @{
*/
- class CallManager
+ class CallManager :
+ public Ekiga::LiveObject
{
public:
diff --git a/plugins/avahi/avahi-publisher.cpp b/plugins/avahi/avahi-publisher.cpp
index f3c64d9..5545a1e 100644
--- a/plugins/avahi/avahi-publisher.cpp
+++ b/plugins/avahi/avahi-publisher.cpp
@@ -96,7 +96,7 @@ Avahi::PresencePublisher::publish (G_GNUC_UNUSED const Ekiga::PersonalDetails& d
AvahiStringList* txt_record = NULL;
txt_record = prepare_txt_record ();
- for (Ekiga::CallCore::const_iterator iter = call_core.begin ();
+ for (Ekiga::CallCore::iterator iter = call_core.begin ();
iter != call_core.end ();
++iter) {
@@ -240,7 +240,7 @@ Avahi::PresencePublisher::add_services ()
Ekiga::CallProtocolManager::InterfaceList interfaces;
AvahiStringList* txt_record = NULL;
- for (Ekiga::CallCore::const_iterator iter = call_core.begin ();
+ for (Ekiga::CallCore::iterator iter = call_core.begin ();
iter != call_core.end ();
++iter) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]