diff options
author | Benjamin Otte <otte@redhat.com> | 2012-04-18 16:54:04 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-05-11 16:42:11 +0200 |
commit | a65780902a0b3a0497cf9c021f8a0d3e49a87cbd (patch) | |
tree | 666a43e47c3b80c9d2f89ce6d824b0e3d5780942 /gtk/gtkcssparser.c | |
parent | a8d8c02ab756db3b78a7c0714997cc847f8e4f3e (diff) | |
download | gtk+-a65780902a0b3a0497cf9c021f8a0d3e49a87cbd.tar.gz |
cssparser: Keep track of the file
Diffstat (limited to 'gtk/gtkcssparser.c')
-rw-r--r-- | gtk/gtkcssparser.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gtk/gtkcssparser.c b/gtk/gtkcssparser.c index 62d911324c..7d3fa95274 100644 --- a/gtk/gtkcssparser.c +++ b/gtk/gtkcssparser.c @@ -38,26 +38,31 @@ struct _GtkCssParser { - const char *data; - GtkCssParserErrorFunc error_func; - gpointer user_data; + const char *data; + GFile *file; + GtkCssParserErrorFunc error_func; + gpointer user_data; - const char *line_start; - guint line; + const char *line_start; + guint line; }; GtkCssParser * _gtk_css_parser_new (const char *data, + GFile *file, GtkCssParserErrorFunc error_func, gpointer user_data) { GtkCssParser *parser; g_return_val_if_fail (data != NULL, NULL); + g_return_val_if_fail (file == NULL || G_IS_FILE (file), NULL); parser = g_slice_new0 (GtkCssParser); parser->data = data; + if (file) + parser->file = g_object_ref (file); parser->error_func = error_func; parser->user_data = user_data; @@ -72,6 +77,9 @@ _gtk_css_parser_free (GtkCssParser *parser) { g_return_if_fail (GTK_IS_CSS_PARSER (parser)); + if (parser->file) + g_object_unref (parser->file); + g_slice_free (GtkCssParser, parser); } |