Tomboy.Note.ProcessRenameLinkUpdate C# (CSharp) Method

ProcessRenameLinkUpdate() private method

private ProcessRenameLinkUpdate ( string old_title ) : void
old_title string
return void
		private void ProcessRenameLinkUpdate (string old_title)
		{
			List<Note> linkingNotes = new List<Note> ();
			foreach (Note note in manager.Notes) {
				// Technically, containing text does not imply linking,
				// but this is less work
				if (note != this && note.ContainsText (old_title))
					linkingNotes.Add (note);
			}

			if (linkingNotes.Count > 0) {
				NoteRenameBehavior behavior = (NoteRenameBehavior)
					Preferences.Get (Preferences.NOTE_RENAME_BEHAVIOR);
				if (behavior == NoteRenameBehavior.AlwaysShowDialog) {
					var dlg = new NoteRenameDialog (linkingNotes, old_title, this);
					Gtk.ResponseType response = (Gtk.ResponseType) dlg.Run ();
					if (response != Gtk.ResponseType.Cancel &&
					    dlg.SelectedBehavior != NoteRenameBehavior.AlwaysShowDialog)
						Preferences.Set (Preferences.NOTE_RENAME_BEHAVIOR, (int) dlg.SelectedBehavior);
					foreach (var pair in dlg.Notes) {
						if (pair.Value && response == Gtk.ResponseType.Yes) // Rename
							pair.Key.RenameLinks (old_title, this);
						else
							pair.Key.RemoveLinks (old_title, this);
					}
					dlg.Destroy ();
				} else if (behavior == NoteRenameBehavior.AlwaysRemoveLinks)
					foreach (var note in linkingNotes)
						note.RemoveLinks (old_title, this);
				else if (behavior == NoteRenameBehavior.AlwaysRenameLinks)
					foreach (var note in linkingNotes)
						note.RenameLinks (old_title, this);
			}
		}