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 diff
     1.1 --- a/FrmMainWindow.cs	Tue Feb 17 16:41:55 2009 +0000
     1.2 +++ b/FrmMainWindow.cs	Thu Mar 05 20:37:25 2009 +0000
     1.3 @@ -63,7 +63,7 @@
     1.4  			}
     1.5  			catch(Exception ex)
     1.6  			{
     1.7 -				LogManager.GetLogger(typeof(FrmMainWindow)).Fatal(ex.Message + Environment.NewLine + ex.StackTrace);
     1.8 +				LogManager.GetLogger(typeof(FrmMainWindow)).Fatal("("+ex.GetType().Name+") "+ex.Message + Environment.NewLine + ex.StackTrace);
     1.9  			}
    1.10  		}
    1.11  		
    1.12 @@ -103,7 +103,20 @@
    1.13  			logger.Debug("Loading preferences");
    1.14  			Preferences = new Preferences("WarFoundryGTK");
    1.15  			logger.Debug("Loading translations");
    1.16 -			Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString());
    1.17 +			
    1.18 +			try
    1.19 +			{
    1.20 +				Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString());
    1.21 +			}
    1.22 +			catch (TranslationLoadException ex)
    1.23 +			{
    1.24 +				logger.Error(ex);
    1.25 +				MessageDialog dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, ex.Message);
    1.26 +				dialog.Title = "Translation loading failed";
    1.27 +				dialog.Run();
    1.28 +				dialog.Destroy();
    1.29 +			}
    1.30 +			
    1.31  			logger.Debug("Initialising");
    1.32  			commandStack = new CommandStack();
    1.33  			commandStack.CommandStackUpdated+=new MethodInvoker(commandStack_CommandStackUpdated);
     2.1 --- a/gtk-gui/gui.stetic	Tue Feb 17 16:41:55 2009 +0000
     2.2 +++ b/gtk-gui/gui.stetic	Thu Mar 05 20:37:25 2009 +0000
     2.3 @@ -277,7 +277,6 @@
     2.4          <child>
     2.5            <widget class="Gtk.Table" id="table1">
     2.6              <property name="MemberName" />
     2.7 -            <property name="NRows">3</property>
     2.8              <property name="NColumns">2</property>
     2.9              <property name="RowSpacing">6</property>
    2.10              <property name="ColumnSpacing">6</property>
    2.11 @@ -817,7 +816,6 @@
    2.12            <widget class="Gtk.Table" id="table1">
    2.13              <property name="MemberName" />
    2.14              <property name="NRows">2</property>
    2.15 -            <property name="NColumns">3</property>
    2.16              <property name="RowSpacing">6</property>
    2.17              <property name="ColumnSpacing">6</property>
    2.18              <child>
     3.1 --- a/gtk-gui/objects.xml	Tue Feb 17 16:41:55 2009 +0000
     3.2 +++ b/gtk-gui/objects.xml	Thu Mar 05 20:37:25 2009 +0000
     3.3 @@ -1,6 +1,2 @@
     3.4  <objects attr-sync="on">
     3.5 -  <object type="IBBoard.WarFoundry.GTK.Widgets.UnitDisplayWidget" palette-category="WarFoundry GTK# GUI" allow-children="false" base-type="Gtk.Bin">
     3.6 -    <itemgroups />
     3.7 -    <signals />
     3.8 -  </object>
     3.9  </objects>
    3.10 \ No newline at end of file