gtk-css-engine r10 - in bzr-playground: . libccd/ccd src
- From: robsta svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk-css-engine r10 - in bzr-playground: . libccd/ccd src
- Date: Mon, 18 Aug 2008 13:50:46 +0000 (UTC)
Author: robsta
Date: Mon Aug 18 13:50:46 2008
New Revision: 10
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=10&view=rev
Log:
Refactor mapping between CSS and Gtk+ into a separate file.
Added:
bzr-playground/src/gce-node.c
bzr-playground/src/gce-node.h
Modified:
bzr-playground/ (props changed)
bzr-playground/libccd/ccd/ccd-image.c
bzr-playground/libccd/ccd/ccd-stylesheet.c
bzr-playground/src/Makefile.am
bzr-playground/src/gce-functions.c
bzr-playground/src/gce-style.c
bzr-playground/src/gce-style.h
bzr-playground/src/gce-theme.c
Modified: bzr-playground/libccd/ccd/ccd-image.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-image.c (original)
+++ bzr-playground/libccd/ccd/ccd-image.c Mon Aug 18 13:50:46 2008
@@ -147,8 +147,6 @@
ccd_image_parse (ccd_image_t *self,
CRTerm const *value)
{
- ccd_property_spec_t spec;
-
switch (value->type) {
case TERM_IDENT:
return ccd_property_parse_spec (value);
Modified: bzr-playground/libccd/ccd/ccd-stylesheet.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-stylesheet.c (original)
+++ bzr-playground/libccd/ccd/ccd-stylesheet.c Mon Aug 18 13:50:46 2008
@@ -197,12 +197,12 @@
}
/*
- * `base' is used for the recursion.
+ * `iter' is used for the recursion.
*/
static bool
collect_type_r (ccd_stylesheet_t const *self,
ccd_node_t const *node,
- ccd_node_t const *base,
+ ccd_node_t const *iter,
ccd_selector_group_t *result_group,
bool as_base)
{
@@ -213,18 +213,24 @@
node_class = ccd_node_get_class ();
- type_name = node_class->get_type (base);
+ if (!iter) {
+ iter = node;
+ }
+
+ type_name = node_class->get_type (iter);
ret = false;
if (type_name) {
+ ccd_node_t *base;
+
group = g_hash_table_lookup (self->type_rules, type_name);
if (group) {
ret = ccd_selector_group_query_collect (group, node, result_group, as_base);
}
/* Try to match base types. */
- base = node_class->get_base_style (base);
+ base = node_class->get_base_style (iter);
if (base) {
ret |= collect_type_r (self, node, base, result_group, true);
node_class->release (base);
@@ -280,12 +286,12 @@
}
/*
- * `base' is used for the recursion.
+ * `iter' is used for the recursion.
*/
static bool
apply_type_r (ccd_stylesheet_t const *self,
ccd_node_t const *node,
- ccd_node_t const *base,
+ ccd_node_t const *iter,
ccd_style_t *style)
{
ccd_node_class_t const *node_class;
@@ -295,18 +301,24 @@
node_class = ccd_node_get_class ();
- type_name = node_class->get_type (base);
+ if (!iter) {
+ iter = node;
+ }
+
+ type_name = node_class->get_type (iter);
ret = false;
if (type_name) {
+ ccd_node_t *base;
+
group = g_hash_table_lookup (self->type_rules, type_name);
if (group) {
ret = ccd_selector_group_query_apply (group, node, style);
}
/* Try to match base types. */
- base = node_class->get_base_style (base);
+ base = node_class->get_base_style (iter);
if (base) {
ret |= apply_type_r (self, node, base, style);
node_class->release (base);
Modified: bzr-playground/src/Makefile.am
==============================================================================
--- bzr-playground/src/Makefile.am (original)
+++ bzr-playground/src/Makefile.am Mon Aug 18 13:50:46 2008
@@ -19,6 +19,8 @@
gce-functions.h \
gce-maps.c \
gce-maps.h \
+ gce-node.c \
+ gce-node.h \
gce-rc-style.c \
gce-rc-style.h \
gce-style.c \
Modified: bzr-playground/src/gce-functions.c
==============================================================================
--- bzr-playground/src/gce-functions.c (original)
+++ bzr-playground/src/gce-functions.c Mon Aug 18 13:50:46 2008
@@ -27,7 +27,7 @@
g_return_val_if_fail (args, NULL);
uri = (char const *) args->data;
- gtk_rc_find_pixmap_in_path (gtk_settings_get_default (), NULL, uri);
+ return gtk_rc_find_pixmap_in_path (gtk_settings_get_default (), NULL, uri);
}
static ccd_function_t const _functions[] =
Added: bzr-playground/src/gce-node.c
==============================================================================
--- (empty file)
+++ bzr-playground/src/gce-node.c Mon Aug 18 13:50:46 2008
@@ -0,0 +1,295 @@
+/* Gtk CSS Engine
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include "gce-node.h"
+
+static struct {
+ GceNode nodes[GCE_NODE_CACHE_SIZE];
+ int cursor;
+} _node_cache = {
+ .cursor = -1
+};
+
+GceNode *
+gce_node_cache_get_top_node (void)
+{
+ return &_node_cache.nodes[_node_cache.cursor];
+}
+
+GceNode *
+gce_node_cache_fetch_node (void)
+{
+ GceNode *node;
+
+ g_assert (_node_cache.cursor < (GCE_NODE_CACHE_SIZE - 1));
+
+ _node_cache.cursor++;
+ node = &_node_cache.nodes[_node_cache.cursor];
+ memset (node, 0, sizeof (*node));
+
+ return node;
+}
+
+void
+gce_node_cache_release_node (GceNode *node)
+{
+ g_assert (_node_cache.cursor >= 0 &&
+ node == &_node_cache.nodes[_node_cache.cursor]);
+
+ _node_cache.cursor--;
+}
+
+static gboolean
+is_a (GceNode const *node,
+ char const *type_name)
+{
+ GType gtype;
+
+ switch (node->flavor) {
+ case PRIMITIVE:
+ if (0 == strcmp (type_name, node->impl.primitive)) {
+ return TRUE;
+ }
+ /* fall thru */
+ case UNSET:
+ case CONTAINER:
+ case TYPE:
+ gtype = g_type_from_name (type_name);
+ return g_type_is_a (G_OBJECT_TYPE (node->widget), gtype);
+ default:
+ g_assert_not_reached ();
+ return FALSE;
+ }
+}
+
+static GceNode *
+get_container (GceNode const *node)
+{
+ GceNode *container_node;
+ GtkWidget *container;
+
+ g_assert (node);
+
+ switch (node->flavor) {
+ case UNSET:
+ case CONTAINER:
+ container = gtk_widget_get_parent (node->widget);
+ if (container) {
+ container_node = gce_node_cache_fetch_node ();
+ container_node->flavor = CONTAINER;
+ container_node->widget = (GtkWidget *) g_object_ref (G_OBJECT (container));
+ container_node->impl.gtype = G_OBJECT_TYPE (G_OBJECT (container));
+ }
+ break;
+ case PRIMITIVE:
+ container_node = gce_node_cache_fetch_node ();
+ container_node->flavor = UNSET;
+ container_node->widget = (GtkWidget *) g_object_ref (G_OBJECT (node->widget));
+ container_node->impl.primitive = NULL;
+ break;
+ case TYPE:
+ g_assert_not_reached ();
+ /* fall thru */
+ default:
+ container_node = NULL;
+ }
+
+ return container_node;
+}
+
+static GceNode *
+get_base_style (GceNode const *node)
+{
+ GceNode *base_node;
+
+ g_assert (node);
+
+ switch (node->flavor) {
+ case UNSET:
+ if (GTK_TYPE_WIDGET == G_OBJECT_TYPE (G_OBJECT (node->widget))) {
+ /* already at top of inheritance hierarchy */
+ base_node = NULL;
+ } else {
+ /* inherit from superclass widget */
+ base_node = gce_node_cache_fetch_node ();
+ base_node->widget = (GtkWidget *) g_object_ref (node->widget);
+ base_node->flavor = TYPE;
+ base_node->impl.gtype = g_type_parent (G_OBJECT_TYPE (G_OBJECT (node->widget)));
+ }
+ break;
+ case CONTAINER:
+ if (GTK_TYPE_WIDGET == node->impl.gtype) {
+ /* already at top of inheritance hierarchy */
+ base_node = NULL;
+ } else {
+ /* inherit from superclass widget */
+ base_node = gce_node_cache_fetch_node ();
+ base_node->widget = (GtkWidget *) g_object_ref (node->widget);
+ base_node->flavor = CONTAINER;
+ base_node->impl.gtype = g_type_parent (node->impl.gtype);
+ }
+ break;
+ case PRIMITIVE:
+ base_node = NULL;
+ break;
+ case TYPE:
+ if (GTK_TYPE_WIDGET == node->impl.gtype) {
+ /* already at top of inheritance hierarchy */
+ base_node = NULL;
+ } else {
+ /* inherit from superclass widget */
+ base_node = gce_node_cache_fetch_node ();
+ base_node->widget = (GtkWidget *) g_object_ref (node->widget);
+ base_node->flavor = TYPE;
+ base_node->impl.gtype = g_type_parent (node->impl.gtype);
+ }
+ break;
+ default:
+ g_assert_not_reached ();
+ base_node = NULL;
+ }
+
+ return base_node;
+}
+
+static char const *
+get_id (GceNode const *node)
+{
+ g_return_val_if_fail (node, NULL);
+
+ switch (node->flavor) {
+ case UNSET:
+ case CONTAINER:
+ case PRIMITIVE:
+ return gtk_widget_get_name (node->widget);
+ case TYPE:
+ default:
+ g_assert_not_reached ();
+ return NULL;
+ }
+}
+
+static char const *
+get_type (GceNode const *node)
+{
+ g_return_val_if_fail (node, NULL);
+
+ switch (node->flavor) {
+ case UNSET:
+ return G_OBJECT_TYPE_NAME (G_OBJECT (node->widget));
+ case CONTAINER:
+ case TYPE:
+ return g_type_name (node->impl.gtype);
+ case PRIMITIVE:
+ g_assert (node->impl.primitive);
+ return node->impl.primitive;
+ default:
+ g_assert_not_reached ();
+ return NULL;
+ }
+}
+
+static char const *
+get_class (GceNode const *node)
+{
+ g_return_val_if_fail (node, NULL);
+
+ return node->class_name;
+}
+
+static char const *
+get_pseudo_class (GceNode const *node)
+{
+ g_return_val_if_fail (node, NULL);
+
+ return node->pseudo_class;
+}
+
+static char const *
+get_attribute (GceNode const *node,
+ char const *name)
+{
+ GValue property;
+ char const *value;
+
+ g_assert (node && node->widget);
+
+ if (node->flavor == TYPE) {
+ g_warning ("Querying attribute `%s' on something not a widget", name);
+ return NULL;
+ }
+
+ /* attributes provided in the drawing function take precedence */
+ if (0 == strcmp ("shadow", name)) {
+ return node->shadow;
+ } else if (0 == strcmp ("orientation", name)) {
+ return node->orientation;
+ } else if (0 == strcmp ("edge", name)) {
+ return node->edge;
+ } else if (0 == strcmp ("expander-style", name)) {
+ return node->expander_style;
+ }
+
+ /* now try to find an apropriate style property */
+ g_value_unset (&property);
+ gtk_widget_style_get_property (node->widget, name, &property);
+ value = NULL;
+ if (G_VALUE_HOLDS (&property, G_TYPE_BOOLEAN)) {
+ value = g_value_get_boolean (&property) ? "true" : "false";
+ } else if (G_VALUE_HOLDS (&property, G_TYPE_STRING)) {
+ value = g_value_get_string (&property);
+ } else {
+ g_warning ("Querying for properties of type `%s' is not supported yet.",
+ G_VALUE_TYPE_NAME (&property));
+ }
+
+ return value;
+}
+
+static void
+release (GceNode *node)
+{
+ g_assert (node == gce_node_cache_get_top_node ());
+
+ if (node->widget) {
+ g_object_unref (G_OBJECT (node->widget));
+ }
+
+ gce_node_cache_release_node (node);
+}
+
+static const ccd_node_class_t _node_class = {
+ .is_a = (ccd_node_is_a_f) is_a,
+ .get_container = (ccd_node_get_container_f) get_container,
+ .get_base_style = (ccd_node_get_base_style_f) get_base_style,
+ .get_id = (ccd_node_get_id_f) get_id,
+ .get_type = (ccd_node_get_type_f) get_type,
+ .get_class = (ccd_node_get_class_f) get_class,
+ .get_pseudo_class = (ccd_node_get_pseudo_class_f) get_pseudo_class,
+ .get_attribute = (ccd_node_get_attribute_f) get_attribute,
+ .release = (ccd_node_release_f) release
+};
+
+ccd_node_class_t const *
+gce_node_get_class (void)
+{
+ return &_node_class;
+}
+
Added: bzr-playground/src/gce-node.h
==============================================================================
--- (empty file)
+++ bzr-playground/src/gce-node.h Mon Aug 18 13:50:46 2008
@@ -0,0 +1,66 @@
+/* Gtk CSS Engine
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GCE_NODE_H
+#define GCE_NODE_H
+
+#include <ccd/ccd.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GCE_NODE_CACHE_SIZE 24
+
+/*
+ * TODO: split into load- and run-time variants?
+ */
+typedef struct {
+ ccd_node_t parent;
+ GtkWidget *widget;
+ /* custom attributes { */
+ char const *class_name;
+ char const *pseudo_class;
+ char const *shadow;
+ char const *orientation;
+ char const *edge;
+ char const *expander_style;
+ /* } */
+ enum {
+ UNSET,
+ CONTAINER,
+ PRIMITIVE,
+ TYPE
+ } flavor;
+ union {
+ char const *primitive;
+ GType gtype;
+ } impl;
+} GceNode;
+
+GceNode * gce_node_cache_get_top_node (void);
+GceNode * gce_node_cache_fetch_node (void);
+void gce_node_cache_release_node (GceNode *node);
+
+ccd_node_class_t const * gce_node_get_class (void);
+
+G_END_DECLS
+
+#endif /* GCE_NODE_H */
+
Modified: bzr-playground/src/gce-style.c
==============================================================================
--- bzr-playground/src/gce-style.c (original)
+++ bzr-playground/src/gce-style.c Mon Aug 18 13:50:46 2008
@@ -17,335 +17,22 @@
* Boston, MA 02111-1307, USA.
*/
-#include <string.h>
#include <gtk/gtk.h>
+#include "gce-maps.h"
+#include "gce-node.h"
#include "gce-rc-style.h"
#include "gce-style.h"
-#include "gce-maps.h"
-
-/* Implementation of hooks for the ccd library */
-
-enum GceNodeAttributeFlags {
- CLASS = 1 << 0,
- PSEUDO_CLASS = 1 << 1,
- SHADOW = 1 << 2
-};
-
-/*
- * TODO: split into load- and run-time variants?
- */
-typedef struct GceNode_ {
- ccd_node_t parent;
- GtkWidget *widget;
- /* custom attributes { */
- char const *class_name;
- char const *pseudo_class;
- char const *shadow;
- char const *orientation;
- char const *edge;
- char const *expander_style;
- /* } */
- enum {
- UNSET,
- CONTAINER,
- PRIMITIVE,
- TYPE
- } flavor;
- union {
- char const *primitive;
- GType gtype;
- } impl;
-} GceNode;
-
-#define NODE_CACHE_SIZE 24
-
-static struct GceNodeCache {
- GceNode nodes[NODE_CACHE_SIZE];
- int cursor;
-} _node_cache = {
- .cursor = -1
-};
-
-static GceNode *
-node_cache_top (struct GceNodeCache *cache)
-{
- g_assert (cache);
-
- return &cache->nodes[cache->cursor];
-}
-
-static GceNode *
-node_cache_push (struct GceNodeCache *cache)
-{
- GceNode *node;
-
- g_assert (cache && cache->cursor < (NODE_CACHE_SIZE - 1));
-
- cache->cursor++;
- node = &cache->nodes[cache->cursor];
- memset (node, 0, sizeof (*node));
-
- return node;
-}
-
-static void
-node_cache_pop (struct GceNodeCache *cache)
-{
- g_assert (cache && cache->cursor >= 0);
-
- cache->cursor--;
-}
-
-static gboolean
-is_a (GceNode const *node,
- char const *type_name)
-{
- GType gtype;
-
- switch (node->flavor) {
- case PRIMITIVE:
- if (0 == strcmp (type_name, node->impl.primitive)) {
- return TRUE;
- }
- /* fall thru */
- case UNSET:
- case CONTAINER:
- case TYPE:
- gtype = g_type_from_name (type_name);
- return g_type_is_a (G_OBJECT_TYPE (node->widget), gtype);
- default:
- g_assert_not_reached ();
- return FALSE;
- }
-}
-
-static GceNode *
-get_container (GceNode const *node)
-{
- GceNode *container_node;
- GtkWidget *container;
-
- g_assert (node);
-
- switch (node->flavor) {
- case UNSET:
- case CONTAINER:
- container = gtk_widget_get_parent (node->widget);
- if (container) {
- container_node = node_cache_push (&_node_cache);
- container_node->flavor = CONTAINER;
- container_node->widget = (GtkWidget *) g_object_ref (G_OBJECT (container));
- container_node->impl.gtype = G_OBJECT_TYPE (G_OBJECT (container));
- }
- break;
- case PRIMITIVE:
- container_node = node_cache_push (&_node_cache);
- container_node->flavor = UNSET;
- container_node->widget = (GtkWidget *) g_object_ref (G_OBJECT (node->widget));
- container_node->impl.primitive = NULL;
- break;
- case TYPE:
- g_assert_not_reached ();
- /* fall thru */
- default:
- container_node = NULL;
- }
-
- return container_node;
-}
-
-static GceNode *
-get_base_style (GceNode const *node)
-{
- GceNode *base_node;
-
- g_assert (node);
-
- switch (node->flavor) {
- case UNSET:
- if (GTK_TYPE_WIDGET == G_OBJECT_TYPE (G_OBJECT (node->widget))) {
- /* already at top of inheritance hierarchy */
- base_node = NULL;
- } else {
- /* inherit from superclass widget */
- base_node = node_cache_push (&_node_cache);
- base_node->widget = (GtkWidget *) g_object_ref (node->widget);
- base_node->flavor = TYPE;
- base_node->impl.gtype = g_type_parent (G_OBJECT_TYPE (G_OBJECT (node->widget)));
- }
- break;
- case CONTAINER:
- if (GTK_TYPE_WIDGET == node->impl.gtype) {
- /* already at top of inheritance hierarchy */
- base_node = NULL;
- } else {
- /* inherit from superclass widget */
- base_node = node_cache_push (&_node_cache);
- base_node->widget = (GtkWidget *) g_object_ref (node->widget);
- base_node->flavor = CONTAINER;
- base_node->impl.gtype = g_type_parent (node->impl.gtype);
- }
- break;
- case PRIMITIVE:
- base_node = NULL;
- break;
- case TYPE:
- if (GTK_TYPE_WIDGET == node->impl.gtype) {
- /* already at top of inheritance hierarchy */
- base_node = NULL;
- } else {
- /* inherit from superclass widget */
- base_node = node_cache_push (&_node_cache);
- base_node->widget = (GtkWidget *) g_object_ref (node->widget);
- base_node->flavor = TYPE;
- base_node->impl.gtype = g_type_parent (node->impl.gtype);
- }
- break;
- default:
- g_assert_not_reached ();
- base_node = NULL;
- }
-
- return base_node;
-}
-
-static char const *
-get_id (GceNode const *node)
-{
- g_return_val_if_fail (node, NULL);
-
- switch (node->flavor) {
- case UNSET:
- case CONTAINER:
- case PRIMITIVE:
- return gtk_widget_get_name (node->widget);
- case TYPE:
- default:
- g_assert_not_reached ();
- return NULL;
- }
-}
-
-static char const *
-get_type (GceNode const *node)
-{
- g_return_val_if_fail (node, NULL);
-
- switch (node->flavor) {
- case UNSET:
- return G_OBJECT_TYPE_NAME (G_OBJECT (node->widget));
- case CONTAINER:
- case TYPE:
- return g_type_name (node->impl.gtype);
- case PRIMITIVE:
- g_assert (node->impl.primitive);
- return node->impl.primitive;
- default:
- g_assert_not_reached ();
- return NULL;
- }
-}
-
-static char const *
-get_class (GceNode const *node)
-{
- g_return_val_if_fail (node, NULL);
-
- return node->class_name;
-}
-
-static char const *
-get_pseudo_class (GceNode const *node)
-{
- g_return_val_if_fail (node, NULL);
-
- return node->pseudo_class;
-}
-
-static char const *
-get_attribute (GceNode const *node,
- char const *name)
-{
- GValue property;
- char const *value;
-
- g_assert (node && node->widget);
-
- if (node->flavor == TYPE) {
- g_warning ("Querying attribute `%s' on something not a widget", name);
- return NULL;
- }
- /* attributes provided in the drawing function take precedence */
- if (0 == strcmp ("shadow", name)) {
- return node->shadow;
- } else if (0 == strcmp ("orientation", name)) {
- return node->orientation;
- } else if (0 == strcmp ("edge", name)) {
- return node->edge;
- } else if (0 == strcmp ("expander-style", name)) {
- return node->expander_style;
- }
-
- /* now try to find an apropriate style property */
- g_value_unset (&property);
- gtk_widget_style_get_property (node->widget, name, &property);
- value = NULL;
- if (G_VALUE_HOLDS (&property, G_TYPE_BOOLEAN)) {
- value = g_value_get_boolean (&property) ? "true" : "false";
- } else if (G_VALUE_HOLDS (&property, G_TYPE_STRING)) {
- value = g_value_get_string (&property);
- } else {
- g_warning ("Querying for properties of type `%s' is not supported yet.",
- G_VALUE_TYPE_NAME (&property));
- }
-
- return value;
-}
-
-static void
-release (GceNode *node)
-{
- g_assert (node == node_cache_top (&_node_cache));
-
- if (node->widget) {
- g_object_unref (G_OBJECT (node->widget));
- }
-
- node_cache_pop (&_node_cache);
-}
-
-static const ccd_node_class_t _node_class = {
- .is_a = (ccd_node_is_a_f) is_a,
- .get_container = (ccd_node_get_container_f) get_container,
- .get_base_style = (ccd_node_get_base_style_f) get_base_style,
- .get_id = (ccd_node_get_id_f) get_id,
- .get_type = (ccd_node_get_type_f) get_type,
- .get_class = (ccd_node_get_class_f) get_class,
- .get_pseudo_class = (ccd_node_get_pseudo_class_f) get_pseudo_class,
- .get_attribute = (ccd_node_get_attribute_f) get_attribute,
- .release = (ccd_node_release_f) release
-};
-
-ccd_node_class_t const *
-gce_style_get_ccd_node_class (void)
-{
- return &_node_class;
-}
-
-/* Implementation of the engine's GtkStyle subclass */
-
-struct _GceStyle
+struct GceStyle_
{
GtkStyle parent;
};
-struct _GceStyleClass
+struct GceStyleClass_
{
GtkStyleClass parent;
};
-
static GType gce_style_type = 0;
static GtkStyleClass *gce_style_parent_class = NULL;
@@ -501,14 +188,14 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
base->flavor = PRIMITIVE;
base->impl.primitive = "hline";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -516,8 +203,8 @@
line (self, node, base, window, area, widget, x1, x2, y, y);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -534,14 +221,14 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
base->flavor = PRIMITIVE;
base->impl.primitive = "vline";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -549,8 +236,8 @@
line (self, node, base, window, area, widget, x, x, y1, y2);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
@@ -570,7 +257,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -578,7 +265,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "shadow";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -588,8 +275,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -608,7 +295,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -616,7 +303,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "box";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -626,8 +313,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -646,7 +333,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -654,7 +341,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "flatbox";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -664,8 +351,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -684,7 +371,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -692,7 +379,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "check";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -702,8 +389,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -722,7 +409,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -730,7 +417,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "option";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -740,8 +427,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -763,7 +450,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -771,7 +458,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "shadow";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -781,8 +468,8 @@
gap (self, node, base, window, area, widget,
x, y, width, height, gap_side, gap_start, gap_width);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -804,7 +491,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -812,7 +499,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "box";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -822,8 +509,8 @@
gap (self, node, base, window, area, widget,
x, y, width, height, gap_side, gap_start, gap_width);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -844,7 +531,7 @@
GceNode *base;
gint gap_width;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -852,7 +539,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "extension";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -873,8 +560,8 @@
gap (self, node, base, window, area, widget,
x, y, width, height, gap_side, 0, gap_width);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -894,7 +581,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -903,7 +590,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "slider";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -914,8 +601,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -935,7 +622,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -944,7 +631,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "handle";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -955,8 +642,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -975,7 +662,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -983,7 +670,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "resizegrip";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -993,8 +680,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -1012,14 +699,14 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
base->flavor = PRIMITIVE;
base->impl.primitive = "focus";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -1028,8 +715,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, FALSE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -1059,7 +746,7 @@
}
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -1067,7 +754,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "expander";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -1077,8 +764,8 @@
rectangle (self, node, base, window, area, widget,
x, y, expander_size, expander_size, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
#undef DEFAULT_EXPANDER_SIZE
}
@@ -1098,7 +785,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -1106,7 +793,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "diamond";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -1116,8 +803,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -1138,7 +825,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -1147,7 +834,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "arrow";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -1158,8 +845,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
@@ -1178,7 +865,7 @@
GceNode *node;
GceNode *base;
- base = node_cache_push (&_node_cache);
+ base = gce_node_cache_fetch_node ();
base->widget = widget;
base->class_name = gce_maps_get_detail (detail);
base->pseudo_class = gce_maps_get_state (state);
@@ -1186,7 +873,7 @@
base->flavor = PRIMITIVE;
base->impl.primitive = "tab";
- node = node_cache_push (&_node_cache);
+ node = gce_node_cache_fetch_node ();
node->widget = widget;
node->class_name = base->class_name;
node->pseudo_class = base->pseudo_class;
@@ -1196,8 +883,8 @@
rectangle (self, node, base, window, area, widget,
x, y, width, height, TRUE);
- node_cache_pop (&_node_cache);
- node_cache_pop (&_node_cache);
+ gce_node_cache_release_node (node);
+ gce_node_cache_release_node (base);
}
static void
Modified: bzr-playground/src/gce-style.h
==============================================================================
--- bzr-playground/src/gce-style.h (original)
+++ bzr-playground/src/gce-style.h Mon Aug 18 13:50:46 2008
@@ -33,10 +33,8 @@
#define GCE_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCE_TYPE_STYLE))
#define GCE_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCE_TYPE_STYLE, GceStyleClass))
-typedef struct _GceStyle GceStyle;
-typedef struct _GceStyleClass GceStyleClass;
-
-ccd_node_class_t const * gce_style_get_ccd_node_class (void);
+typedef struct GceStyle_ GceStyle;
+typedef struct GceStyleClass_ GceStyleClass;
void gce_style_register_type (GTypeModule *module);
GType gce_style_get_type (void) G_GNUC_CONST;
Modified: bzr-playground/src/gce-theme.c
==============================================================================
--- bzr-playground/src/gce-theme.c (original)
+++ bzr-playground/src/gce-theme.c Mon Aug 18 13:50:46 2008
@@ -22,6 +22,7 @@
#include <gtk/gtk.h>
#include "gce-functions.h"
+#include "gce-node.h"
#include "gce-style.h"
#include "gce-rc-style.h"
@@ -40,7 +41,7 @@
gce_rc_style_register_type (module);
gce_style_register_type (module);
- node_class = gce_style_get_ccd_node_class ();
+ node_class = gce_node_get_class ();
vtable = gce_functions_get_vtable ();
ccd_init (node_class, vtable);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]