public NotebookMenuItem(Note note, Notebook notebook) : base(notebook == null ? Catalog.GetString("No notebook") : notebook.Name) { this.note = note; this.notebook = notebook; if (notebook == null) { // This is for the "No notebook" menu item // Check to see if the specified note belongs // to a notebook. If so, don't activate the // radio button. if (NotebookManager.GetNotebookFromNote(note) == null) { Active = true; } } else if (notebook.ContainsNote(note)) { Active = true; } Activated += OnActivated; }
public override void OnNoteOpened() { if (menu == null) { menu = new Gtk.Menu(); menu.ShowAll(); } if (toolButton == null) { InitializeToolButton(); // Disable the notebook button if this note is a template note Tag templateTag = TagManager.GetOrCreateSystemTag(TagManager.TemplateNoteSystemTag); if (Note.ContainsTag(templateTag) == true) { toolButton.Sensitive = false; // Also prevent notebook templates from being deleted if (NotebookManager.GetNotebookFromNote(Note) != null) { Note.Window.DeleteButton.Sensitive = false; } } } }
private void UpdateButtonSensitivity(bool isTemplate) { if (toolButton != null) { toolButton.Sensitive = !isTemplate; } if (Note.HasWindow) { Note.Window.DeleteButton.Sensitive = !isTemplate || NotebookManager.GetNotebookFromNote(Note) == null; } }
void UpdateNotebookButtonLabel() { Notebook currentNotebook = NotebookManager.GetNotebookFromNote(Note); UpdateNotebookButtonLabel(currentNotebook); }