aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2005-11-25 23:43:24 +0800
committerTor Lillqvist <tml@src.gnome.org>2005-11-25 23:43:24 +0800
commitf7750eddc35b618c2166004fe020a33a82b31792 (patch)
treeac3abfa58acd4327338ff502f31e2d78ee8d2f89
parente52ac86fca49e157eb21af1c68099301a7714998 (diff)
downloadgsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.tar
gsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.tar.gz
gsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.tar.bz2
gsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.tar.lz
gsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.tar.xz
gsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.tar.zst
gsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.zip
Use g_filename_from_uri() instead of just stripping off the "file://"
2005-11-25 Tor Lillqvist <tml@novell.com> * importers/evolution-ldif-importer.c (ldif_import): Use g_filename_from_uri() instead of just stripping off the "file://" prefix for Win32 portability. Use gstdio wrappers for better non-ASCII filename support on Windows. svn path=/trunk/; revision=30673
-rw-r--r--addressbook/ChangeLog4
-rw-r--r--addressbook/importers/evolution-ldif-importer.c10
2 files changed, 12 insertions, 2 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index e8ee5b536d..98b5f7f70c 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,9 +1,13 @@
2005-11-25 Tor Lillqvist <tml@novell.com>
+ * importers/evolution-ldif-importer.c (ldif_import)
* gui/widgets/eab-gui-util.c (eab_load_error_dialog): Use
g_filename_from_uri() instead of just stripping off the "file://"
prefix for Win32 portability.
+ * importers/evolution-ldif-importer.c (ldif_import): Use gstdio
+ wrappers for better non-ASCII filename support on Windows.
+
* gui/component/addressbook-component.c (ensure_sources): Use
g_filename_to_uri() instead of just prefixing "file://" for Win32
portability.
diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c
index e37d579726..dfec5dfc51 100644
--- a/addressbook/importers/evolution-ldif-importer.c
+++ b/addressbook/importers/evolution-ldif-importer.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <glib/gstdio.h>
#include <gtk/gtkvbox.h>
@@ -690,8 +691,9 @@ ldif_import(EImport *ei, EImportTarget *target, EImportImporter *im)
{
LDIFImporter *gci;
EBook *book;
- FILE *file;
+ FILE *file = NULL;
EImportTargetURI *s = (EImportTargetURI *)target;
+ gchar *filename;
book = e_book_new(g_datalist_get_data(&target->data, "ldif-source"), NULL);
if (book == NULL) {
@@ -700,7 +702,11 @@ ldif_import(EImport *ei, EImportTarget *target, EImportImporter *im)
return;
}
- file = fopen(s->uri_src+7, "r");
+ filename = g_filename_from_uri(s->uri_src, NULL, NULL);
+ if (filename != NULL) {
+ file = g_fopen(filename, "r");
+ g_free (filename);
+ }
if (file == NULL) {
g_message(G_STRLOC ":Can't open .ldif file");
e_import_complete(ei, target);