add ActionManager::set_sensitive() for Gtk::ActionGroup
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 10 Dec 2018 23:40:00 +0000 (18:40 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 10 Dec 2018 23:40:00 +0000 (18:40 -0500)
libs/gtkmm2ext/actions.cc
libs/gtkmm2ext/gtkmm2ext/actions.h

index 89ee999e4c4b2914555ab749da4295ed1a63d198..edf092d909a0b4a4b800f1ff2bcf6abc05a58968 100644 (file)
@@ -93,6 +93,21 @@ ActionManager::save_action_states ()
        }
 }
 
+void
+ActionManager::set_sensitive (Glib::RefPtr<ActionGroup> group, bool yn)
+{
+       /* the C++ API for functions used here appears to be broken in
+          gtkmm2.6, so we fall back to the C level.
+       */
+
+       GtkActionGroup* grp = group->gobj();
+
+       for (GList* acts = gtk_action_group_list_actions (grp); acts; acts = g_list_next (acts)) {
+               GtkAction* action = (GtkAction*) acts->data;
+               gtk_action_set_sensitive (action, yn);
+       }
+}
+
 void
 ActionManager::enable_active_actions ()
 {
index b396294f119f2d483a9af089706e88da97f1ece7..6311a98631396e36acefe3557104a4efd4cdb67e 100644 (file)
@@ -56,6 +56,7 @@ namespace ActionManager {
        LIBGTKMM2EXT_API extern std::string unbound_string;  /* the key string returned if an action is not bound */
        LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::UIManager> ui_manager;
 
+       LIBGTKMM2EXT_API extern void set_sensitive (Glib::RefPtr<Gtk::ActionGroup> group, bool yn);
        LIBGTKMM2EXT_API extern void set_sensitive (std::vector<Glib::RefPtr<Gtk::Action> >& actions, bool);
        LIBGTKMM2EXT_API extern std::string get_key_representation (const std::string& accel_path, Gtk::AccelKey& key);
        LIBGTKMM2EXT_API extern Gtk::Widget* get_widget (const char * name);