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 wrap: on
line diff
--- a/FrmNewArmy.cs	Wed Dec 29 16:56:55 2010 +0000
+++ b/FrmNewArmy.cs	Wed Dec 29 19:41:51 2010 +0000
@@ -51,8 +51,7 @@
 		protected override void Translate()
 		{
 			base.Translate();
-			bttnCreate.Label = Translation.GetTranslation("bttnCreate", "create");
-			bttnCancel.Label = Translation.GetTranslation("bttnCancel", "cancel");
+			ControlTranslator.TranslateButtons(bttnCreate, bttnCancel);
 		}
 
 		protected virtual void OnSelectionChanged(object o, EventArgs e)
--- a/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewArmy.cs	Wed Dec 29 16:56:55 2010 +0000
+++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewArmy.cs	Wed Dec 29 19:41:51 2010 +0000
@@ -12,7 +12,7 @@
 		private global::Gtk.Label lblArmyName;
 		private global::Gtk.Label lblArmySize;
 		private global::Gtk.Label lblGameSystem;
-		private global::Gtk.Label lblRace;
+		private global::Gtk.Label lblRaceList;
 		private global::Gtk.ComboBoxEntry systemCombo;
 		private global::Gtk.Entry txtArmyName;
 		private global::Gtk.Button bttnCancel;
@@ -114,11 +114,11 @@
 			w8.XOptions = ((global::Gtk.AttachOptions)(4));
 			w8.YOptions = ((global::Gtk.AttachOptions)(4));
 			// Container child table1.Gtk.Table+TableChild
-			this.lblRace = new global::Gtk.Label();
-			this.lblRace.Name = "lblRace";
-			this.lblRace.LabelProp = global::Mono.Unix.Catalog.GetString("race");
-			this.table1.Add(this.lblRace);
-			global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table1[this.lblRace]));
+			this.lblRaceList = new global::Gtk.Label();
+			this.lblRaceList.Name = "lblRaceList";
+			this.lblRaceList.LabelProp = global::Mono.Unix.Catalog.GetString("race");
+			this.table1.Add(this.lblRaceList);
+			global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table1[this.lblRaceList]));
 			w9.TopAttach = ((uint)(1));
 			w9.BottomAttach = ((uint)(2));
 			w9.XOptions = ((global::Gtk.AttachOptions)(4));
@@ -176,28 +176,14 @@
 			this.bttnCreate.CanDefault = true;
 			this.bttnCreate.CanFocus = true;
 			this.bttnCreate.Name = "bttnCreate";
+			this.bttnCreate.UseStock = true;
 			this.bttnCreate.UseUnderline = true;
-			// Container child bttnCreate.Gtk.Container+ContainerChild
-			global::Gtk.Alignment w15 = new global::Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-			// Container child GtkAlignment.Gtk.Container+ContainerChild
-			global::Gtk.HBox w16 = new global::Gtk.HBox();
-			w16.Spacing = 2;
-			// Container child GtkHBox.Gtk.Container+ContainerChild
-			global::Gtk.Image w17 = new global::Gtk.Image();
-			w17.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-ok", global::Gtk.IconSize.Menu);
-			w16.Add(w17);
-			// Container child GtkHBox.Gtk.Container+ContainerChild
-			global::Gtk.Label w19 = new global::Gtk.Label();
-			w19.LabelProp = global::Mono.Unix.Catalog.GetString("C_reate");
-			w19.UseUnderline = true;
-			w16.Add(w19);
-			w15.Add(w16);
-			this.bttnCreate.Add(w15);
+			this.bttnCreate.Label = "gtk-ok";
 			this.AddActionWidget(this.bttnCreate, -5);
-			global::Gtk.ButtonBox.ButtonBoxChild w23 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w13[this.bttnCreate]));
-			w23.Position = 1;
-			w23.Expand = false;
-			w23.Fill = false;
+			global::Gtk.ButtonBox.ButtonBoxChild w15 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w13[this.bttnCreate]));
+			w15.Position = 1;
+			w15.Expand = false;
+			w15.Fill = false;
 			if ((this.Child != null))
 			{
 				this.Child.ShowAll();
--- a/gtk-gui/gui.stetic	Wed Dec 29 16:56:55 2010 +0000
+++ b/gtk-gui/gui.stetic	Wed Dec 29 19:41:51 2010 +0000
@@ -5,8 +5,8 @@
     <target-gtk-version>2.12</target-gtk-version>
   </configuration>
   <import>
-    <widget-library name="../../IBBoard.GtkSharp/bin/Release/IBBoard.GtkSharp.dll" />
-    <widget-library name="../bin/Release/WarFoundry-GTK.exe" internal="true" />
+    <widget-library name="../../IBBoard.GtkSharp/bin/Debug/IBBoard.GtkSharp.dll" />
+    <widget-library name="../bin/Debug/WarFoundry-GTK.exe" internal="true" />
   </import>
   <widget class="Gtk.Window" id="IBBoard.WarFoundry.GUI.GTK.FrmMainWindow" design-size="832 659">
     <action-group name="Default">
@@ -432,7 +432,7 @@
               </packing>
             </child>
             <child>
-              <widget class="Gtk.Label" id="lblRace">
+              <widget class="Gtk.Label" id="lblRaceList">
                 <property name="MemberName" />
                 <property name="LabelProp" translatable="yes">race</property>
               </widget>
@@ -536,12 +536,12 @@
             <property name="Sensitive">False</property>
             <property name="CanDefault">True</property>
             <property name="CanFocus">True</property>
-            <property name="Type">TextAndIcon</property>
-            <property name="Icon">stock:gtk-ok Menu</property>
-            <property name="Label" translatable="yes">C_reate</property>
-            <property name="UseUnderline">True</property>
+            <property name="UseStock">True</property>
+            <property name="Type">StockItem</property>
+            <property name="StockId">gtk-ok</property>
             <property name="ResponseId">-5</property>
             <signal name="Clicked" handler="OnCreateClicked" />
+            <property name="label">gtk-ok</property>
           </widget>
           <packing>
             <property name="Position">1</property>