[tasque/transition: 122/213] Setup datadir variable during build



commit 984c8370b0cf4ce7731a08829e009c68f0c63713
Author: Antonius Riha <antoniusriha gmail com>
Date:   Thu Aug 16 21:13:13 2012 +0200

    Setup datadir variable during build
    
    * enabled translation again

 INSTALL                          |    5 +++++
 build/GlobalDefines.cs.in        |    4 ++--
 build/SetDataAtBuildTime.cs      |    6 +++++-
 build/build.csproj               |    3 ++-
 src/Tasque.Gtk/GtkApplication.cs |    4 +++-
 5 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/INSTALL b/INSTALL
index 6c0e146..8c7d8b2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -28,6 +28,11 @@ to the command line, thus yielding
 as the build command.
 
 
+Other options:
+	/property:DataDir=pathToDataDir			(datadir contains resources, translation, ...)
+
+
+
 Instructions below are deprecated.
 --------------------------------------------------------
 
diff --git a/build/GlobalDefines.cs.in b/build/GlobalDefines.cs.in
index 224bc44..ac330a9 100644
--- a/build/GlobalDefines.cs.in
+++ b/build/GlobalDefines.cs.in
@@ -30,8 +30,8 @@ using System.Collections.ObjectModel;
 namespace Tasque {
 	static class GlobalDefines {
 		public const string Version = "@version@";
-//		public const string DataDir	= "@datadir@";
-//		public const string LocaleDir = "@datadir@/locale";
+		public const string DataDir	= "@datadir@";
+		public const string LocaleDir = "@datadir@/locale";
 //		public const string SoundDir = "@datadir@/tasque/sounds";
 		public const string CopyrightInfo = @"@copyrightinfo@";
 		public const string License = @"@license@";
diff --git a/build/SetDataAtBuildTime.cs b/build/SetDataAtBuildTime.cs
index 684136a..7241223 100644
--- a/build/SetDataAtBuildTime.cs
+++ b/build/SetDataAtBuildTime.cs
@@ -23,7 +23,6 @@
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
-
 using System;
 using System.IO;
 using System.Text;
@@ -142,6 +141,9 @@ namespace Tasque.Build
 		}
 
 		[Required]
+		public ITaskItem DataDir { get; set; }
+		
+		[Required]
 		public ITaskItem GlobalDefinesFile { get; set; }
 
 		[Required]
@@ -167,6 +169,8 @@ namespace Tasque.Build
 			SetValue ("@website@", Website.ItemSpec);
 
 			SetValue ("@authors@", authors);
+			
+			SetValue ("@datadir@", DataDir.ItemSpec);
 
 			if (!WriteGlobalDefines ())
 				return false;
diff --git a/build/build.csproj b/build/build.csproj
index 05ba4b3..b532217 100644
--- a/build/build.csproj
+++ b/build/build.csproj
@@ -12,6 +12,7 @@
     <AssemblyName>Tasque.Build</AssemblyName>
     <RootNamespace>Tasque.Build</RootNamespace>
     <Website>https://live.gnome.org/Tasque</Website>
+    <DataDir Condition=" '$(DataDir)' == '' ">$(MSBuildProjectDirectory)\data</DataDir>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugType>full</DebugType>
@@ -115,7 +116,7 @@
   </ItemGroup>
   <Target Name="AfterBuild">
     <Message Text="Setting up global definitions..." />
-    <SetDataAtBuildTime AuthorsFile="@(Authors)" CopyingFile="@(License)" GlobalDefinesFile="@(GlobalDefines)" GlobalDefinesFileIn="@(GlobalDefinesIn)" Version="$(ReleaseVersion)" Website="$(Website)" />
+    <SetDataAtBuildTime AuthorsFile="@(Authors)" CopyingFile="@(License)" DataDir="$(DataDir)" GlobalDefinesFile="@(GlobalDefines)" GlobalDefinesFileIn="@(GlobalDefinesIn)" Version="$(ReleaseVersion)" Website="$(Website)" />
     <Message Text="Finished setting up global definitions." />
     <Message Text="Load submodules..." />
     <LoadGitSubmodules SolutionDirectory="$(MSBuildProjectDirectory)\.." />
diff --git a/src/Tasque.Gtk/GtkApplication.cs b/src/Tasque.Gtk/GtkApplication.cs
index 8e61c6f..6db3738 100644
--- a/src/Tasque.Gtk/GtkApplication.cs
+++ b/src/Tasque.Gtk/GtkApplication.cs
@@ -53,7 +53,9 @@ namespace Tasque
 		
 		protected override void OnInitialize ()
 		{
-//			Catalog.Init ("tasque", GlobalDefines.LocaleDir);
+			Catalog.Init ("tasque", GlobalDefines.LocaleDir);
+			Trace.WriteLine ("Locale dir: " + GlobalDefines.LocaleDir);
+			
 			Gtk.Application.Init ();
 			GLib.Idle.Add (delegate {
 				InitializeIdle ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]