static void StoreHistory (string propertyName, ComboBoxEntry comboBox)
{
var store = (ListStore)comboBox.Model;
var history = new List<string> ();
TreeIter iter;
if (store.GetIterFirst (out iter)) {
do {
history.Add ((string)store.GetValue (iter, 0));
} while (store.IterNext (ref iter));
}
const int limit = 20;
if (history.Count > limit) {
history.RemoveRange (history.Count - (history.Count - limit), history.Count - limit);
}
if (history.Contains (comboBox.Entry.Text))
history.Remove (comboBox.Entry.Text);
history.Insert (0, comboBox.Entry.Text);
PropertyService.Set (propertyName, string.Join (historySeparator.ToString (), history.ToArray ()));
}