changeset 8:20c5fd0bb79d

Fixes #5 - Stop missing translations being fatal * Catch TranslationLoadExceptions thrown when initialising translations and display the message to the user Also: * Random GUI cleanup that MonoDevelop wanted to do * Add exception type name to last-ditch "log what killed us" exception handling so that we can more easily identify the exception thrown
author IBBoard <dev@ibboard.co.uk>
date Thu, 05 Mar 2009 20:37:25 +0000
parents 58961ff391d4
children 5855999a5556
files FrmMainWindow.cs gtk-gui/gui.stetic gtk-gui/objects.xml
diffstat 3 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/FrmMainWindow.cs	Tue Feb 17 16:41:55 2009 +0000
+++ b/FrmMainWindow.cs	Thu Mar 05 20:37:25 2009 +0000
@@ -63,7 +63,7 @@
 			}
 			catch(Exception ex)
 			{
-				LogManager.GetLogger(typeof(FrmMainWindow)).Fatal(ex.Message + Environment.NewLine + ex.StackTrace);
+				LogManager.GetLogger(typeof(FrmMainWindow)).Fatal("("+ex.GetType().Name+") "+ex.Message + Environment.NewLine + ex.StackTrace);
 			}
 		}
 		
@@ -103,7 +103,20 @@
 			logger.Debug("Loading preferences");
 			Preferences = new Preferences("WarFoundryGTK");
 			logger.Debug("Loading translations");
-			Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString());
+			
+			try
+			{
+				Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString());
+			}
+			catch (TranslationLoadException ex)
+			{
+				logger.Error(ex);
+				MessageDialog dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, ex.Message);
+				dialog.Title = "Translation loading failed";
+				dialog.Run();
+				dialog.Destroy();
+			}
+			
 			logger.Debug("Initialising");
 			commandStack = new CommandStack();
 			commandStack.CommandStackUpdated+=new MethodInvoker(commandStack_CommandStackUpdated);
--- a/gtk-gui/gui.stetic	Tue Feb 17 16:41:55 2009 +0000
+++ b/gtk-gui/gui.stetic	Thu Mar 05 20:37:25 2009 +0000
@@ -277,7 +277,6 @@
         <child>
           <widget class="Gtk.Table" id="table1">
             <property name="MemberName" />
-            <property name="NRows">3</property>
             <property name="NColumns">2</property>
             <property name="RowSpacing">6</property>
             <property name="ColumnSpacing">6</property>
@@ -817,7 +816,6 @@
           <widget class="Gtk.Table" id="table1">
             <property name="MemberName" />
             <property name="NRows">2</property>
-            <property name="NColumns">3</property>
             <property name="RowSpacing">6</property>
             <property name="ColumnSpacing">6</property>
             <child>
--- a/gtk-gui/objects.xml	Tue Feb 17 16:41:55 2009 +0000
+++ b/gtk-gui/objects.xml	Thu Mar 05 20:37:25 2009 +0000
@@ -1,6 +1,2 @@
 <objects attr-sync="on">
-  <object type="IBBoard.WarFoundry.GTK.Widgets.UnitDisplayWidget" palette-category="WarFoundry GTK# GUI" allow-children="false" base-type="Gtk.Bin">
-    <itemgroups />
-    <signals />
-  </object>
 </objects>
\ No newline at end of file