Gio::SimpleActionGroup belongs to glibmm, not to
gtkmm. Both gtkmm 2.x and gtkmm 3.x use glibmm versions from the
glibmm-2.4 ABI series. I don't understand how you can do what
you say you do in gtkmm 2.x. Haven't you used Gtk::ActionGroup
and Gtk::Action? Something like
Glib::RefPtr<Gtk::ActionGroup>
m_refActionGroup;
...
m_refActionGroup->get_action("PlacepieceBlackPawn")->set_sensitive(row
!= 0 && row != 7);
Gtk::ActionGroup and Gtk::Action are deprecated in gtkmm 3.x and removed in gtkmm 4.x. How do you add the Gio::SimpleAction to the Gio::SimpleActionGroup? I suppose you have a Glib::RefPtr<Gio::SimpleAction> refPlacepieceBlackPawn = ...... or a m_refActionGroup->add_action("PlacepieceBlackPawn"); that returns a Glib::RefPtr<Gio::SimpleAction>. Then it would be easy to save that Glib::RefPtr<Gio::SimpleAction>, so you don't need lookup_action(). If you prefer lookup_action(), this should work in gtkmm 3.x, but not in gtkmm 4.x: auto simple_action = Glib::RefPtr::cast_dynamic<Gio::SimpleAction>(m_refActionGroup->lookup_action("PlacepieceBlackPawn")); if (simple_action) simple_action->set_enabled(row != 0 && row != 7);
In gtkmm 2.x I had, Glib::RefPtr<Gio::SimpleActionGroup> m_refActionGroup; ... m_refActionGroup->get_action("PlacepieceBlackPawn").set_sensitive(row != 0 && row != 7); With gtkmm 3.x it seems that I am forced to do: static_cast<Gio::SimpleAction*>(m_refActionGroup->lookup_action("PlacepieceBlackPawn").get())->set_enabled(row != 0 && row != 7); Any other attempt (that would look at lot more sane and logical) gives a compile error in a gtkmm header - or maybe I'm missing something? The most logical thing would be for 'Gio::SimpleActionGroup::lookup_action' to return a Glib::RefPtr<Gio::SimpleAction>, in which case I could do just: m_refActionGroup->lookup_action("PlacepieceBlackPawn")->set_enabled(row != 0 && row != 7); The builtin cast of Glib::RefPtr isn't working, aka Glib::RefPtr<Gio::SimpleAction> action = "" Neither is, static_cast<Glib::RefPtr<Gio::SimpleAction>>(m_refActionGroup->lookup_action("PlacepieceBlackPawn"))->set_enabled(row != 0 && row != 7); How am I supposed to get my Gio::SimpleAction back? Carlo PS lookup_action return a Gio::Action, which is a base class and doesn't have the set_enabled method. _______________________________________________