add ActionManager::get_actions() to fetch all actions created in ActionGroups with a given "owner" value
This commit is contained in:
parent
5981b7f1b8
commit
e1b7a43139
@ -473,6 +473,21 @@ ActionManager::register_toggle_action (RefPtr<ActionGroup> group,
|
||||
return RefPtr<Action>();
|
||||
}
|
||||
|
||||
void
|
||||
ActionManager::get_actions (void* owner, std::vector<Glib::RefPtr<Gtk::Action> >& acts)
|
||||
{
|
||||
for (ActionMap::const_iterator a = actions.begin(); a != actions.end(); ++a) {
|
||||
if (owner) {
|
||||
Glib::RefPtr<Gtk::ActionGroup> group = a->second->property_action_group ();
|
||||
if (group->get_data (X_("owner")) == owner) {
|
||||
acts.push_back (a->second);
|
||||
}
|
||||
} else {
|
||||
acts.push_back (a->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ActionManager::get_all_actions (std::vector<std::string>& paths,
|
||||
std::vector<std::string>& labels,
|
||||
|
@ -1014,14 +1014,12 @@ Bindings::get_all_actions (std::vector<std::string>& paths,
|
||||
rmap.insert (make_pair (k->second.action, k->first));
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* get a list of all actions XXX relevant for these bindings */
|
||||
|
||||
ActionMap::Actions all_actions;
|
||||
ActionManager::get_actions (all_actions);
|
||||
std::vector<Glib::RefPtr<Action> > relevant_actions;
|
||||
ActionManager::get_actions (this, relevant_actions);
|
||||
|
||||
for (ActionMap::Actions::const_iterator act = all_actions.begin(); act != all_actions.end(); ++act) {
|
||||
for (vector<Glib::RefPtr<Action> >::const_iterator act = relevant_actions.begin(); act != relevant_actions.end(); ++act) {
|
||||
|
||||
paths.push_back ((*act)->get_accel_path());
|
||||
labels.push_back ((*act)->get_label());
|
||||
@ -1037,7 +1035,6 @@ Bindings::get_all_actions (std::vector<std::string>& paths,
|
||||
|
||||
actions.push_back (*act);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Bindings*
|
||||
|
@ -94,6 +94,7 @@ namespace ActionManager {
|
||||
LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::RadioAction> get_radio_action (const std::string& name, bool or_die = true);
|
||||
LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::RadioAction> get_radio_action (char const * group_name, char const * action_name, bool or_die = true);
|
||||
|
||||
LIBGTKMM2EXT_API extern void get_actions (void* owner, std::vector<Glib::RefPtr<Gtk::Action> >&);
|
||||
|
||||
LIBGTKMM2EXT_API extern void get_all_actions (std::vector<std::string>& paths,
|
||||
std::vector<std::string>& labels,
|
||||
|
Loading…
Reference in New Issue
Block a user