add new variant of ActionMap::find_action()
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 5 Dec 2018 20:22:48 +0000 (15:22 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 5 Dec 2018 22:33:05 +0000 (17:33 -0500)
This is more useful when replacing ActionManager::get_action

libs/gtkmm2ext/bindings.cc
libs/gtkmm2ext/gtkmm2ext/bindings.h

index 9d61847a0ea9d4ae7204758585bfeebf12727f80..b1abcb0507f0cafc55d1d8107bfb2a0c0938c4f5 100644 (file)
@@ -1183,6 +1183,26 @@ ActionMap::find_action (const string& name)
                return a->second;
        }
 
+       cerr << "Failed to find action: [" << name << ']' << endl;
+       return RefPtr<Action>();
+}
+
+RefPtr<Action>
+ActionMap::find_action (char const * group_name, char const * action_name)
+{
+       string fullpath;
+
+       fullpath = group_name;
+       fullpath += '/';
+       fullpath += action_name;
+
+       _ActionMap::iterator a = _actions.find (fullpath);
+
+       if (a != _actions.end()) {
+               return a->second;
+       }
+
+       cerr << "Failed to find action (2): [" << fullpath << ']' << endl;
        return RefPtr<Action>();
 }
 
index 81f372ae31345fc0f370b241b0e262bbacc0a311..54f1f3eee9ae2b65c784d627af9df42b4e1f5207 100644 (file)
@@ -106,6 +106,7 @@ class LIBGTKMM2EXT_API ActionMap {
                                                          const char* name, const char* label, sigc::slot<void> sl);
 
        Glib::RefPtr<Gtk::Action> find_action (const std::string& name);
+       Glib::RefPtr<Gtk::Action> find_action (char const * group_name, char const * action_name);
 
        void set_bindings (Bindings*);
        Bindings* bindings() const { return _bindings; }