Menu throws a critical message when closing app
- From: David Gasa i Castell <dgasacas7 gmail com>
- To: gtkmm-list gnome org
- Subject: Menu throws a critical message when closing app
- Date: Wed, 28 Apr 2021 20:05:30 +0200
Hi,
In closing the attached application, using the menu path: Client | Quit, I get the critical message
Gtk-CRITICAL **: gtk_tristate_accessible_value_get: assertion ‘value->value_class == >K_TRISTATE_ACCESSIBLE_VALUE’ failed
What I’m doing wrong ?
(Note: I'm using Gtkmm-4.0)
--- code
#include <gtkmm.h>
class Window
:
public Gtk::Window
{
public:
Window()
:
vbox (Gtk::Orientation::VERTICAL, 0),
refBuilder (Gtk::Builder::create()),
refSimpleActionGroup (Gio::SimpleActionGroup::create())
{
set_title ("Hello");
set_default_size (200, 200);
refSimpleActionGroup->add_action_bool ("done");
refSimpleActionGroup->add_action ("quit",
sigc::mem_fun (*this, &Gtk::Widget::hide));
insert_action_group ("menu", refSimpleActionGroup);
try
{
refBuilder->add_from_string (get_menu_info());
}
catch (...)
{}
Glib::RefPtr<Gio::Menu> gmenu =
std::dynamic_pointer_cast<Gio::Menu> (refBuilder->get_object ("menubar"));
if (gmenu)
{
auto menubar = Gtk::make_managed<Gtk::PopoverMenuBar>(gmenu);
menubar->set_margin (5);
vbox.append (*menubar);
}
set_child (vbox);
}
private:
Glib::ustring get_menu_info() const
{
return
"<interface>"
" <menu id='menubar'>"
" <submenu>"
" <attribute name='label' translatable='yes'>Client</attribute>"
" <section>"
" <item>"
" <attribute name='label' translatable='yes'>Done</attribute>"
" <attribute name='action'>menu.done</attribute>"
" </item>"
" </section>"
" <section>"
" <item>"
" <attribute name='label' translatable='yes'>Quit</attribute>"
" <attribute name='action'>menu.quit</attribute>"
" </item>"
" </section>"
" </submenu>"
" </menu>"
"</interface>";
}
Gtk::Box vbox;
Glib::RefPtr<Gtk::Builder> refBuilder;
Glib::RefPtr<Gio::SimpleActionGroup> refSimpleActionGroup;
};
int main (int argc, char *argv[])
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create ("org.hello");
return app->make_window_and_run<Window>(argc, argv);
}
--
David Gasa i Castell
Linux User #488832
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]