From 24368cf92dd5eaae1b41b3f191a25e2cbc45e824 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Thu, 25 May 2006 06:04:48 +0000 Subject: Added code to save/attach files/mails/events to/from remote shares svn path=/trunk/; revision=32023 --- e-util/e-util.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 73a1842919..bfafdc8771 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -39,6 +39,7 @@ #include #include #include +#include #ifdef G_OS_WIN32 #include @@ -238,6 +239,35 @@ e_write_file(const char *filename, const char *data, int flags) return 0; } +gint +e_write_file_uri (const char *filename, const char *data) +{ + guint64 length = strlen(data); + guint64 bytes; + GnomeVFSResult result; + GnomeVFSHandle *handle = NULL; + + result = gnome_vfs_create (&handle, filename, GNOME_VFS_OPEN_WRITE, TRUE, 0755); + if (result != GNOME_VFS_OK) { + g_warning ("Couldn't save item"); + return 1; + } + + while (length > 0) { + gnome_vfs_write(handle, data, length, &bytes); + if (bytes > 0) { + length -= bytes; + data += bytes; + } else { + gnome_vfs_close(handle); + return 1; + } + } + + gnome_vfs_close (handle); + return 0; +} + gint e_write_file_mkstemp(char *filename, const char *data) { -- cgit