Example #1
0
bool
MainWindow::add_toolbar(const char* name, ToolBar& toolbar, bool defaultVisibility)
{
    assert(name);

    if (toolMap_.insert(make_pair(name, &toolbar)).second)
    {
        CHKPTR(toolbox_)->pack_start(toolbar, false, false);

        string toolName(name);
        MenuList& items = CHKPTR(toolMenu_)->items();

        items.push_back(Gtk::Menu_Helpers::CheckMenuElem(
            toolName,
            Gtk_BIND(Gtk_SLOT(this, &MainWindow::on_menu_toggle_toolbar),
                     &toolbar)));
        toolName = "toolbar." + toolName;

        if (debugger().properties()->get_word(toolName.c_str(), defaultVisibility))
        {
            Gtk_MENU_ITEM(items.back()).activate();
            toolbar.show_all();
        }
        return true;
    }
    return false;
}