// <summary> // Keep the TagManager clean by removing tags that are no longer // tagging any other notes. // </summary> void OnTagRemoved(Note note, string tag_name) { Tag tag = TagManager.GetTag(tag_name); Logger.Debug("Watchers.OnTagRemoved popularity count: {0}", tag != null ? tag.Popularity : 0); if (tag != null && tag.Popularity == 0) { TagManager.RemoveTag(tag); } }
public string [] GetAllNotesInNotebook(string notebook_name) { Tag tag = TagManager.GetTag(Tag.SYSTEM_TAG_PREFIX + Notebook.NotebookTagPrefix + notebook_name); if (tag == null) { return(new string [0]); } string [] tagged_note_uris = new string [tag.Notes.Count]; for (int i = 0; i < tagged_note_uris.Length; i++) { tagged_note_uris [i] = tag.Notes [i].Uri; } return(tagged_note_uris); }
public string[] GetAllNotesWithTag(string tag_name) { Tag tag = TagManager.GetTag(tag_name); if (tag == null) { return(new string [0]); } string [] tagged_note_uris = new string [tag.Notes.Count]; for (int i = 0; i < tagged_note_uris.Length; i++) { tagged_note_uris [i] = tag.Notes [i].Uri; } return(tagged_note_uris); }
public bool RemoveTagFromNote(string uri, string tag_name) { Note note = note_manager.FindByUri(uri); if (note == null) { return(false); } Tag tag = TagManager.GetTag(tag_name); if (tag != null) { note.RemoveTag(tag); } note.QueueSave(ChangeType.OtherDataChanged); return(true); }