bool FilterNotes (Gtk.TreeModel model, Gtk.TreeIter iter)
{
Note note = model.GetValue (iter, 3 /* note */) as Note;
if (note == null)
return false;
// Don't show the template notes in the list
Tag template_tag = TagManager.GetOrCreateSystemTag (TagManager.TemplateNoteSystemTag);
if (note.ContainsTag (template_tag))
return false;
Notebooks.Notebook selected_notebook = GetSelectedNotebook ();
if (selected_notebook is Notebooks.UnfiledNotesNotebook) {
// If the note belongs to a notebook, return false
// since the only notes that should be shown in this
// case are notes that are unfiled (not in a notebook).
if (Notebooks.NotebookManager.GetNotebookFromNote (note) != null)
return false;
}
bool passes_search_filter = FilterBySearch (note);
if (passes_search_filter == false)
return false; // don't waste time checking tags if it's already false
bool passes_tag_filter = FilterByTag (note);
// Must pass both filters to appear in the list
return passes_tag_filter && passes_search_filter;
// return true;
}