summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext/actions.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-02-20 17:29:52 +0000
committerCarl Hetherington <carl@carlh.net>2011-02-20 17:29:52 +0000
commit2304a51b85830753e68450bde1d62686358fff09 (patch)
tree32f820bd544383010ebf3753352d926d487a7468 /libs/gtkmm2ext/actions.cc
parent150734ac619d7d602d47304f1496df71ce0c43ef (diff)
Use an action's tooltip in the key editor if its label is empty; add some tooltips so that Solo / Monitor actions are not blank in the key editor.
git-svn-id: svn://localhost/ardour2/branches/3.0@8909 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext/actions.cc')
-rw-r--r--libs/gtkmm2ext/actions.cc34
1 files changed, 30 insertions, 4 deletions
diff --git a/libs/gtkmm2ext/actions.cc b/libs/gtkmm2ext/actions.cc
index 43a2a24d2d..2bbb1520f1 100644
--- a/libs/gtkmm2ext/actions.cc
+++ b/libs/gtkmm2ext/actions.cc
@@ -83,6 +83,19 @@ ActionManager::register_radio_action (RefPtr<ActionGroup> group, RadioAction::Gr
}
RefPtr<Action>
+ActionManager::register_radio_action (
+ RefPtr<ActionGroup> group, RadioAction::Group& rgroup, string const & name, string const & label, string const & tooltip, slot<void> sl
+ )
+{
+ RefPtr<Action> act;
+
+ act = RadioAction::create (rgroup, name, label, tooltip);
+ group->add (act, sl);
+
+ return act;
+}
+
+RefPtr<Action>
ActionManager::register_toggle_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl)
{
RefPtr<Action> act;
@@ -93,6 +106,17 @@ ActionManager::register_toggle_action (RefPtr<ActionGroup> group, const char * n
return act;
}
+RefPtr<Action>
+ActionManager::register_toggle_action (RefPtr<ActionGroup> group, string const & name, string const & label, string const & tooltip, slot<void> sl)
+{
+ RefPtr<Action> act;
+
+ act = ToggleAction::create (name, label, tooltip);
+ group->add (act, sl);
+
+ return act;
+}
+
bool
ActionManager::lookup_entry (const ustring accel_path, Gtk::AccelKey& key)
{
@@ -117,7 +141,7 @@ struct SortActionsByLabel {
};
void
-ActionManager::get_all_actions (vector<string>& groups, vector<string>& names, vector<AccelKey>& bindings)
+ActionManager::get_all_actions (vector<string>& groups, vector<string>& names, vector<string>& tooltips, vector<AccelKey>& bindings)
{
/* the C++ API for functions used here appears to be broken in
gtkmm2.6, so we fall back to the C level.
@@ -152,6 +176,7 @@ ActionManager::get_all_actions (vector<string>& groups, vector<string>& names, v
groups.push_back (gtk_action_group_get_name(group));
names.push_back (accel_path.substr (accel_path.find_last_of ('/') + 1));
+ tooltips.push_back ((*a)->get_tooltip ());
AccelKey key;
lookup_entry (accel_path, key);
@@ -161,7 +186,7 @@ ActionManager::get_all_actions (vector<string>& groups, vector<string>& names, v
}
void
-ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, vector<string>& keys, vector<AccelKey>& bindings)
+ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, vector<string>& tooltips, vector<string>& keys, vector<AccelKey>& bindings)
{
/* the C++ API for functions used here appears to be broken in
gtkmm2.6, so we fall back to the C level.
@@ -192,11 +217,12 @@ ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, ve
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();
+ ustring const label = (*a)->property_label ();
+ string const accel_path = (*a)->get_accel_path ();
names.push_back (label);
paths.push_back (accel_path);
+ tooltips.push_back ((*a)->get_tooltip ());
AccelKey key;
keys.push_back (get_key_representation (accel_path, key));