[pdfmod: 1/2] Take the prefix variable and version number from configure.



commit 65eed13b3bddce54c52d0943a3b0da7ffb3754de
Author: Å?ukasz JernaÅ? <deejay1 srem org>
Date:   Sat Aug 8 14:22:50 2009 +0200

    Take the prefix variable and version number from configure.
    
    It enables installing PDF Mod in a custom location and avoids some
    duplication.

 .gitignore                         |    1 +
 configure.ac                       |    1 +
 src/PdfMod/Makefile.am             |    1 +
 src/PdfMod/PdfMod.mdp              |    1 +
 src/PdfMod/PdfMod/Defines.cs.in    |   10 ++++++++++
 src/PdfMod/PdfMod/GlobalActions.cs |    6 +++---
 src/PdfMod/PdfMod/PdfMod.cs        |    2 +-
 7 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 82c3123..b6ceb93 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,7 @@ po/Makefile.in.in
 po/stamp-it
 data/pdfmod.desktop
 src/PdfMod/pdfmod
+src/PdfMod/PdfMod/Defines.cs
 *.resources
 gnome-doc-utils.make
 docs/*/.xml2po.mo
diff --git a/configure.ac b/configure.ac
index 90e2f23..18b9831 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,6 +122,7 @@ docs/Makefile
 data/Makefile
 data/icons/Makefile
 src/Libraries/PdfSharp/Makefile
+src/PdfMod/PdfMod/Defines.cs
 src/PdfMod/pdfmod
 src/PdfMod/Makefile
 Makefile
diff --git a/src/PdfMod/Makefile.am b/src/PdfMod/Makefile.am
index 0544d26..be072f1 100644
--- a/src/PdfMod/Makefile.am
+++ b/src/PdfMod/Makefile.am
@@ -86,6 +86,7 @@ FILES =  \
 	PdfMod/AssemblyInfo.cs \
 	PdfMod/CellRendererCairo.cs \
 	PdfMod/CellRendererPage.cs \
+	PdfMod/Defines.cs \
 	PdfMod/Document.cs \
 	PdfMod/GlobalActions.cs \
 	PdfMod/MetadataEditorBox.cs \
diff --git a/src/PdfMod/PdfMod.mdp b/src/PdfMod/PdfMod.mdp
index e020204..f418978 100644
--- a/src/PdfMod/PdfMod.mdp
+++ b/src/PdfMod/PdfMod.mdp
@@ -38,6 +38,7 @@
     <File name="PdfMod/MetadataEditorBox.cs" subtype="Code" buildaction="Compile" />
     <File name="PdfMod/PageThumbnail.cs" subtype="Code" buildaction="Compile" />
     <File name="PdfMod/PageLabels.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Defines.cs.in" subtype="Code" buildaction="Nothing" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
diff --git a/src/PdfMod/PdfMod/Defines.cs.in b/src/PdfMod/PdfMod/Defines.cs.in
new file mode 100644
index 0000000..b8ae81b
--- /dev/null
+++ b/src/PdfMod/PdfMod/Defines.cs.in
@@ -0,0 +1,10 @@
+using System;
+
+namespace PdfMod
+{
+	public class Defines
+	{
+		public const string VERSION = "@VERSION@";
+		public const string PREFIX = "@prefix@";
+	}
+}
diff --git a/src/PdfMod/PdfMod/GlobalActions.cs b/src/PdfMod/PdfMod/GlobalActions.cs
index 40ee359..8988bd1 100644
--- a/src/PdfMod/PdfMod/GlobalActions.cs
+++ b/src/PdfMod/PdfMod/GlobalActions.cs
@@ -367,7 +367,7 @@ namespace PdfMod
                 var langs = GLib.Marshaller.NullTermPtrToStringArray (lang_ptr, false);
 
                 string help_dir = null;
-                foreach (var dir in new string [] { "/usr/share/gnome/help/", "/usr/local/share/gnome/help/", "docs/" }) {
+                foreach (var dir in new string [] { Defines.PREFIX + "/share/gnome/help/", "/usr/local/share/gnome/help/", "docs/" }) {
                     help_dir = dir;
                     if (System.IO.Directory.Exists (dir + "pdfmod/")) {
                         break;
@@ -409,7 +409,7 @@ namespace PdfMod
 
             var dialog = new Gtk.AboutDialog () {
                 ProgramName = "PDF Mod",
-                Version = "0.4",
+                Version = Defines.VERSION,
                 Website = WIKI_URL,
                 WebsiteLabel = Catalog.GetString ("Visit Website"),
                 Authors = new string [] {
@@ -434,7 +434,7 @@ namespace PdfMod
             } catch {}
 
             string [] license_paths = new string [] {
-                "/usr/share/doc/packages/pdfmod/COPYING",
+                Defines.PREFIX + "/share/doc/packages/pdfmod/COPYING",
                 "/usr/local/share/doc/packages/pdfmod/COPYING",
                 "COPYING"
             };
diff --git a/src/PdfMod/PdfMod/PdfMod.cs b/src/PdfMod/PdfMod/PdfMod.cs
index b43244f..02c5777 100644
--- a/src/PdfMod/PdfMod/PdfMod.cs
+++ b/src/PdfMod/PdfMod/PdfMod.cs
@@ -31,7 +31,7 @@ namespace PdfMod
             Hyena.Log.Notify += OnLogNotify;
             Hyena.Log.DebugFormat ("Starting PdfMod");
 
-            InitCatalog ("/usr/local/share/locale/", "/usr/share/locale/");
+            InitCatalog ("/usr/local/share/locale/", Defines.PREFIX + "/share/locale/");
 
             try {
                 System.IO.Directory.CreateDirectory (CacheDir);



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