void NotebookApplicationAddin::add_menu_items(Gtk::Menu * menu, std::list<Gtk::MenuItem*> & menu_items) { remove_menu_items (menu, menu_items); NotebookNewNoteMenuItem *item; Glib::RefPtr<Gtk::TreeModel> model = NotebookManager::obj().get_notebooks(); Gtk::TreeIter iter; // Add in the "New Notebook..." menu item Gtk::ImageMenuItem *newNotebookMenuItem = manage(new Gtk::ImageMenuItem (_("New Note_book..."), true)); newNotebookMenuItem->set_image(*manage(new Gtk::Image( IconManager::obj().get_icon(IconManager::NOTEBOOK_NEW, 16)))); newNotebookMenuItem->signal_activate() .connect(sigc::mem_fun(*this, &NotebookApplicationAddin::on_new_notebook_menu_item)); newNotebookMenuItem->show_all (); menu->append (*newNotebookMenuItem); menu_items.push_back(newNotebookMenuItem); if (model->children().size() > 0) { Gtk::SeparatorMenuItem *separator = manage(new Gtk::SeparatorMenuItem ()); separator->show_all (); menu->append (*separator); menu_items.push_back(separator); iter = model->children().begin(); while (iter) { Notebook::Ptr notebook; iter->get_value(0, notebook); item = manage(new NotebookNewNoteMenuItem (notebook)); item->show_all (); menu->append (*item); menu_items.push_back(item); ++iter; } } }
void NotebookApplicationAddin::on_new_notebook_menu_hidden() { remove_menu_items(m_mainWindowNotebookMenu, m_mainWindowNotebookMenuItems); }
void NotebookApplicationAddin::on_tray_notebook_menu_hidden() { remove_menu_items(m_trayNotebookMenu, m_trayNotebookMenuItems); }