Actions

First create the Gio::SimpleActions and add them to a Gio::SimpleActionGroup, with Gio::ActionMap::add_action(). (Gio::ActionMap is a base class of Gio::SimpleActionGroup.) Then add the action group to your window with Gtk::Widget::insert_action_group().

The arguments to add_action() specify the action's name, which is used in the menu items and toolbar buttons. You can also specify a signal handler when calling add_action(). This signal handler will be called when the action is activated via either a menu item or a toolbar button.

For instance:

m_refActionGroup = Gio::SimpleActionGroup::create();

m_refActionGroup->add_action("new", sigc::mem_fun(*this, &ExampleWindow::on_action_file_new));
m_refActionGroup->add_action("open", sigc::mem_fun(*this, &ExampleWindow::on_action_file_open));
m_refActionGroup->add_action("quit", sigc::mem_fun(*this, &ExampleWindow::on_action_file_quit));

insert_action_group("example", m_refActionGroup);

If you use an Gtk::ApplicationWindow, you don't have to create your own action group. Gio::ActionGroup and Gio::ActionMap are base classes of Gtk::ApplicationWindow.