[ekiga/ds-gtk-application] CallCore: Added dynamic call/transfer actions.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-gtk-application] CallCore: Added dynamic call/transfer actions.
- Date: Sun, 16 Mar 2014 16:53:04 +0000 (UTC)
commit cfd1af18c7b422bc25fa451e57fcdfe3c0406e9d
Author: Damien Sandras <dsandras beip be>
Date: Sun Mar 16 17:49:28 2014 +0100
CallCore: Added dynamic call/transfer actions.
The call action is disabled as soon as we are in a call (we only support
one call at a time).
The transfer action is added as soon as we are in a call (all our call
managers do support, and must support transfer).
lib/engine/protocol/call-core.cpp | 45 +++++++++++++++++++++++++-----------
lib/engine/protocol/call-core.h | 1 +
2 files changed, 32 insertions(+), 14 deletions(-)
---
diff --git a/lib/engine/protocol/call-core.cpp b/lib/engine/protocol/call-core.cpp
index 30947dd..1221ba6 100644
--- a/lib/engine/protocol/call-core.cpp
+++ b/lib/engine/protocol/call-core.cpp
@@ -149,26 +149,28 @@ bool CallCore::is_supported_uri (const std::string & uri)
}
-void CallCore::register_actions (boost::shared_ptr<ContactCore> ccore)
+void CallCore::register_actions (boost::shared_ptr<ContactCore> _contact_core)
{
- ccore->add_action (ActionPtr (
- new ContactAction ("call", _("Call"),
- boost::bind (&CallCore::dial,
- this, _2),
- boost::bind (&CallCore::is_supported_uri,
- this, _2))));
-
- ccore->add_action (ActionPtr (
- new ContactAction ("message", _("Message"),
- boost::bind (&CallCore::message,
- this, _1, _2),
- boost::bind (&CallCore::is_supported_uri,
- this, _2))));
+ contact_core = _contact_core;
+ contact_core->add_action (ActionPtr (
+ new ContactAction ("call", _("Call"),
+ boost::bind (&CallCore::dial,
+ this, _2),
+ boost::bind (&CallCore::is_supported_uri,
+ this, _2))));
+
+ contact_core->add_action (ActionPtr (
+ new ContactAction ("message", _("Message"),
+ boost::bind (&CallCore::message,
+ this, _1, _2),
+ boost::bind (&CallCore::is_supported_uri,
+ this, _2))));
}
void CallCore::add_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager)
{
+ contact_core->remove_action ("call");
boost::shared_ptr<Ekiga::scoped_connections> conns(new Ekiga::scoped_connections);
conns->add (call->ringing.connect (boost::bind (&CallCore::on_ringing_call, this,
@@ -196,12 +198,27 @@ void CallCore::add_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallMan
conns->add (call->removed.connect (boost::bind (&CallCore::on_call_removed, this, call)));
call_connections [call->get_id ()] = conns;
+ contact_core->add_action (ActionPtr (
+ new ContactAction ("transfer", _("Transfer"),
+ boost::bind (&CallCore::transfer,
+ this, _2, false),
+ boost::bind (&CallCore::is_supported_uri,
+ this, _2))));
}
void CallCore::remove_call (boost::shared_ptr<Call> call)
{
+ contact_core->remove_action ("transfer");
+
call_connections.erase (call->get_id ());
+
+ contact_core->add_action (ActionPtr (
+ new ContactAction ("call", _("Call"),
+ boost::bind (&CallCore::dial,
+ this, _2),
+ boost::bind (&CallCore::is_supported_uri,
+ this, _2))));
}
diff --git a/lib/engine/protocol/call-core.h b/lib/engine/protocol/call-core.h
index 1816dd0..eb6bab2 100644
--- a/lib/engine/protocol/call-core.h
+++ b/lib/engine/protocol/call-core.h
@@ -223,6 +223,7 @@ namespace Ekiga
std::set<boost::shared_ptr<CallManager> > managers;
std::map<std::string, boost::shared_ptr<Ekiga::scoped_connections> > call_connections;
unsigned nr_ready;
+ boost::shared_ptr<ContactCore> contact_core;
};
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]