mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Replace every hard-coded directory path with the respective call to gnc_path.
(Except for the qsf and dwi backends, but they are not being maintained right now anyway.) git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14822 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
df175ce6b8
commit
d437f7f556
@ -33,7 +33,7 @@
|
||||
#include <libgnome/libgnome.h>
|
||||
#include "glib.h"
|
||||
#include "gnc-module.h"
|
||||
#include "i18n.h"
|
||||
#include "gnc-path.h"
|
||||
#include "gnc-version.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-filepath-utils.h"
|
||||
@ -491,14 +491,15 @@ inner_main (void *closure, int argc, char **argv)
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
|
||||
gchar *localedir = gnc_path_get_localedir ();
|
||||
#ifdef HAVE_GETTEXT
|
||||
/* setlocale (LC_ALL, ""); is already called by gtk_set_locale()
|
||||
via gtk_init(). */
|
||||
bindtextdomain (TEXT_DOMAIN, LOCALE_DIR);
|
||||
textdomain (TEXT_DOMAIN);
|
||||
bind_textdomain_codeset (TEXT_DOMAIN, "UTF-8");
|
||||
bindtextdomain (GETTEXT_PACKAGE, localedir);
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
#endif
|
||||
g_free (localedir);
|
||||
|
||||
gnc_module_system_init();
|
||||
envt_override();
|
||||
|
@ -42,7 +42,7 @@
|
||||
#define GNC_LIB_NAME "gnc-backend-file"
|
||||
|
||||
/* gnc-backend-file location */
|
||||
#include "gncla-dir.h"
|
||||
#include "gnc-path.h"
|
||||
|
||||
static GList * engine_init_hooks = NULL;
|
||||
static int engine_is_initialized = 0;
|
||||
@ -76,17 +76,17 @@ void
|
||||
gnc_engine_init(int argc, char ** argv)
|
||||
{
|
||||
static struct {
|
||||
const gchar* dir;
|
||||
const gchar* lib;
|
||||
gboolean required;
|
||||
} libs[] = {
|
||||
{ GNC_LIBDIR, GNC_LIB_NAME, TRUE },
|
||||
{ GNC_LIB_NAME, TRUE },
|
||||
/* shouldn't the PG gnc-module do this instead of US doing it? */
|
||||
{ GNC_LIBDIR, "gnc-backend-postgres", FALSE },
|
||||
{ NULL, NULL, FALSE } }, *lib;
|
||||
{ "gnc-backend-postgres", FALSE },
|
||||
{ NULL, FALSE } }, *lib;
|
||||
gnc_engine_init_hook_t hook;
|
||||
GList * cur;
|
||||
gchar *tracefilename;
|
||||
gchar *pkglibdir;
|
||||
|
||||
if (1 == engine_is_initialized) return;
|
||||
|
||||
@ -107,15 +107,16 @@ gnc_engine_init(int argc, char ** argv)
|
||||
/* Now register our core types */
|
||||
cashobjects_register();
|
||||
|
||||
for (lib = libs; lib->dir && lib->lib ; lib++)
|
||||
pkglibdir = gnc_path_get_pkglibdir ();
|
||||
for (lib = libs; lib->lib ; lib++)
|
||||
{
|
||||
if (qof_load_backend_library(lib->dir, lib->lib))
|
||||
if (qof_load_backend_library(pkglibdir, lib->lib))
|
||||
{
|
||||
engine_is_initialized = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message("failed to load %s from %s\n", lib->lib, lib->dir);
|
||||
g_message("failed to load %s from %s\n", lib->lib, pkglibdir);
|
||||
/* If this is a required library, stop now! */
|
||||
if (lib->required)
|
||||
{
|
||||
@ -123,6 +124,7 @@ gnc_engine_init(int argc, char ** argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
g_free (pkglibdir);
|
||||
|
||||
/* call any engine hooks */
|
||||
for (cur = engine_init_hooks; cur; cur = cur->next)
|
||||
|
@ -71,7 +71,14 @@ gchar *gnc_path_get_pkglibdir()
|
||||
* @returns A newly allocated string. */
|
||||
gchar *gnc_path_get_gladedir()
|
||||
{
|
||||
return g_strdup (GNC_GLADE_DIR);
|
||||
gchar *result;
|
||||
#ifdef G_OS_WIN32
|
||||
result = g_win32_get_package_installation_subdirectory
|
||||
(GETTEXT_PACKAGE, NULL, "share\\gnucash\\glade");
|
||||
#else
|
||||
result = g_strdup (GNC_GLADE_DIR);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Returns the localedir path, usually
|
||||
@ -89,7 +96,15 @@ gchar *gnc_path_get_localedir()
|
||||
* @returns A newly allocated string. */
|
||||
gchar *gnc_path_get_accountsdir()
|
||||
{
|
||||
return g_strdup (GNC_ACCOUNTS_DIR);
|
||||
gchar *result;
|
||||
#ifdef G_OS_WIN32
|
||||
result =
|
||||
g_win32_get_package_installation_subdirectory
|
||||
(GETTEXT_PACKAGE, NULL, "share\\gnucash\\accounts");
|
||||
#else
|
||||
result = g_strdup (GNC_ACCOUNTS_DIR);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Returns the gconf schema config source path, usually
|
||||
|
@ -6,10 +6,6 @@ pkglib_LTLIBRARIES = libgncmod-gnome-utils.la libgw-gnome-utils.la
|
||||
# Note that src/gnome-utils CANNOT depend on src/gnome!
|
||||
|
||||
AM_CFLAGS = \
|
||||
-DPREFIX=\"${prefix}\" \
|
||||
-DSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
|
||||
-DDATADIR=\"${GNC_SHAREDIR}\" \
|
||||
-DLIBDIR=\"${GNC_LIBDIR}\" \
|
||||
-I${top_srcdir}/src/core-utils \
|
||||
-I${top_srcdir}/src/gnc-module \
|
||||
-I${top_srcdir}/src/engine \
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-commodity.h"
|
||||
#include "Group.h"
|
||||
#include "gnc-dir.h"
|
||||
#include "gnc-path.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-euro.h"
|
||||
#include "gnc-ui-util.h"
|
||||
@ -821,13 +821,7 @@ gnc_glade_xml_new (const char *filename, const char *root)
|
||||
glade_inited = TRUE;
|
||||
}
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
gnc_glade_dir = g_win32_get_package_installation_subdirectory
|
||||
(GETTEXT_PACKAGE, NULL, "share\\gnucash\\glade");
|
||||
#else
|
||||
gnc_glade_dir = g_strdup (GNC_GLADE_DIR);
|
||||
#endif
|
||||
|
||||
gnc_glade_dir = gnc_path_get_gladedir ();
|
||||
fname = g_build_filename(gnc_glade_dir, filename, (char *)NULL);
|
||||
g_free (gnc_glade_dir);
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "dialog-utils.h"
|
||||
#include "druid-gconf-setup.h"
|
||||
#include "druid-utils.h"
|
||||
#include "gnc-dir.h"
|
||||
#include "gnc-path.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-gui-query.h"
|
||||
#include "gnc-gnome-utils.h"
|
||||
@ -113,6 +113,7 @@ druid_gconf_update_path (GError **error)
|
||||
gchar *contents, **lines, *line;
|
||||
gboolean found_user_dir = FALSE;
|
||||
FILE *output;
|
||||
gchar *gconfdir;
|
||||
|
||||
data_filename = g_build_filename(g_get_home_dir(), ".gconf", (char *)NULL);
|
||||
path_filename = g_build_filename(g_get_home_dir(), ".gconf.path", (char *)NULL);
|
||||
@ -151,7 +152,9 @@ druid_gconf_update_path (GError **error)
|
||||
fprintf(output, "\n######## The following lines were added by GnuCash. ########\n");
|
||||
if (!found_user_dir)
|
||||
fprintf(output, PATH_STRING1);
|
||||
fprintf(output, PATH_STRING2, GNC_GCONF_DIR);
|
||||
gconfdir = gnc_path_get_gconfdir ();
|
||||
fprintf(output, PATH_STRING2, gconfdir);
|
||||
g_free (gconfdir);
|
||||
fprintf(output, "############## End of lines added by GnuCash. ##############\n");
|
||||
if (fclose(output) != 0) {
|
||||
*error = g_error_new (G_FILE_ERROR,
|
||||
@ -284,11 +287,13 @@ druid_gconf_update_page_prepare (GnomeDruidPage *druidpage,
|
||||
GtkTextBuffer *textbuffer;
|
||||
GtkWidget *textview;
|
||||
gchar *msg;
|
||||
gchar *gconfdir = gnc_path_get_gconfdir ();
|
||||
|
||||
textview = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "update_text");
|
||||
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
|
||||
msg = g_strdup_printf(PATH_STRING1 PATH_STRING2, GNC_GCONF_DIR);
|
||||
msg = g_strdup_printf(PATH_STRING1 PATH_STRING2, gconfdir);
|
||||
gtk_text_buffer_set_text(textbuffer, msg, -1);
|
||||
g_free (gconfdir);
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "gnc-gnome-utils.h"
|
||||
#include "gnc-html.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-path.h"
|
||||
#include "gnc-ui.h"
|
||||
#include "gnc-file.h"
|
||||
#include "gnc-hooks.h"
|
||||
@ -193,12 +194,24 @@ gnc_gnome_init (int argc, char **argv, const char * version)
|
||||
{
|
||||
char *fullname;
|
||||
GError *error = NULL;
|
||||
gchar *prefix = gnc_path_get_prefix ();
|
||||
gchar *sysconfdir = gnc_path_get_sysconfdir ();
|
||||
gchar *datadir = gnc_path_get_datadir ();
|
||||
gchar *libdir = gnc_path_get_libdir ();
|
||||
|
||||
gnc_gtk_add_rc_file();
|
||||
gnucash_program = gnome_program_init(
|
||||
"gnucash", version, LIBGNOMEUI_MODULE,
|
||||
argc, argv,
|
||||
GNOME_PROGRAM_STANDARD_PROPERTIES, GNOME_PARAM_NONE);
|
||||
GNOME_PARAM_APP_PREFIX, prefix,
|
||||
GNOME_PARAM_APP_SYSCONFDIR, sysconfdir,
|
||||
GNOME_PARAM_APP_DATADIR, datadir,
|
||||
GNOME_PARAM_APP_LIBDIR, libdir,
|
||||
GNOME_PARAM_NONE);
|
||||
g_free (prefix);
|
||||
g_free (sysconfdir);
|
||||
g_free (datadir);
|
||||
g_free (libdir);
|
||||
|
||||
/* initialization required for gtkhtml */
|
||||
gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-hooks.h"
|
||||
#include "gnc-component-manager.h"
|
||||
#include "../gnome-utils/gnc-dir.h"
|
||||
#include "gnc-path.h"
|
||||
#include "gnc-gui-query.h"
|
||||
#include "gnc-tree-view-account.h"
|
||||
#include "gnc-ui-util.h"
|
||||
@ -367,13 +367,7 @@ account_categories_tree_view_prepare (hierarchy_data *data)
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreePath *path;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
gnc_accounts_dir =
|
||||
g_win32_get_package_installation_subdirectory
|
||||
(GETTEXT_PACKAGE, NULL, "share\\gnucash\\accounts");
|
||||
#else
|
||||
gnc_accounts_dir = g_strdup (GNC_ACCOUNTS_DIR);
|
||||
#endif
|
||||
gnc_accounts_dir = gnc_path_get_accountsdir ();
|
||||
locale_dir = gnc_get_ea_locale_dir (gnc_accounts_dir);
|
||||
list = gnc_load_example_account_list (data->temporary,
|
||||
locale_dir);
|
||||
|
Loading…
Reference in New Issue
Block a user