How to make application menu items sensitive/insensitive?



Hello,
a few weeks ago I asked how to build a Gnome-3 style application menu and got useful answers (https://mail.gnome.org/archives/gtkmm-list/2015-August/msg00008.html). I have now built an application menu into my program.

Now I'm trying to proceed further. I need to turn on and off specific menu items. For example say I have two items "New Game" and "Stop Game" (see attached example). When you are already playing "New Item" should be insensitive and "Stop Game" should be sensitive. When you aren't playing it should be the opposite.

In gtkmm 2, each menu item was connected to a Gtk::Action, and that class has a set_sensitive() method. But in gtkmm 3, at least in the examples that I was shown, actions are added via Gtk::ApplicationWindow::add_action() or Gtk::Application::add_action() (both inherited from Gio::ActionMap), those actions are Gio::SimpleAction, and that class doesn't seem to have a set_sensitive() equivalent.

Can you please help me?

Thanks in advance
 Gerardo

Attachment: menu.cc
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]