summaryrefslogtreecommitdiff
path: root/gtk2_ardour/actions.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-10 21:20:59 +0000
committerDavid Robillard <d@drobilla.net>2008-01-10 21:20:59 +0000
commitbb457bb960c5bd7ed538f9d31477293415739f68 (patch)
tree84324a63b87c03589cd165b9e474296eaebb4772 /gtk2_ardour/actions.cc
parent73dd9d37e7d715e0d78c0e51569968f9494dac7f (diff)
Merge libs/ardour and gtk2_ardour with 2.0-ongoing R2837.
git-svn-id: svn://localhost/ardour2/trunk@2883 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/actions.cc')
-rw-r--r--gtk2_ardour/actions.cc32
1 files changed, 26 insertions, 6 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc
index 023520c17e..1484c01454 100644
--- a/gtk2_ardour/actions.cc
+++ b/gtk2_ardour/actions.cc
@@ -19,6 +19,7 @@
#include <vector>
#include <string>
+#include <list>
#include <gtk/gtkaccelmap.h>
#include <gtk/gtkuimanager.h>
@@ -150,6 +151,14 @@ ActionManager::lookup_entry (const ustring accel_path, Gtk::AccelKey& key)
return known;
}
+struct SortActionsByLabel {
+ bool operator() (Glib::RefPtr<Gtk::Action> a, Glib::RefPtr<Gtk::Action> b) {
+ ustring astr = a->get_accel_path();
+ ustring bstr = b->get_accel_path();
+ return astr < bstr;
+ }
+};
+
void
ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, vector<string>& keys, vector<AccelKey>& bindings)
{
@@ -162,18 +171,29 @@ ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, ve
GList* acts;
for (node = list; node; node = g_list_next (node)) {
-
+
GtkActionGroup* group = (GtkActionGroup*) node->data;
+
+ /* first pass: collect them all */
+
+ typedef std::list<Glib::RefPtr<Gtk::Action> > action_list;
+ action_list the_acts;
for (acts = gtk_action_group_list_actions (group); acts; acts = g_list_next (acts)) {
-
GtkAction* action = (GtkAction*) acts->data;
+ the_acts.push_back (Glib::wrap (action, true));
+ }
+
+ /* now sort by label */
+
+ SortActionsByLabel cmp;
+ the_acts.sort (cmp);
- Glib::RefPtr<Action> act = Glib::wrap (action, true);
+ for (action_list::iterator a = the_acts.begin(); a != the_acts.end(); ++a) {
+
+ string accel_path = (*a)->get_accel_path ();
+ ustring label = (*a)->property_label();
- string accel_path = act->get_accel_path ();
- ustring label = act->property_label();
-
names.push_back (label);
paths.push_back (accel_path);