private void OnSelectionChanged(object sender, EventArgs e) { TreeIter iter; TreeModel model; if (((TreeSelection)sender).GetSelected(out model, out iter)) { Waypoint val = (Waypoint)model.GetValue(iter, 0); if (val != null) { m_App.HighlightPointOnMap(val.Lat, val.Lon); } if (val is Geocache) { editButton.Sensitive = true; deleteButton.Sensitive = false; } else if (val.Type == "Geocache - Original") { editButton.Sensitive = false; deleteButton.Sensitive = false; } else { editButton.Sensitive = true; deleteButton.Sensitive = true; } } else { editButton.Sensitive = false; deleteButton.Sensitive = false; } }