#endif /* HAVE_GNOME */
static gchar *localedir;
+#if defined(ENABLE_BUNDLE) && defined(HAVE_GNOME)
+static const gchar *fonts_conf_dir;
+#endif /* defined(ENABLE_BUNDLE) && defined(HAVE_GNOME) */
#ifdef ENABLE_BUNDLE
-static gboolean locale_files_write(void)
+static void bundle_files_write(void)
{
gchar catalogs[]=G_STRINGIFY(CATALOGS);
gchar *catalog,*catalog_next;
+#ifdef HAVE_GNOME
+gchar fonts[]=G_STRINGIFY(GNOME_FONTS);
+gchar *font,*font_next;
+const gchar *fonts_data_dir,*fonts_conf_file,*fonts_conf_file_content;
+#endif /* HAVE_GNOME */
+const gchar *my_tmp_dir;
+ my_tmp_dir=udpgate_printf_alloca("%s/.%s-%s-%d",g_get_tmp_dir(),g_get_user_name(),PACKAGE,(int)getpid());
+
+ /* locale */
for (catalog=catalogs;*catalog;catalog=catalog_next) {
gchar *cc,*cc_end;
catalog, /* basename */
0644, /* pathname_mode */
BUNDLE_UTIL_MKDIRS_MASK|BUNDLE_UTIL_TEMPORARY_MASK)) { /* flags */
-const gchar *tmpdir=g_get_tmp_dir();
-const gchar *username=g_get_user_name();
-gchar *trylocaledir=localedir;
+gchar *trylocaledir;
- if (!trylocaledir && tmpdir && username)
- trylocaledir=g_strdup_printf("%s/.%s-%s/locale",tmpdir,username,PACKAGE);
- if (trylocaledir && bundle_util_file_write(
+ trylocaledir=localedir;
+ if (!trylocaledir)
+ trylocaledir=g_strdup_printf("%s/locale",my_tmp_dir);
+ if (bundle_util_file_write(
udpgate_printf_alloca("%s/%s/LC_MESSAGES/%s.mo",trylocaledir,cc,PACKAGE), /* pathname */
catalog, /* basename */
0644, /* pathname_mode */
BUNDLE_UTIL_MKDIRS_MASK|BUNDLE_UTIL_TEMPORARY_MASK)) /* flags */
localedir=trylocaledir;
+ else
+ g_free(trylocaledir);
}
}
g_free(cc);
}
- return FALSE;
+
+#ifdef HAVE_GNOME
+ /* Gnome */
+ fonts_conf_dir=udpgate_printf_alloca("%s/fonts",my_tmp_dir);
+ fonts_data_dir=udpgate_printf_alloca("%s/fonts-data",my_tmp_dir);
+ fonts_conf_file=udpgate_printf_alloca("%s/fonts.conf",fonts_conf_dir);
+
+ fonts_conf_file_content=udpgate_printf_alloca("\
+<?xml version=\"1.0\"?>\n\
+<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n\
+<fontconfig>\n\
+\t<dir>%s</dir>\n\
+</fontconfig>\n\
+",fonts_data_dir);
+ bundle_util_file_insert(fonts_conf_file_content,strlen(fonts_conf_file_content),"fonts.conf");
+
+ if (bundle_util_file_write(
+ fonts_conf_file, /* pathname */
+ "fonts.conf", /* basename */
+ 0644, /* pathname_mode */
+ BUNDLE_UTIL_MKDIRS_MASK|BUNDLE_UTIL_TEMPORARY_MASK)) { /* flags */
+ for (font=fonts;*font;font=font_next) {
+ for (font_next=font;*font_next && *font_next!=' ';font_next++);
+ if (*font_next)
+ *font_next++='\0';
+
+ /* errors ignored */
+ bundle_util_file_write(
+ udpgate_printf_alloca("%s/%s",fonts_data_dir,font), /* pathname */
+ font, /* basename */
+ 0644, /* pathname_mode */
+ BUNDLE_UTIL_MKDIRS_MASK|BUNDLE_UTIL_TEMPORARY_MASK); /* flags */
+ }
+ }
+#endif /* HAVE_GNOME */
}
#endif /* ENABLE_BUNDLE */
int exit_rc=EXIT_SUCCESS;
#ifdef ENABLE_BUNDLE
- locale_files_write();
+ bundle_files_write();
+
+#ifdef HAVE_GNOME
+ /* Prevent fontconfig loading: /etc/fonts/fonts.conf */
+ /* 'fonts_conf_dir' is created by: bundle_files_write() */
+ setenv("FONTCONFIG_PATH",fonts_conf_dir,
+ 1); /* overwrite */
+#endif /* HAVE_GNOME */
#endif /* ENABLE_BUNDLE */
#if 0
|G_LOG_LEVEL_INFO
|G_LOG_LEVEL_DEBUG
));
-#endif
+ setenv("GNOME_DISABLE_CRASH_DIALOG","1",1); /* HAVE_GNOME */
+#endif /* 0 */
/* Initialize the i18n stuff */
setlocale(LC_ALL,"");