mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Automatically update the gconf search path on windows. Add a
force_slashes parameter to gnc_path_get_gconfdir to get a slash separated path instead of using G_DIR_SEPARATOR (backslash). git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15067 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ee447a796e
commit
d3ded67d47
@ -121,11 +121,23 @@ gchar *gnc_path_get_accountsdir()
|
||||
* "$prefix/etc/gconf/gconf.xml.defaults".
|
||||
*
|
||||
* @returns A newly allocated string. */
|
||||
gchar *gnc_path_get_gconfdir()
|
||||
gchar *gnc_path_get_gconfdir(gboolean force_slashes)
|
||||
{
|
||||
gchar *sysconfdir = gbr_find_etc_dir (SYSCONFDIR);
|
||||
gchar *result = g_build_filename (sysconfdir, "gconf",
|
||||
"gconf.xml.defaults", (char*)NULL);
|
||||
gchar *separator = G_DIR_SEPARATOR_S;
|
||||
gchar *result;
|
||||
|
||||
if (force_slashes) {
|
||||
gchar **splitted;
|
||||
splitted = g_strsplit (sysconfdir, "\\", -1);
|
||||
g_free (sysconfdir);
|
||||
sysconfdir = g_strjoinv ("/", splitted);
|
||||
g_strfreev (splitted);
|
||||
separator = "/";
|
||||
}
|
||||
|
||||
result = g_build_path (separator, sysconfdir, "gconf", "gconf.xml.defaults",
|
||||
(gchar*)NULL);
|
||||
g_free (sysconfdir);
|
||||
//printf("Returning gconfdir %s\n", result);
|
||||
return result;
|
||||
|
@ -77,8 +77,11 @@ gchar *gnc_path_get_accountsdir(void);
|
||||
/** Returns the gconf schema config source path, usually
|
||||
* "$prefix/etc/gconf/gconf.xml.defaults".
|
||||
*
|
||||
* @param force_slashes Use slashes as separator of the elements
|
||||
* of the path.
|
||||
*
|
||||
* @returns A newly allocated string. */
|
||||
gchar *gnc_path_get_gconfdir(void);
|
||||
gchar *gnc_path_get_gconfdir(gboolean force_slashes);
|
||||
|
||||
|
||||
|
||||
|
@ -152,7 +152,7 @@ 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);
|
||||
gconfdir = gnc_path_get_gconfdir ();
|
||||
gconfdir = gnc_path_get_gconfdir (TRUE);
|
||||
fprintf(output, PATH_STRING2, gconfdir);
|
||||
g_free (gconfdir);
|
||||
fprintf(output, "############## End of lines added by GnuCash. ##############\n");
|
||||
@ -287,7 +287,7 @@ druid_gconf_update_page_prepare (GnomeDruidPage *druidpage,
|
||||
GtkTextBuffer *textbuffer;
|
||||
GtkWidget *textview;
|
||||
gchar *msg;
|
||||
gchar *gconfdir = gnc_path_get_gconfdir ();
|
||||
gchar *gconfdir = gnc_path_get_gconfdir (TRUE);
|
||||
|
||||
textview = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "update_text");
|
||||
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
|
||||
@ -614,6 +614,25 @@ druid_gconf_install_check_schemas (void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
{
|
||||
/* automatically update the search path on windows */
|
||||
GError *error = NULL;
|
||||
if (!druid_gconf_update_path (&error)) {
|
||||
gnc_error_dialog (NULL, error->message);
|
||||
g_error_free (error);
|
||||
exit(42);
|
||||
} else {
|
||||
if (!g_spawn_command_line_sync("gconftool-2 --shutdown", NULL, NULL,
|
||||
NULL, &error)) {
|
||||
gnc_warning_dialog(NULL, error->message);
|
||||
g_error_free(error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
xml = gnc_glade_xml_new ("druid-gconf-setup.glade", "GConf Query");
|
||||
dialog = glade_xml_get_widget (xml, "GConf Query");
|
||||
do {
|
||||
|
Loading…
Reference in New Issue
Block a user