[ekiga/ds-gtk-application] Actor: Add a list of actions names to remember insertion order.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-gtk-application] Actor: Add a list of actions names to remember insertion order.
- Date: Sun, 30 Mar 2014 17:50:13 +0000 (UTC)
commit c6c77353ba010eac46326ffb7cad5bdee92bddb0
Author: Damien Sandras <dsandras beip be>
Date: Sun Mar 30 19:42:34 2014 +0200
Actor: Add a list of actions names to remember insertion order.
This will allow ordering menus following insertion order instead of
relying on the keys orders of the ActionMap.
However, we keep the ActionMap for performance reasons.
lib/engine/framework/actor.cpp | 1 +
lib/engine/framework/actor.h | 1 +
lib/engine/gui/gtk-core/actor-menu.cpp | 6 ++++--
3 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/lib/engine/framework/actor.cpp b/lib/engine/framework/actor.cpp
index 3988c04..61cec3d 100644
--- a/lib/engine/framework/actor.cpp
+++ b/lib/engine/framework/actor.cpp
@@ -44,6 +44,7 @@ void
Actor::add_action (ActionPtr action)
{
actions.insert (std::make_pair (action->get_name (), action));
+ action_names.push_back (action->get_name ());
}
diff --git a/lib/engine/framework/actor.h b/lib/engine/framework/actor.h
index 9ee0ebd..ada1cb8 100644
--- a/lib/engine/framework/actor.h
+++ b/lib/engine/framework/actor.h
@@ -99,6 +99,7 @@ namespace Ekiga {
boost::signals2::signal<void(const std::string &)> action_disabled;
ActionMap actions;
+ std::list<std::string> action_names;
};
/**
diff --git a/lib/engine/gui/gtk-core/actor-menu.cpp b/lib/engine/gui/gtk-core/actor-menu.cpp
index 90097c5..50fa12a 100644
--- a/lib/engine/gui/gtk-core/actor-menu.cpp
+++ b/lib/engine/gui/gtk-core/actor-menu.cpp
@@ -180,6 +180,7 @@ const std::string
Ekiga::ActorMenu::as_xml (const std::string & id)
{
ActionMap::const_iterator it;
+ std::list<std::string>::const_iterator nit;
std::string xml_content;
n = 0;
@@ -188,9 +189,10 @@ Ekiga::ActorMenu::as_xml (const std::string & id)
else
xml_content += " <section>";
- for (it = obj.actions.begin(); it != obj.actions.end(); ++it) {
+ for (nit = obj.action_names.begin(); nit != obj.action_names.end(); ++nit) {
- if (it->second->is_enabled ()) {
+ it = obj.actions.find (*nit);
+ if (it != obj.actions.end () && it->second->is_enabled ()) {
xml_content +=
" <item>"
" <attribute name=\"label\" translatable=\"yes\">"+it->second->get_description
()+"</attribute>"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]