some ActionMap infrastructure to start removing ActionManager
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 5 Dec 2018 22:32:02 +0000 (17:32 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 5 Dec 2018 22:33:05 +0000 (17:33 -0500)
libs/gtkmm2ext/bindings.cc
libs/gtkmm2ext/gtkmm2ext/bindings.h

index b1abcb0507f0cafc55d1d8107bfb2a0c0938c4f5..1c84a5a5cad98abc316c6f9d38005f97eadcf129 100644 (file)
@@ -1174,6 +1174,7 @@ ActionMap::get_actions (ActionMap::Actions& acts)
        }
 }
 
+
 RefPtr<Action>
 ActionMap::find_action (const string& name)
 {
@@ -1190,9 +1191,7 @@ ActionMap::find_action (const string& name)
 RefPtr<Action>
 ActionMap::find_action (char const * group_name, char const * action_name)
 {
-       string fullpath;
-
-       fullpath = group_name;
+       string fullpath (group_name);
        fullpath += '/';
        fullpath += action_name;
 
index 54f1f3eee9ae2b65c784d627af9df42b4e1f5207..93e8f4c1f56f3ae457d16c7647a828747bed9fa1 100644 (file)
@@ -139,6 +139,24 @@ class LIBGTKMM2EXT_API ActionMap {
 
 };
 
+class LIBGTKMM2EXT_API ActionMapOwner {
+  protected:
+       Gtkmm2ext::ActionMap myactions;
+  public:
+       ActionMapOwner (std::string const & map_name) : myactions (map_name) {}
+       Glib::RefPtr<Gtk::Action> find_action (const std::string& name) { return myactions.find_action (name); }
+       Glib::RefPtr<Gtk::Action> find_action (char const * group_name, char const * action_name) { return myactions.find_action (group_name, action_name); }
+};
+
+class LIBGTKMM2EXT_API StaticActionMapOwner {
+  protected:
+       virtual Gtkmm2ext::ActionMap& my_actions() const = 0;
+  public:
+       virtual ~StaticActionMapOwner() {}
+       Glib::RefPtr<Gtk::Action> find_action (const std::string& name) { return my_actions().find_action (name); }
+       Glib::RefPtr<Gtk::Action> find_action (char const * group_name, char const * action_name) { return my_actions().find_action (group_name, action_name); }
+};
+
 class LIBGTKMM2EXT_API Bindings {
   public:
        enum Operation {