summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6b60eda)
2005-08-16 Carlos Garcia Campos <carlosgc@gnome.org>
* ps/ps-document.c: convert filename to utf8 when there is an error
loading document. Fixes #309915
+2005-08-16 Carlos Garcia Campos <carlosgc@gnome.org>
+
+ * ps/ps-document.c: convert filename to utf8 when there is an error
+ loading document. Fixes #309915
+
2005-08-16 Marco Pesenti Gritti <mpg@redhat.com>
* configure.ac:
2005-08-16 Marco Pesenti Gritti <mpg@redhat.com>
* configure.ac:
static void
setup_page (PSDocument *gs, int page, double scale)
{
static void
setup_page (PSDocument *gs, int page, double scale)
{
int urx, ury, llx, lly, orientation;
char scaled_xdpi[G_ASCII_DTOSTR_BUF_SIZE];
char scaled_ydpi[G_ASCII_DTOSTR_BUF_SIZE];
int urx, ury, llx, lly, orientation;
char scaled_xdpi[G_ASCII_DTOSTR_BUF_SIZE];
char scaled_ydpi[G_ASCII_DTOSTR_BUF_SIZE];
g_ascii_dtostr (scaled_xdpi, G_ASCII_DTOSTR_BUF_SIZE, get_xdpi (gs) * scale);
g_ascii_dtostr (scaled_ydpi, G_ASCII_DTOSTR_BUF_SIZE, get_ydpi (gs) * scale);
g_ascii_dtostr (scaled_xdpi, G_ASCII_DTOSTR_BUF_SIZE, get_xdpi (gs) * scale);
g_ascii_dtostr (scaled_ydpi, G_ASCII_DTOSTR_BUF_SIZE, get_ydpi (gs) * scale);
- g_snprintf (buf, 1024, "%ld %d %d %d %d %d %s %s %d %d %d %d",
- 0L, orientation * 90, llx, lly, urx, ury,
- scaled_xdpi, scaled_ydpi,
- 0, 0, 0, 0);
+ buf = g_strdup_printf ("%ld %d %d %d %d %d %s %s %d %d %d %d",
+ 0L, orientation * 90, llx, lly, urx, ury,
+ scaled_xdpi, scaled_ydpi,
+ 0, 0, 0, 0);
LOG ("GS property %s", buf);
gdk_property_change (gs->pstarget, gs_class->gs_atom, gs_class->string_atom,
8, GDK_PROP_MODE_REPLACE, (guchar *)buf, strlen(buf));
LOG ("GS property %s", buf);
gdk_property_change (gs->pstarget, gs_class->gs_atom, gs_class->string_atom,
8, GDK_PROP_MODE_REPLACE, (guchar *)buf, strlen(buf));
/* sucessfully uncompressed file */
gs->gs_filename_unc = filename_unc;
} else {
/* sucessfully uncompressed file */
gs->gs_filename_unc = filename_unc;
} else {
+ gchar *utf8 = NULL;
+ gchar *msg;
+
- g_snprintf (buf, 1024, _("Error while decompressing file %s:\n"),
- gs->gs_filename);
- interpreter_failed (gs, buf);
+ utf8 = g_locale_to_utf8 (gs->gs_filename, -1, NULL, NULL, NULL);
+
+ if (utf8) {
+ msg = g_strdup_printf (_("Error while decompressing file %s:\n"), utf8);
+ } else {
+ msg = g_strdup (_("Error while decompressing file\n"));
+ }
+
+ g_free (utf8);
+
+ interpreter_failed (gs, msg);
+ g_free (msg);
unlink (filename_unc);
g_free (filename_unc);
filename_unc = NULL;
unlink (filename_unc);
g_free (filename_unc);
filename_unc = NULL;
gchar *filename = NULL;
if (!file_readable(fname)) {
gchar *filename = NULL;
if (!file_readable(fname)) {
+ gchar *utf8 = NULL;
+ gchar *msg;
+
+ utf8 = g_locale_to_utf8 (fname, -1, NULL, NULL, NULL);
- g_snprintf (buf, 1024, _("Cannot open file %s.\n"), fname);
- interpreter_failed (gs, buf);
+ if (utf8) {
+ msg = g_strdup_printf (_("Cannot open file %s.\n"), utf8);
+ } else {
+ msg = g_strdup (_("Cannot open file.\n"));
+ }
+
+ g_free (utf8);
+
+ interpreter_failed (gs, msg);
+ g_free (msg);
gs->gs_status = _("File is not readable.");
} else {
filename = check_filecompressed(gs);
gs->gs_status = _("File is not readable.");
} else {
filename = check_filecompressed(gs);
result = document_load (PS_DOCUMENT (document), filename);
if (!result) {
result = document_load (PS_DOCUMENT (document), filename);
if (!result) {
- g_set_error (error, G_FILE_ERROR,
- G_FILE_ERROR_FAILED,
- "Failed to load document '%s'\n",
- uri);
+ gchar *utf8 = NULL;
+
+ utf8 = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+ if (utf8) {
+ g_set_error (error, G_FILE_ERROR,
+ G_FILE_ERROR_FAILED,
+ _("Failed to load document '%s'"),
+ utf8);
+ } else {
+ g_set_error (error, G_FILE_ERROR,
+ G_FILE_ERROR_FAILED,
+ _("Failed to load document"));
+ }
+
+ g_free (utf8);