[gtk+] csssection: Remove file argument from constructor



commit 0e4670150aa4519d40e341b67d9c1377f9712749
Author: Benjamin Otte <otte redhat com>
Date:   Wed Apr 18 22:15:32 2012 +0200

    csssection: Remove file argument from constructor
    
    The parser has the file available.

 gtk/gtkcssprovider.c       |    3 +--
 gtk/gtkcsssection.c        |    9 ++++-----
 gtk/gtkcsssectionprivate.h |    3 +--
 3 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index d57ccd0..748bff7 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -1406,8 +1406,7 @@ gtk_css_scanner_push_section (GtkCssScanner     *scanner,
 
   section = _gtk_css_section_new (scanner->section,
                                   section_type,
-                                  scanner->parser,
-                                  scanner->file);
+                                  scanner->parser);
 
   if (scanner->section)
     gtk_css_section_unref (scanner->section);
diff --git a/gtk/gtkcsssection.c b/gtk/gtkcsssection.c
index 007a308..85fd064 100644
--- a/gtk/gtkcsssection.c
+++ b/gtk/gtkcsssection.c
@@ -49,13 +49,11 @@ G_DEFINE_BOXED_TYPE (GtkCssSection, gtk_css_section, gtk_css_section_ref, gtk_cs
 GtkCssSection *
 _gtk_css_section_new (GtkCssSection     *parent,
                       GtkCssSectionType  type,
-                      GtkCssParser      *parser,
-                      GFile             *file)
+                      GtkCssParser      *parser)
 {
   GtkCssSection *section;
 
   g_return_val_if_fail (parser != NULL, NULL);
-  g_return_val_if_fail (file == NULL || G_IS_FILE (file), NULL);
 
   section = g_slice_new0 (GtkCssSection);
 
@@ -63,8 +61,9 @@ _gtk_css_section_new (GtkCssSection     *parent,
   section->section_type = type;
   if (parent)
     section->parent = gtk_css_section_ref (parent);
-  if (file)
-    section->file = g_object_ref (file);
+  section->file = _gtk_css_parser_get_file (parser);
+  if (section->file)
+    g_object_ref (section->file);
   section->start_line = _gtk_css_parser_get_line (parser);
   section->start_position = _gtk_css_parser_get_position (parser);
   section->parser = parser;
diff --git a/gtk/gtkcsssectionprivate.h b/gtk/gtkcsssectionprivate.h
index ddf7b37..12c13aa 100644
--- a/gtk/gtkcsssectionprivate.h
+++ b/gtk/gtkcsssectionprivate.h
@@ -26,8 +26,7 @@ G_BEGIN_DECLS
 
 GtkCssSection *    _gtk_css_section_new                (GtkCssSection        *parent,
                                                         GtkCssSectionType     type,
-                                                        GtkCssParser         *parser,
-                                                        GFile                *file);
+                                                        GtkCssParser         *parser);
 GtkCssSection *    _gtk_css_section_new_for_file       (GtkCssSectionType     type,
                                                         GFile                *file);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]