Ejemplo n.º 1
0
        private void AddMenuItems(Gtk.Menu menu)
        {
            RemoveMenuItems(menu);

            NotebookNewNoteMenuItem item;

            Gtk.TreeModel model = NotebookManager.Notebooks;
            Gtk.TreeIter  iter;

            // Add in the "New Notebook..." menu item
            Gtk.ImageMenuItem newNotebookMenuItem =
                new Gtk.ImageMenuItem(Catalog.GetString("New Note_book..."));
            newNotebookMenuItem.Image      = new Gtk.Image(NewNotebookIcon);
            newNotebookMenuItem.Activated += OnNewNotebookMenuItem;
            newNotebookMenuItem.ShowAll();
            menu.Append(newNotebookMenuItem);

            if (model.IterNChildren() > 0)
            {
                Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem();
                separator.ShowAll();
                menu.Append(separator);

                if (model.GetIterFirst(out iter) == true)
                {
                    do
                    {
                        Notebook notebook = model.GetValue(iter, 0) as Notebook;
                        item = new NotebookNewNoteMenuItem(notebook);
                        item.ShowAll();
                        menu.Append(item);
                    } while (model.IterNext(ref iter) == true);
                }
            }
#if MAC
            menu.ShowAll();
#endif
        }