Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
changeset 84:9db2112b31d7
Fixes #333: GTK interface doesn't auto-select race if only one exists
* Beat GTK into submission and get its hideous API to select a single item if there is only one item
Re #308: Make GTK# UI translatable
* Add more translations to "New Army" form
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 29 Dec 2010 16:32:15 +0000 |
parents | 678e9a0392fc |
children | bfb29a60b802 |
files | FrmNewArmy.cs translations/en.translation |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/FrmNewArmy.cs Wed Dec 29 16:10:21 2010 +0000 +++ b/FrmNewArmy.cs Wed Dec 29 16:32:15 2010 +0000 @@ -31,11 +31,12 @@ lstRaces.Selection.Changed += new EventHandler(OnSelectionChanged); TreeViewColumn raceColumn = new TreeViewColumn(); - raceColumn.Title = "Race"; + raceColumn.Title = Translation.GetTranslation("frmNewArmyRaceColumn", "race"); CellRendererText raceCell = new CellRendererText(); raceColumn.PackStart(raceCell, true); lstRaces.AppendColumn(raceColumn); raceColumn.SetCellDataFunc(raceCell, GtkWarFoundryUtil.RenderWarFoundryObjectName); + ControlTranslator.TranslateWidget(this); if (gameSystem != null) { @@ -93,6 +94,15 @@ { GameSystem system = ComboBoxUtils.GetSelectedItem<GameSystem>(systemCombo); SetRaces(system); + ListStore model = (ListStore)lstRaces.Model; + + if (model.IterNChildren() == 1) + { + TreeIter iter; + model.GetIterFirst(out iter); + lstRaces.Selection.SelectIter(iter); + } + logger.Debug("System selection changed: " + (system == null ? "null" : system.Name)); SetOkayButtonState(); }
--- a/translations/en.translation Wed Dec 29 16:10:21 2010 +0000 +++ b/translations/en.translation Wed Dec 29 16:32:15 2010 +0000 @@ -41,7 +41,9 @@ <translation id="lblArmySize">Army size:</translation> <translation id="defaultUnitName">Unit of {0} {1}</translation> <translation id="statusPanelPoints">{0} pts / {1} pts</translation> -<translation id="FrmNewUnit">Add New {0} Choice</translation> +<translation id="IBBoard.WarFoundry.GUI.GTK.FrmNewArmy">Create Army</translation> +<translation id="frmNewArmyRaceColumn">Race</translation> +<translation id="IBBoard.WarFoundry.GUI.GTK.FrmNewUnit">Add New {0} Choice</translation> <translation id="IBBoard.WarFoundry.GUI.GTK.FrmAbout">About WarFoundry</translation> <translation id="exportBasicHtmlDialogTitle">Export army</translation> <translation id="exportBasicHtmlCancel">Cancel</translation>