diff options
author | Robert Staudinger <robsta@gnome.org> | 2008-12-04 15:35:45 +0100 |
---|---|---|
committer | Robert Staudinger <robsta@gnome.org> | 2008-12-04 15:35:45 +0100 |
commit | f3fddd34e54b7b7905a6ca1c0bafa5bc29cfae5b (patch) | |
tree | 0a9c0cb742afbca6023ab7e53c258ba00be75d9c /ccss-gtk | |
parent | 3ab12b00b0ce18f4a9fa6d4e757212e72c62391b (diff) |
* ccss-gtk/Makefile.am:
* ccss-gtk/ccss-gtk-properties.c:
* ccss-gtk/ccss-gtk-properties.h:
* ccss-gtk/ccss-gtk-grammar.c:
Move gtkrc-property handling to ccss-gtk/ccss-gtk-grammar.c.
* ccss/ccss-property-generic.c: Implement generic properties through
a factory.
Diffstat (limited to 'ccss-gtk')
-rw-r--r-- | ccss-gtk/Makefile.am | 2 | ||||
-rw-r--r-- | ccss-gtk/ccss-gtk-grammar.c | 71 | ||||
-rw-r--r-- | ccss-gtk/ccss-gtk-properties.c | 35 | ||||
-rw-r--r-- | ccss-gtk/ccss-gtk-properties.h | 33 |
4 files changed, 65 insertions, 76 deletions
diff --git a/ccss-gtk/Makefile.am b/ccss-gtk/Makefile.am index 38e1f10..7bde7e4 100644 --- a/ccss-gtk/Makefile.am +++ b/ccss-gtk/Makefile.am @@ -22,8 +22,6 @@ libccss_gtk_1_la_SOURCES = \ $(headers_DATA) \ ccss-gtk.c \ ccss-gtk-grammar.c \ - ccss-gtk-properties.c \ - ccss-gtk-properties.h \ ccss-gtk-style.c headersdir = $(includedir)/libccss-1/ccss-gtk diff --git a/ccss-gtk/ccss-gtk-grammar.c b/ccss-gtk/ccss-gtk-grammar.c index feedbd2..4c612a5 100644 --- a/ccss-gtk/ccss-gtk-grammar.c +++ b/ccss-gtk/ccss-gtk-grammar.c @@ -21,6 +21,65 @@ #include "ccss-gtk-grammar.h" #include "config.h" +static ccss_property_class_t const *_generic_property_class = NULL; + +static bool +property_convert (ccss_property_base_t const *self, + ccss_property_type_t target, + void *value) +{ + return false; +} + +static bool +property_factory (ccss_grammar_t const *grammar, + ccss_block_t *block, + char const *name, + CRTerm const *values, + void *user_data) +{ + g_return_val_if_fail (grammar, false); + g_return_val_if_fail (block, false); + g_return_val_if_fail (name, false); + g_return_val_if_fail (values, false); + + /* PONDERING: Handle things like GtkSettings `gtk-button-images' in the future? */ + + if (0 == g_strcmp0 (name, "x-thickness")) { + // TODO + } else if (0 == g_strcmp0 (name, "y-thickness")) { + // TODO + } else if (g_str_has_prefix (name, "Gtk")) { + // TODO introspect style property + } else if (g_ascii_isupper (name[0])) { + // TODO introspect style property and feed back to gtk directly. + // Non-gtk style properties (wnck, nautilus, ...) can't be + // resolved offline because css2gtkrc doesn't link against them. + // May cause some breakage, let's see how it goes. + // TODO link css2gtkrc against gtk. + } + + + /* Fall back. */ + g_return_val_if_fail (_generic_property_class, false); + g_return_val_if_fail (_generic_property_class->property_factory, false); + return _generic_property_class->property_factory (grammar, block, name, + values, user_data); +} + +static ccss_property_class_t const _properties[] = { + { + .name = "*", + .property_create = NULL, + .property_destroy = (ccss_property_destroy_f) g_free, + .property_convert = (ccss_property_convert_f) property_convert, + .property_factory = property_factory, + .property_inherit = NULL + }, { + .name = NULL + } +}; + /** * ccss_gtk_grammar_create: * @@ -38,12 +97,12 @@ ccss_gtk_grammar_create (void) self = ccss_cairo_grammar_create (); - /* TODO add properties - ccss_grammar_add_properties (self, ccss_background_get_ptable ()); - ccss_grammar_add_properties (self, ccss_border_get_ptable ()); - ccss_grammar_add_properties (self, ccss_border_image_get_ptable ()); - ccss_grammar_add_properties (self, ccss_color_get_ptable ()); - */ + if (NULL == _generic_property_class) { + _generic_property_class = ccss_grammar_lookup_property (self, + "*"); + } + + /* TODO add properties */ return self; } diff --git a/ccss-gtk/ccss-gtk-properties.c b/ccss-gtk/ccss-gtk-properties.c deleted file mode 100644 index 99da4d5..0000000 --- a/ccss-gtk/ccss-gtk-properties.c +++ /dev/null @@ -1,35 +0,0 @@ -/* The Gtk+ CSS Drawing Library. - * Copyright (C) 2008 Robert Staudinger - * - * 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., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -#include "ccss-gtk-properties.h" - -static ccss_property_class_t const _properties[] = { - { - - }, { - .name = NULL - } -}; - -ccss_property_class_t const * -ccss_gtk_get_properties (void) -{ - -} - diff --git a/ccss-gtk/ccss-gtk-properties.h b/ccss-gtk/ccss-gtk-properties.h deleted file mode 100644 index 405a5cf..0000000 --- a/ccss-gtk/ccss-gtk-properties.h +++ /dev/null @@ -1,33 +0,0 @@ -/* The Gtk+ CSS Drawing Library. - * Copyright (C) 2008 Robert Staudinger - * - * 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., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -#ifndef CCSS_GTK_PROPERTIES_H -#define CCSS_GTK_PROPERTIES_H - -#include <ccss/ccss.h> - -CCSS_BEGIN_DECLS - -ccss_property_class_t const * -ccss_gtk_get_properties (void); - -CCSS_END_DECLS - -#endif /* CCSS_GTK_PROPERTIES_H */ - |