summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext/gtk_ui.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-11-24 05:36:31 +0000
committerDavid Robillard <d@drobilla.net>2011-11-24 05:36:31 +0000
commit0a71d52448f6144d5225269b378711bfba0bb37b (patch)
treed40c810164b7c6d85c80e006a08d9459564ed6fb /libs/gtkmm2ext/gtk_ui.cc
parent0bd3105f50f3c82586e0924a4be9977425caaf90 (diff)
Fix key bindings in tooltips for ArdourButton buttons.
Sinced gtkmm2ext needs to get at the actions of widgets, I moved the action to Gtkmm2ext::Activatable. Not sure if the wisest thing to do here would be to use Gtkmm::Activatable, but figured there's a reason Paul didn't do so (the name set_related_action is from there so presumably it's known about), so this is the simplest change that allows access to the action in Gtkmm2ext. The vfunc calling stuff should probably move there as well... git-svn-id: svn://localhost/ardour2/branches/3.0@10818 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext/gtk_ui.cc')
-rw-r--r--libs/gtkmm2ext/gtk_ui.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc
index 35517e9604..f45fab6788 100644
--- a/libs/gtkmm2ext/gtk_ui.cc
+++ b/libs/gtkmm2ext/gtk_ui.cc
@@ -40,6 +40,7 @@
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/window_title.h>
#include <gtkmm2ext/actions.h>
+#include <gtkmm2ext/activatable.h>
#include "i18n.h"
@@ -340,15 +341,23 @@ UI::set_tip (Widget *w, const gchar *tip, const gchar *hlp)
std::string msg(tip);
Glib::RefPtr<Gtk::Action> action = w->get_action();
+
+ if (!action) {
+ Gtkmm2ext::Activatable* activatable;
+ if ((activatable = dynamic_cast<Gtkmm2ext::Activatable*>(w))) {
+ action = activatable->get_related_action();
+ }
+ }
+
if (action) {
Gtk::AccelKey key;
- ustring ap = action->get_accel_path();
- if (!ap.empty()) {
- bool has_key = ActionManager::lookup_entry(ap, key);
- if (has_key && key.get_abbrev() != "") {
- msg.append("\n\n Key: ").append(key.get_abbrev());
- }
- }
+ ustring ap = action->get_accel_path();
+ if (!ap.empty()) {
+ bool has_key = ActionManager::lookup_entry(ap, key);
+ if (has_key && key.get_abbrev() != "") {
+ msg.append("\n\nKey: ").append(key.get_abbrev());
+ }
+ }
}
if (req == 0) {