Tomboy.NoteRecentChanges.PerformSearch C# (CSharp) Method

PerformSearch() private method

private PerformSearch ( ) : void
return void
		void PerformSearch()
		{
			// For some reason, the matches column must be rebuilt
			// every time because otherwise, it's not sortable.
			RemoveMatchesColumn ();
			Search search = new Search(manager);

			string text = SearchText;
			if (text == null) {
				current_matches.Clear ();
				store_filter.Refilter ();
				UpdateTotalNoteCount (store_sort.IterNChildren ());
				if (tree.IsRealized)
					tree.ScrollToPoint (0, 0);
				return;
			}
			text = text.ToLower ();

			current_matches.Clear ();

			// Search using the currently selected notebook
			Notebooks.Notebook selected_notebook = GetSelectedNotebook ();
			if (selected_notebook is Notebooks.SpecialNotebook)
				selected_notebook = null;

			IDictionary<Note,int> results =
				search.SearchNotes(text, false, selected_notebook);
			
			// if no results found in current notebook ask user whether
			// to search in all notebooks
			if (results.Count == 0 && selected_notebook != null) {
				NoMatchesFoundAction ();
			}
			else {
				foreach (Note note in results.Keys){
					current_matches.Add (note.Uri, results[note]);
				}

				AddMatchesColumn ();
				store_filter.Refilter ();
				tree.ScrollToPoint (0, 0);
				UpdateMatchNoteCount (current_matches.Count);
			}
		}