changeset 86:9515b57ba752

Re #308: Make GTK# UI translatable * Make form buttons translatable using new method * Swap "Create" button to a stock "OK" so that we don't lose the image on translation
author IBBoard <dev@ibboard.co.uk>
date Wed, 29 Dec 2010 19:41:51 +0000
parents bfb29a60b802
children 40857cfb309b
files FrmNewArmy.cs gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewArmy.cs gtk-gui/gui.stetic
diffstat 3 files changed, 20 insertions(+), 35 deletions(-) [+]
line diff
     1.1 --- a/FrmNewArmy.cs	Wed Dec 29 16:56:55 2010 +0000
     1.2 +++ b/FrmNewArmy.cs	Wed Dec 29 19:41:51 2010 +0000
     1.3 @@ -51,8 +51,7 @@
     1.4  		protected override void Translate()
     1.5  		{
     1.6  			base.Translate();
     1.7 -			bttnCreate.Label = Translation.GetTranslation("bttnCreate", "create");
     1.8 -			bttnCancel.Label = Translation.GetTranslation("bttnCancel", "cancel");
     1.9 +			ControlTranslator.TranslateButtons(bttnCreate, bttnCancel);
    1.10  		}
    1.11  
    1.12  		protected virtual void OnSelectionChanged(object o, EventArgs e)
     2.1 --- a/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewArmy.cs	Wed Dec 29 16:56:55 2010 +0000
     2.2 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewArmy.cs	Wed Dec 29 19:41:51 2010 +0000
     2.3 @@ -12,7 +12,7 @@
     2.4  		private global::Gtk.Label lblArmyName;
     2.5  		private global::Gtk.Label lblArmySize;
     2.6  		private global::Gtk.Label lblGameSystem;
     2.7 -		private global::Gtk.Label lblRace;
     2.8 +		private global::Gtk.Label lblRaceList;
     2.9  		private global::Gtk.ComboBoxEntry systemCombo;
    2.10  		private global::Gtk.Entry txtArmyName;
    2.11  		private global::Gtk.Button bttnCancel;
    2.12 @@ -114,11 +114,11 @@
    2.13  			w8.XOptions = ((global::Gtk.AttachOptions)(4));
    2.14  			w8.YOptions = ((global::Gtk.AttachOptions)(4));
    2.15  			// Container child table1.Gtk.Table+TableChild
    2.16 -			this.lblRace = new global::Gtk.Label();
    2.17 -			this.lblRace.Name = "lblRace";
    2.18 -			this.lblRace.LabelProp = global::Mono.Unix.Catalog.GetString("race");
    2.19 -			this.table1.Add(this.lblRace);
    2.20 -			global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table1[this.lblRace]));
    2.21 +			this.lblRaceList = new global::Gtk.Label();
    2.22 +			this.lblRaceList.Name = "lblRaceList";
    2.23 +			this.lblRaceList.LabelProp = global::Mono.Unix.Catalog.GetString("race");
    2.24 +			this.table1.Add(this.lblRaceList);
    2.25 +			global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table1[this.lblRaceList]));
    2.26  			w9.TopAttach = ((uint)(1));
    2.27  			w9.BottomAttach = ((uint)(2));
    2.28  			w9.XOptions = ((global::Gtk.AttachOptions)(4));
    2.29 @@ -176,28 +176,14 @@
    2.30  			this.bttnCreate.CanDefault = true;
    2.31  			this.bttnCreate.CanFocus = true;
    2.32  			this.bttnCreate.Name = "bttnCreate";
    2.33 +			this.bttnCreate.UseStock = true;
    2.34  			this.bttnCreate.UseUnderline = true;
    2.35 -			// Container child bttnCreate.Gtk.Container+ContainerChild
    2.36 -			global::Gtk.Alignment w15 = new global::Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
    2.37 -			// Container child GtkAlignment.Gtk.Container+ContainerChild
    2.38 -			global::Gtk.HBox w16 = new global::Gtk.HBox();
    2.39 -			w16.Spacing = 2;
    2.40 -			// Container child GtkHBox.Gtk.Container+ContainerChild
    2.41 -			global::Gtk.Image w17 = new global::Gtk.Image();
    2.42 -			w17.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-ok", global::Gtk.IconSize.Menu);
    2.43 -			w16.Add(w17);
    2.44 -			// Container child GtkHBox.Gtk.Container+ContainerChild
    2.45 -			global::Gtk.Label w19 = new global::Gtk.Label();
    2.46 -			w19.LabelProp = global::Mono.Unix.Catalog.GetString("C_reate");
    2.47 -			w19.UseUnderline = true;
    2.48 -			w16.Add(w19);
    2.49 -			w15.Add(w16);
    2.50 -			this.bttnCreate.Add(w15);
    2.51 +			this.bttnCreate.Label = "gtk-ok";
    2.52  			this.AddActionWidget(this.bttnCreate, -5);
    2.53 -			global::Gtk.ButtonBox.ButtonBoxChild w23 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w13[this.bttnCreate]));
    2.54 -			w23.Position = 1;
    2.55 -			w23.Expand = false;
    2.56 -			w23.Fill = false;
    2.57 +			global::Gtk.ButtonBox.ButtonBoxChild w15 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w13[this.bttnCreate]));
    2.58 +			w15.Position = 1;
    2.59 +			w15.Expand = false;
    2.60 +			w15.Fill = false;
    2.61  			if ((this.Child != null))
    2.62  			{
    2.63  				this.Child.ShowAll();
     3.1 --- a/gtk-gui/gui.stetic	Wed Dec 29 16:56:55 2010 +0000
     3.2 +++ b/gtk-gui/gui.stetic	Wed Dec 29 19:41:51 2010 +0000
     3.3 @@ -5,8 +5,8 @@
     3.4      <target-gtk-version>2.12</target-gtk-version>
     3.5    </configuration>
     3.6    <import>
     3.7 -    <widget-library name="../../IBBoard.GtkSharp/bin/Release/IBBoard.GtkSharp.dll" />
     3.8 -    <widget-library name="../bin/Release/WarFoundry-GTK.exe" internal="true" />
     3.9 +    <widget-library name="../../IBBoard.GtkSharp/bin/Debug/IBBoard.GtkSharp.dll" />
    3.10 +    <widget-library name="../bin/Debug/WarFoundry-GTK.exe" internal="true" />
    3.11    </import>
    3.12    <widget class="Gtk.Window" id="IBBoard.WarFoundry.GUI.GTK.FrmMainWindow" design-size="832 659">
    3.13      <action-group name="Default">
    3.14 @@ -432,7 +432,7 @@
    3.15                </packing>
    3.16              </child>
    3.17              <child>
    3.18 -              <widget class="Gtk.Label" id="lblRace">
    3.19 +              <widget class="Gtk.Label" id="lblRaceList">
    3.20                  <property name="MemberName" />
    3.21                  <property name="LabelProp" translatable="yes">race</property>
    3.22                </widget>
    3.23 @@ -536,12 +536,12 @@
    3.24              <property name="Sensitive">False</property>
    3.25              <property name="CanDefault">True</property>
    3.26              <property name="CanFocus">True</property>
    3.27 -            <property name="Type">TextAndIcon</property>
    3.28 -            <property name="Icon">stock:gtk-ok Menu</property>
    3.29 -            <property name="Label" translatable="yes">C_reate</property>
    3.30 -            <property name="UseUnderline">True</property>
    3.31 +            <property name="UseStock">True</property>
    3.32 +            <property name="Type">StockItem</property>
    3.33 +            <property name="StockId">gtk-ok</property>
    3.34              <property name="ResponseId">-5</property>
    3.35              <signal name="Clicked" handler="OnCreateClicked" />
    3.36 +            <property name="label">gtk-ok</property>
    3.37            </widget>
    3.38            <packing>
    3.39              <property name="Position">1</property>