r15132 - gnucash/trunk - Fix gnc_path_get_localedir() because binreloc's implementation did not

Christian Stimming cstim at cvs.gnucash.org
Fri Nov 24 08:14:42 EST 2006


Author: cstim
Date: 2006-11-24 08:14:41 -0500 (Fri, 24 Nov 2006)
New Revision: 15132
Trac: http://svn.gnucash.org/trac/changeset/15132

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/configure.in
   gnucash/trunk/src/engine/Makefile.am
   gnucash/trunk/src/engine/binreloc.c
   gnucash/trunk/src/engine/binreloc.h
   gnucash/trunk/src/engine/gnc-path.c
   gnucash/trunk/src/engine/gncla-dir.h.in
Log:
Fix gnc_path_get_localedir() because binreloc's implementation did not 
respect the choice of DATADIRNAME from AM_GLIB_GNU_GETTEXT in configure.



Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-11-24 10:38:39 UTC (rev 15131)
+++ gnucash/trunk/ChangeLog	2006-11-24 13:14:41 UTC (rev 15132)
@@ -1,3 +1,9 @@
+2006-11-24  Christian Stimming <stimming at tuhh.de>
+
+	* src/engine/gnc-path.c: Fix gnc_path_get_localedir() because
+	binreloc's implementation did not respect the choice of
+	DATADIRNAME from AM_GLIB_GNU_GETTEXT in configure.
+
 2006-11-20  Derek Atkins  <derek at ihtfp.com>
 
 	* src/import-export/qif-import/qif-parse.scm:

Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in	2006-11-24 10:38:39 UTC (rev 15131)
+++ gnucash/trunk/configure.in	2006-11-24 13:14:41 UTC (rev 15132)
@@ -836,10 +836,17 @@
 ### --------------------------------------------------------------------------
 ### i18n
 
+# This variable is set by GLIB_WITH_NLS, called through
+# AM_GLIB_GNU_GETTEXT above, and it is "lib" on e.g. windows
+if test "x$DATADIRNAME" = "x"; then
+  DATADIRNAME="share"
+  AC_SUBST(DATADIRNAME)
+fi
+
 AC_ARG_WITH( locale-dir, 
   [  --with-locale-dir=PATH    specify where to look for locale-specific information],
   LOCALE_DIR="$with_locale_dir",
-  LOCALE_DIR="\${prefix}/share/locale")
+  LOCALE_DIR="\${prefix}/${DATADIRNAME}/locale")
 
 AC_SUBST(LOCALE_DIR)
 

Modified: gnucash/trunk/src/engine/Makefile.am
===================================================================
--- gnucash/trunk/src/engine/Makefile.am	2006-11-24 10:38:39 UTC (rev 15131)
+++ gnucash/trunk/src/engine/Makefile.am	2006-11-24 13:14:41 UTC (rev 15132)
@@ -182,6 +182,7 @@
 	rm -f $@.tmp
 	sed < $< > $@.tmp \
 		-e 's#@-LOCALE_DIR-@#${LOCALE_DIR}#g' \
+		-e 's#@-DATADIRNAME-@#${DATADIRNAME}#g' \
 		-e 's#@-GNC_ACCOUNTS_DIR-@#${GNC_ACCOUNTS_DIR}#g' \
 		-e 's#@-GNC_GLADE_DIR-@#${GNC_GLADE_DIR}#g' \
 		-e 's#@-GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY-@#${GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY}#g' \

Modified: gnucash/trunk/src/engine/binreloc.c
===================================================================
--- gnucash/trunk/src/engine/binreloc.c	2006-11-24 10:38:39 UTC (rev 15131)
+++ gnucash/trunk/src/engine/binreloc.c	2006-11-24 13:14:41 UTC (rev 15132)
@@ -590,39 +590,6 @@
 }
 
 
-/** Locate the application's localization folder.
- *
- * The path is generated by the following pseudo-code evaluation:
- * \code
- * prefix + "/share/locale"
- * \endcode
- *
- * @param default_locale_dir  A default path which will used as fallback.
- * @return A string containing the localization folder's path, which must be freed when
- *         no longer necessary. If BinReloc is not initialized, or if the
- *         initialization function failed, then a copy of default_locale_dir will be returned.
- *         If default_locale_dir is NULL, then NULL will be returned.
- */
-gchar *
-gbr_find_locale_dir (const gchar *default_locale_dir)
-{
-	gchar *data_dir, *dir;
-
-	data_dir = gbr_find_data_dir (NULL);
-	if (data_dir == NULL) {
-		/* BinReloc not initialized. */
-		if (default_locale_dir != NULL)
-			return g_strdup (default_locale_dir);
-		else
-			return NULL;
-	}
-
-	dir = g_build_filename (data_dir, "locale", NULL);
-	g_free (data_dir);
-	return dir;
-}
-
-
 /** Locate the application's library folder.
  *
  * The path is generated by the following pseudo-code evaluation:

Modified: gnucash/trunk/src/engine/binreloc.h
===================================================================
--- gnucash/trunk/src/engine/binreloc.h	2006-11-24 10:38:39 UTC (rev 15131)
+++ gnucash/trunk/src/engine/binreloc.h	2006-11-24 13:14:41 UTC (rev 15132)
@@ -41,7 +41,6 @@
 	#define gbr_find_bin_dir     ffEt66859784967989_gbr_find_bin_dir
 	#define gbr_find_sbin_dir    ffEt66859784967989_gbr_find_sbin_dir
 	#define gbr_find_data_dir    ffEt66859784967989_gbr_find_data_dir
-	#define gbr_find_locale_dir  ffEt66859784967989_gbr_find_locale_dir
 	#define gbr_find_lib_dir     ffEt66859784967989_gbr_find_lib_dir
 	#define gbr_find_libexec_dir ffEt66859784967989_gbr_find_libexec_dir
 	#define gbr_find_etc_dir     ffEt66859784967989_gbr_find_etc_dir
@@ -57,7 +56,6 @@
 gchar   *gbr_find_bin_dir     (const gchar *default_bin_dir);
 gchar   *gbr_find_sbin_dir    (const gchar *default_sbin_dir);
 gchar   *gbr_find_data_dir    (const gchar *default_data_dir);
-gchar   *gbr_find_locale_dir  (const gchar *default_locale_dir);
 gchar   *gbr_find_lib_dir     (const gchar *default_lib_dir);
 gchar   *gbr_find_libexec_dir (const gchar *default_libexec_dir);
 gchar   *gbr_find_etc_dir     (const gchar *default_etc_dir);

Modified: gnucash/trunk/src/engine/gnc-path.c
===================================================================
--- gnucash/trunk/src/engine/gnc-path.c	2006-11-24 10:38:39 UTC (rev 15131)
+++ gnucash/trunk/src/engine/gnc-path.c	2006-11-24 13:14:41 UTC (rev 15132)
@@ -100,8 +100,11 @@
  * @returns A newly allocated string. */
 gchar *gnc_path_get_localedir()
 {
-  //printf("Returning localedir %s\n", gbr_find_locale_dir (LOCALE_DIR));
-  return gbr_find_locale_dir (LOCALE_DIR);
+  gchar *prefix = gnc_path_get_prefix();
+  gchar *result = g_build_filename (prefix, LOCALE_DATADIRNAME, "locale", (char*)NULL);
+  g_free (prefix);
+  //printf("Returning localedir %s\n", result);
+  return result;
 }
 
 /** Returns the glade file path, usually

Modified: gnucash/trunk/src/engine/gncla-dir.h.in
===================================================================
--- gnucash/trunk/src/engine/gncla-dir.h.in	2006-11-24 10:38:39 UTC (rev 15131)
+++ gnucash/trunk/src/engine/gncla-dir.h.in	2006-11-24 13:14:41 UTC (rev 15132)
@@ -31,6 +31,7 @@
 #define PKGLIBDIR "@-pkglibdir-@"
 
 #define LOCALE_DIR  "@-LOCALE_DIR-@"
+#define LOCALE_DATADIRNAME "@-DATADIRNAME-@"
 
 #define GNC_ACCOUNTS_DIR "@-GNC_ACCOUNTS_DIR-@"
 #define GNC_GLADE_DIR "@-GNC_GLADE_DIR-@"



More information about the gnucash-changes mailing list