[gtk+/gtk-style-context: 73/347] GtkCssProvider: Add named regions to selector path.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 73/347] GtkCssProvider: Add named regions to selector path.
- Date: Thu, 11 Nov 2010 01:10:39 +0000 (UTC)
commit bed27cedba69d6791879b8d76c93f7cf986abf2f
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Apr 21 01:48:01 2010 +0200
GtkCssProvider: Add named regions to selector path.
gtk/gtkcssprovider.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 394c74e..1c5ee9e 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -41,6 +41,7 @@ enum SelectorElementType {
SELECTOR_TYPE_NAME,
SELECTOR_NAME,
SELECTOR_GTYPE,
+ SELECTOR_REGION,
SELECTOR_GLOB
};
@@ -58,6 +59,12 @@ struct SelectorElement
{
GQuark name;
GType type;
+
+ struct
+ {
+ GQuark name;
+ GtkChildClassFlags flags;
+ } region;
};
};
@@ -205,6 +212,23 @@ selector_path_prepend_glob (SelectorPath *path)
}
static void
+selector_path_prepend_region (SelectorPath *path,
+ const gchar *name,
+ GtkChildClassFlags flags)
+{
+ SelectorElement *elem;
+
+ elem = g_slice_new (SelectorElement);
+ elem->combinator = COMBINATOR_DESCENDANT;
+ elem->elem_type = SELECTOR_REGION;
+
+ elem->region.name = g_quark_from_string (name);
+ elem->region.flags = flags;
+
+ path->elements = g_slist_prepend (path->elements, elem);
+}
+
+static void
selector_path_prepend_combinator (SelectorPath *path,
CombinatorType combinator)
{
@@ -739,6 +763,9 @@ parse_selector (GtkCssProvider *css_provider,
else if (g_ascii_islower (scanner->value.v_identifier[0]))
{
GtkChildClassFlags flags = 0;
+ gchar *region_name;
+
+ region_name = g_strdup (scanner->value.v_identifier);
/* Parse nth-child type pseudo-class */
if (g_scanner_peek_next_token (scanner) == ':')
@@ -752,6 +779,9 @@ parse_selector (GtkCssProvider *css_provider,
return token;
}
}
+
+ selector_path_prepend_region (path, region_name, flags);
+ g_free (region_name);
}
else if (scanner->value.v_identifier[0] == '*')
selector_path_prepend_glob (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]