css: Overhaul value parsing

Value parsing only sometimes emitted errors. Sometimes it didn't emit
errors but ignored the value, sometimes it took a default, sometimes it
converted it to something it deemed suitable.

While refactoring, I moved the whole GValue <=> char * conversion
routines to a separate file, to make navigating the core css provider
easier.
This commit is contained in:
Benjamin Otte 2011-04-08 16:08:28 +02:00
parent a50a06b583
commit a94ea9a4e3
4 changed files with 1667 additions and 1272 deletions

View File

@ -387,6 +387,7 @@ gtk_private_h_sources = \
gtkbuttonprivate.h \
gtkcellareaboxcontextprivate.h \
gtkcssproviderprivate.h \
gtkcssstringfuncsprivate.h \
gtkcustompaperunixdialog.h \
gtkdndcursors.h \
gtkentryprivate.h \
@ -512,6 +513,7 @@ gtk_base_c_sources = \
gtkcomboboxtext.c \
gtkcontainer.c \
gtkcssprovider.c \
gtkcssstringfuncs.c \
gtkdialog.c \
gtkdrawingarea.c \
gtkeditable.c \

File diff suppressed because it is too large Load Diff

1543
gtk/gtkcssstringfuncs.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_CSS_STRINGFUNCS_PRIVATE_H__
#define __GTK_CSS_STRINGFUNCS_PRIVATE_H__
#include <gtk/gtksymboliccolor.h>
G_BEGIN_DECLS
gboolean _gtk_css_value_from_string (GValue *value,
GFile *base,
const char *string,
GError **error);
char * _gtk_css_value_to_string (const GValue *value);
GtkSymbolicColor * _gtk_css_parse_symbolic_color (const char *str,
GError **error);
GFile * _gtk_css_parse_url (GFile *base,
const char *str,
char **end,
GError **error);
G_END_DECLS
#endif /* __GTK_CSS_STRINGFUNCS_PRIVATE_H__ */