[gimp] app: add gimp_xml_parser_parse_gfile()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_xml_parser_parse_gfile()
- Date: Tue, 1 Jul 2014 00:34:03 +0000 (UTC)
commit 7be12ec5233a5470ebfcdfb91b05f65a6f65514f
Author: Michael Natterer <mitch gimp org>
Date: Tue Jul 1 02:29:30 2014 +0200
app: add gimp_xml_parser_parse_gfile()
app/config/gimpxmlparser.c | 33 ++++++++++++++++++++++++++++++++-
app/config/gimpxmlparser.h | 3 +++
app/dialogs/tips-parser.c | 2 +-
3 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/app/config/gimpxmlparser.c b/app/config/gimpxmlparser.c
index 5804865..840d3d0 100644
--- a/app/config/gimpxmlparser.c
+++ b/app/config/gimpxmlparser.c
@@ -22,7 +22,7 @@
#include <string.h>
-#include <glib-object.h>
+#include <gio/gio.h>
#include "config-types.h"
@@ -101,6 +101,37 @@ gimp_xml_parser_parse_file (GimpXmlParser *parser,
}
/**
+ * 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
* @fd: a file descriptor
diff --git a/app/config/gimpxmlparser.h b/app/config/gimpxmlparser.h
index ffe4c1f..0b54911 100644
--- a/app/config/gimpxmlparser.h
+++ b/app/config/gimpxmlparser.h
@@ -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);
diff --git a/app/dialogs/tips-parser.c b/app/dialogs/tips-parser.c
index 637bfd6..add9ebf 100644
--- a/app/dialogs/tips-parser.c
+++ b/app/dialogs/tips-parser.c
@@ -22,7 +22,7 @@
#include <string.h>
-#include <glib-object.h>
+#include <gio/gio.h>
#include "config/config-types.h"
#include "config/gimpxmlparser.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]