app: add gimp_xml_parser_parse_gfile()

This commit is contained in:
Michael Natterer 2014-07-01 02:29:30 +02:00
parent b7c78c5b97
commit 7be12ec523
3 changed files with 36 additions and 2 deletions

View File

@ -22,7 +22,7 @@
#include <string.h>
#include <glib-object.h>
#include <gio/gio.h>
#include "config-types.h"
@ -100,6 +100,37 @@ gimp_xml_parser_parse_file (GimpXmlParser *parser,
return success;
}
/**
* gimp_xml_parser_parse_gfile:
* @parser: a #GimpXmlParser
* @file: the #GFile to parse
* @error: return location for possible errors
*
* This function creates a GIOChannel for @file and calls
* gimp_xml_parser_parse_io_channel() for you.
*
* Return value: %TRUE on success, %FALSE otherwise
**/
gboolean
gimp_xml_parser_parse_gfile (GimpXmlParser *parser,
GFile *file,
GError **error)
{
gchar *path;
gboolean success;
g_return_val_if_fail (parser != NULL, FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
path = g_file_get_path (file);
success = gimp_xml_parser_parse_file (parser, path, error);
g_free (path);
return success;
}
/**
* gimp_xml_parser_parse_fd:
* @parser: a #GimpXmlParser

View File

@ -27,6 +27,9 @@ GimpXmlParser * gimp_xml_parser_new (const GMarkupParser *markup_pa
gboolean gimp_xml_parser_parse_file (GimpXmlParser *parser,
const gchar *filename,
GError **error);
gboolean gimp_xml_parser_parse_gfile (GimpXmlParser *parser,
GFile *file,
GError **error);
gboolean gimp_xml_parser_parse_fd (GimpXmlParser *parser,
gint fd,
GError **error);

View File

@ -22,7 +22,7 @@
#include <string.h>
#include <glib-object.h>
#include <gio/gio.h>
#include "config/config-types.h"
#include "config/gimpxmlparser.h"