Commit 26b8e7fb authored by Bastien Nocera's avatar Bastien Nocera

plparser: Make totem_pl_parser_write_buffer() cancellable

parent 5869e43a
......@@ -72,7 +72,7 @@ totem_pl_parser_save_pla (TotemPlParser *parser,
* the 'quick list' name there.
*/
strncpy (buffer + TITLE_OFFSET, title, TITLE_SIZE);
if (totem_pl_parser_write_buffer (G_OUTPUT_STREAM (stream), buffer, RECORD_SIZE, error) == FALSE)
if (totem_pl_parser_write_buffer (G_OUTPUT_STREAM (stream), buffer, RECORD_SIZE, cancellable, error) == FALSE)
{
DEBUG(output, g_print ("Couldn't write header block for '%s'", uri));
g_free (buffer);
......@@ -150,7 +150,7 @@ totem_pl_parser_save_pla (TotemPlParser *parser,
memcpy (buffer + PATH_OFFSET, converted, written);
g_free (converted);
if (totem_pl_parser_write_buffer (G_OUTPUT_STREAM (stream), buffer, RECORD_SIZE, error) == FALSE)
if (totem_pl_parser_write_buffer (G_OUTPUT_STREAM (stream), buffer, RECORD_SIZE, cancellable, error) == FALSE)
{
DEBUG1(g_print ("Couldn't write entry %d to the file\n", i));
ret = FALSE;
......
......@@ -135,6 +135,7 @@ gboolean totem_pl_parser_write_string (GOutputStream *stream,
gboolean totem_pl_parser_write_buffer (GOutputStream *stream,
const char *buf,
guint size,
GCancellable *cancellable,
GError **error);
char * totem_pl_parser_relative (GFile *output,
const char *filepath);
......
......@@ -873,6 +873,7 @@ totem_pl_parser_write_string (GOutputStream *stream, const char *buf, GError **e
* @stream: a #GFileOutputStream to an open file
* @buf: the string buffer to write out
* @len: the length of the string to write out
* @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: return location for a #GError, or %NULL
*
* Writes @len bytes of @buf to the file specified by @handle.
......@@ -882,14 +883,18 @@ totem_pl_parser_write_string (GOutputStream *stream, const char *buf, GError **e
* Return value: %TRUE on success
**/
gboolean
totem_pl_parser_write_buffer (GOutputStream *stream, const char *buf, guint len, GError **error)
totem_pl_parser_write_buffer (GOutputStream *stream,
const char *buf,
guint len,
GCancellable *cancellable,
GError **error)
{
gsize bytes_written;
if (g_output_stream_write_all (stream,
buf, len,
&bytes_written,
NULL, error) == FALSE) {
cancellable, error) == FALSE) {
g_object_unref (stream);
return FALSE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment