~ubuntu-branches/ubuntu/lucid/ardour/lucid-proposed

« back to all changes in this revision

Viewing changes to gtk2_ardour/actions.cc

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-07-29 11:27:04 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20080729112704-x1rmgb4tjotjyu5u
Tags: 1:2.5-0ubuntu1
* New upstream release.
* debian/patches/s390-FTBFS.patch: Dropped, as it fails to apply, and
  Ubuntu doesn't concern itself with s390.
* debian/control:
  - Fix package description, thanks to the patch in Debian bug #485892.
  - Metadata cleanup and sync control/control.in files.
  - Add libaubio-dev to Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
*/
19
19
 
 
20
#include <cstring>
20
21
#include <vector>
21
22
#include <string>
22
23
#include <list>
157
158
};
158
159
 
159
160
void
 
161
ActionManager::get_all_actions (vector<string>& groups, vector<string>& names, vector<AccelKey>& bindings)
 
162
{
 
163
        /* the C++ API for functions used here appears to be broken in
 
164
           gtkmm2.6, so we fall back to the C level.
 
165
        */
 
166
 
 
167
        GList* list = gtk_ui_manager_get_action_groups (ui_manager->gobj());
 
168
        GList* node;
 
169
        GList* acts;
 
170
 
 
171
        for (node = list; node; node = g_list_next (node)) {
 
172
                
 
173
                GtkActionGroup* group = (GtkActionGroup*) node->data;
 
174
                
 
175
                /* first pass: collect them all */
 
176
                
 
177
                typedef std::list<Glib::RefPtr<Gtk::Action> > action_list;
 
178
                action_list the_acts;
 
179
 
 
180
                for (acts = gtk_action_group_list_actions (group); acts; acts = g_list_next (acts)) {
 
181
                        GtkAction* action = (GtkAction*) acts->data;
 
182
                        the_acts.push_back (Glib::wrap (action, true));
 
183
                }
 
184
                
 
185
                /* now sort by label */
 
186
                
 
187
                SortActionsByLabel cmp;
 
188
                the_acts.sort (cmp);
 
189
 
 
190
                for (action_list::iterator a = the_acts.begin(); a != the_acts.end(); ++a) {
 
191
 
 
192
                        string accel_path = (*a)->get_accel_path ();
 
193
 
 
194
                        groups.push_back (gtk_action_group_get_name(group));
 
195
                        names.push_back (accel_path.substr (accel_path.find_last_of ('/') + 1));
 
196
                        
 
197
                        AccelKey key;
 
198
                        lookup_entry (accel_path, key);
 
199
                        bindings.push_back (AccelKey (key.get_key(), Gdk::ModifierType (key.get_mod())));
 
200
                }
 
201
        }
 
202
}
 
203
 
 
204
void
160
205
ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, vector<string>& keys, vector<AccelKey>& bindings)
161
206
{
162
207
        /* the C++ API for functions used here appears to be broken in
222
267
}
223
268
 
224
269
RefPtr<Action>
 
270
ActionManager::get_action (const char* path)
 
271
{
 
272
        GtkAction* _act;
 
273
        RefPtr<Action> act;
 
274
 
 
275
        if ((_act = gtk_ui_manager_get_action (ui_manager->gobj(), path)) != 0) {
 
276
                return Glib::wrap (_act, true);
 
277
        }
 
278
 
 
279
        return act;
 
280
}
 
281
 
 
282
RefPtr<Action>
225
283
ActionManager::get_action (const char* group_name, const char* action_name)
226
284
{
227
285
        /* the C++ API for functions used here appears to be broken in