[ekiga] Action: Improved API.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Action: Improved API.
- Date: Mon, 5 Jan 2015 18:53:11 +0000 (UTC)
commit 2ca116f029d1ac9f45882813bc33aaf37b67ed66
Author: Damien Sandras <dsandras seconix com>
Date: Mon Jan 5 19:43:38 2015 +0100
Action: Improved API.
- Removed useless on_activated () method.
- Moved enable_action and disable_action under the protected section so
that only friend classes like Actor can enable/disable actions.
lib/engine/action/action.cpp | 11 ++---------
lib/engine/action/action.h | 22 ++++++++--------------
2 files changed, 10 insertions(+), 23 deletions(-)
---
diff --git a/lib/engine/action/action.cpp b/lib/engine/action/action.cpp
index 9c44127..97ad0d2 100644
--- a/lib/engine/action/action.cpp
+++ b/lib/engine/action/action.cpp
@@ -45,7 +45,8 @@ Action::Action (const std::string & _name,
boost::function0<void> _callback,
bool _enabled) : name (_name), description (_description), callback (_callback),
action_enabled (_enabled)
{
- conns.add (activated.connect (boost::bind (&Action::on_activated, this)));
+ if (!callback.empty ())
+ conns.add (activated.connect (boost::cref (callback)));
}
@@ -97,11 +98,3 @@ Action::is_enabled () const
{
return action_enabled;
}
-
-
-void
-Action::on_activated ()
-{
- if (!callback.empty ())
- callback ();
-}
diff --git a/lib/engine/action/action.h b/lib/engine/action/action.h
index 05c26ea..019002a 100644
--- a/lib/engine/action/action.h
+++ b/lib/engine/action/action.h
@@ -128,6 +128,14 @@ namespace Ekiga {
void activate ();
+ /** Return the Action state.
+ * @return true if the Action is enabled, false otherwise.
+ */
+ bool is_enabled () const;
+
+
+ protected:
+
/** Enable the Action.
* This will enable the action. Only enabled actions are usable
* and appear in menus.
@@ -142,13 +150,6 @@ namespace Ekiga {
void disable ();
- /** Return the Action state.
- * @return true if the Action is enabled, false otherwise.
- */
- bool is_enabled () const;
-
-
- protected:
std::string name;
std::string description;
@@ -163,12 +164,6 @@ namespace Ekiga {
private:
- /** Internal callback executed when the Action activated signal is emitted.
- * It basically calls the callback.
- */
- virtual void on_activated ();
-
-
/** This signal is emitted when the Action is activated. This triggers
* the signal execution.
*/
@@ -178,7 +173,6 @@ namespace Ekiga {
};
typedef boost::shared_ptr< Action > ActionPtr;
- typedef std::list< ActionPtr > ActionStore;
/**
* @}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]