changeset 79:592930d28da4

Re #308: Make GTK# UI translatable * Extend new TranslatableWindowWithActions so that we can start to translate the menu items as well
author IBBoard <dev@ibboard.co.uk>
date Mon, 27 Dec 2010 20:56:31 +0000
parents e63209ab2cfa
children 9c9af2ce8c43
files FrmMainWindow.cs
diffstat 1 files changed, 24 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/FrmMainWindow.cs	Sat Dec 18 16:46:16 2010 +0000
     1.2 +++ b/FrmMainWindow.cs	Mon Dec 27 20:56:31 2010 +0000
     1.3 @@ -29,10 +29,11 @@
     1.4  using IBBoard.Xml;
     1.5  using log4net;
     1.6  using WFObjects = IBBoard.WarFoundry.API.Objects;
     1.7 +using System.Collections;
     1.8  
     1.9  namespace IBBoard.WarFoundry.GUI.GTK
    1.10  {
    1.11 -	public partial class FrmMainWindow: Gtk.Window
    1.12 +	public partial class FrmMainWindow: TranslatableWindowWithActions
    1.13  	{
    1.14  		private static readonly string AppTitle = "WarFoundry";
    1.15  		private const int CATEGORY_BUTTON_SEPARATOR_INDEX = 6;
    1.16 @@ -151,8 +152,7 @@
    1.17  			WarFoundryCore.GameSystemChanged += new GameSystemChangedDelegate(OnGameSystemChanged);
    1.18  			WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(OnArmyChanged);
    1.19  			Destroyed += new EventHandler(OnWindowDestroyed);
    1.20 -			//TODO: Translate and subscribe to other events
    1.21 -			ControlTranslator.TranslateWidget(this);
    1.22 +			TranslateWindow();
    1.23  			UnitAddedMethod = new ObjectAddDelegate(OnUnitAdded);
    1.24  			UnitRemovedMethod = new ObjectRemoveDelegate(OnUnitRemoved);
    1.25  			PointsValueChangedMethod = new DoubleValChangedDelegate(OnPointsValueChanged);
    1.26 @@ -223,6 +223,12 @@
    1.27  			}
    1.28  		}
    1.29  
    1.30 +		private void TranslateWindow()
    1.31 +		{
    1.32 +			ControlTranslator.TranslateWidget(this);
    1.33 +			SetAppTitle();
    1.34 +		}
    1.35 +
    1.36  		private void FileLoadingFinished(List<FileLoadFailure> failures)
    1.37  		{
    1.38  			foreach (FileLoadFailure failure in failures)
    1.39 @@ -1111,5 +1117,20 @@
    1.40  			form.Run();
    1.41  			form.Hide();
    1.42  		}
    1.43 +
    1.44 +		public override ICollection<Action> Actions
    1.45 +		{
    1.46 +			get
    1.47 +			{
    1.48 +				List<Action> actions = new List<Action>();
    1.49 +
    1.50 +				foreach (ActionGroup actionGroup in this.UIManager.ActionGroups)
    1.51 +				{
    1.52 +					actions.AddRange(actionGroup.ListActions());
    1.53 +				}
    1.54 +
    1.55 +				return actions;
    1.56 +			}
    1.57 +		}
    1.58  	}
    1.59  }