aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2013-01-23 19:54:47 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2013-01-28 00:02:47 +0800
commit213b032a24ac9286af1f5ab3a4087d64eef12f52 (patch)
treee5c79c1a6d06a33cd9f615a438a6c44cc8e2393b /src
parentfdf27e6538f0aefb1f5d1f7fcc72d6e3668b8749 (diff)
downloadgsoc2013-epiphany-213b032a24ac9286af1f5ab3a4087d64eef12f52.tar
gsoc2013-epiphany-213b032a24ac9286af1f5ab3a4087d64eef12f52.tar.gz
gsoc2013-epiphany-213b032a24ac9286af1f5ab3a4087d64eef12f52.tar.bz2
gsoc2013-epiphany-213b032a24ac9286af1f5ab3a4087d64eef12f52.tar.lz
gsoc2013-epiphany-213b032a24ac9286af1f5ab3a4087d64eef12f52.tar.xz
gsoc2013-epiphany-213b032a24ac9286af1f5ab3a4087d64eef12f52.tar.zst
gsoc2013-epiphany-213b032a24ac9286af1f5ab3a4087d64eef12f52.zip
ephy-bookmarks-export: use g_file_set_contents() when saving to RDF
https://bugzilla.gnome.org/show_bug.cgi?id=691794
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks-export.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/bookmarks/ephy-bookmarks-export.c b/src/bookmarks/ephy-bookmarks-export.c
index 1c40dcaf9..adeea8a51 100644
--- a/src/bookmarks/ephy-bookmarks-export.c
+++ b/src/bookmarks/ephy-bookmarks-export.c
@@ -390,25 +390,24 @@ ephy_bookmarks_export_rdf (EphyBookmarks *bookmarks,
const char *file_path)
{
xmlTextWriterPtr writer;
- GFile *file, *tmp_file;
- char *tmp_file_path;
+ xmlBufferPtr buf;
+ GFile *file;
int ret;
LOG ("Exporting as RDF to %s", file_path);
START_PROFILER ("Exporting as RDF")
- tmp_file_path = g_strconcat (file_path, ".tmp", NULL);
- file = g_file_new_for_path (file_path);
- tmp_file = g_file_new_for_path (tmp_file_path);
-
+ buf = xmlBufferCreate ();
+ if (buf == NULL)
+ {
+ return;
+ }
/* FIXME: do we want to turn on compression here? */
- writer = xmlNewTextWriterFilename (tmp_file_path, 0);
+ writer = xmlNewTextWriterMemory (buf, 0);
if (writer == NULL)
{
- g_object_unref (file);
- g_object_unref (tmp_file);
- g_free (tmp_file);
+ xmlBufferFree (buf);
return;
}
@@ -418,23 +417,24 @@ ephy_bookmarks_export_rdf (EphyBookmarks *bookmarks,
ret = xmlTextWriterSetIndentString (writer, (xmlChar *) " ");
if (ret < 0) goto out;
+ file = g_file_new_for_path (file_path);
ret = write_rdf (bookmarks, file, writer);
+ g_object_unref (file);
if (ret < 0) goto out;
xmlFreeTextWriter (writer);
out:
if (ret >= 0)
{
- if (ephy_file_switch_temp_file (file, tmp_file) == FALSE)
+ if (g_file_set_contents (file_path,
+ (const char *)buf->content,
+ buf->use,
+ NULL) == FALSE)
{
ret = -1;
}
}
- g_object_unref (file);
- g_object_unref (tmp_file);
- g_free (tmp_file_path);
-
STOP_PROFILER ("Exporting as RDF")
LOG ("Exporting as RDF %s.", ret >= 0 ? "succeeded" : "FAILED");