r14776 - gnucash/trunk/src - For windows, determine glade and accounts path at runtime instead of configure time.

Christian Stimming cstim at cvs.gnucash.org
Fri Sep 1 11:25:26 EDT 2006


Author: cstim
Date: 2006-09-01 11:25:25 -0400 (Fri, 01 Sep 2006)
New Revision: 14776
Trac: http://svn.gnucash.org/trac/changeset/14776

Modified:
   gnucash/trunk/src/gnome-utils/dialog-utils.c
   gnucash/trunk/src/gnome/druid-hierarchy.c
Log:
For windows, determine glade and accounts path at runtime instead of configure time.

Modified: gnucash/trunk/src/gnome/druid-hierarchy.c
===================================================================
--- gnucash/trunk/src/gnome/druid-hierarchy.c	2006-08-30 16:55:36 UTC (rev 14775)
+++ gnucash/trunk/src/gnome/druid-hierarchy.c	2006-09-01 15:25:25 UTC (rev 14776)
@@ -194,7 +194,7 @@
 #endif
 
     i = strlen(locale);
-    ret = g_strdup_printf("%s/%s", top_dir, locale);
+    ret = g_build_filename(top_dir, locale, (char *)NULL);
 
     while (stat(ret, &buf) != 0)
     { 
@@ -202,12 +202,12 @@
 	if (i<1) 
 	{
 	    g_free(ret);
-	    ret = g_strdup_printf("%s/%s", top_dir, default_locale);
+	    ret = g_build_filename(top_dir, default_locale, (char *)NULL);
 	    break;
 	}
 	locale[i] = '\0';
 	g_free(ret);
-	ret = g_strdup_printf("%s/%s", top_dir, locale);
+	ret = g_build_filename(top_dir, locale, (char *)NULL);
     }
     
     g_free(locale);
@@ -358,6 +358,7 @@
 account_categories_tree_view_prepare (hierarchy_data  *data)
 {
 	GSList *list;
+	gchar *gnc_accounts_dir;
 	gchar *locale_dir;
 	GtkTreeView *tree_view;
 	GtkListStore *model;
@@ -366,9 +367,17 @@
 	GtkTreeSelection *selection;
 	GtkTreePath *path;
 
-	locale_dir = gnc_get_ea_locale_dir (GNC_ACCOUNTS_DIR);
+#ifdef G_OS_WIN32
+	gnc_accounts_dir = 
+	  g_win32_get_package_installation_subdirectory
+	  (GETTEXT_PACKAGE, NULL, "accounts");
+#else
+	gnc_accounts_dir = g_strdup (GNC_ACCOUNTS_DIR);
+#endif
+	locale_dir = gnc_get_ea_locale_dir (gnc_accounts_dir);
  	list = gnc_load_example_account_list (data->temporary,
 					      locale_dir);
+	g_free (gnc_accounts_dir);
 	g_free (locale_dir);
 
 	/* Prepare the account_categories GtkTreeView with a model and with some columns */

Modified: gnucash/trunk/src/gnome-utils/dialog-utils.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-utils.c	2006-08-30 16:55:36 UTC (rev 14775)
+++ gnucash/trunk/src/gnome-utils/dialog-utils.c	2006-09-01 15:25:25 UTC (rev 14776)
@@ -810,10 +810,7 @@
 {
   GladeXML *xml;
   char *fname;
-  const gchar *gnc_glade_dir = GNC_GLADE_DIR;
-  /* FIXME: On windows, gnc_glade_dir needs to be looked up
-     somewhere where it was specified at installation time instead
-     of compile time, e.g. in the registry. */
+  gchar *gnc_glade_dir;
 
   g_return_val_if_fail (filename != NULL, NULL);
   g_return_val_if_fail (root != NULL, NULL);
@@ -824,7 +821,15 @@
     glade_inited = TRUE;
   }
 
+#ifdef G_OS_WIN32
+  gnc_glade_dir = g_win32_get_package_installation_subdirectory
+    (GETTEXT_PACKAGE, NULL, "glade");
+#else
+  gnc_glade_dir = g_strdup (GNC_GLADE_DIR);
+#endif
+
   fname = g_build_filename(gnc_glade_dir, filename, (char *)NULL);
+  g_free (gnc_glade_dir);
 
   xml = glade_xml_new (fname, root, NULL);
 



More information about the gnucash-changes mailing list