[gtk+] cssprovider: Add a new setter for rulesets
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] cssprovider: Add a new setter for rulesets
- Date: Wed, 18 May 2011 20:33:01 +0000 (UTC)
commit 399a4391031173e754f0218a93ffac0b5ae4d026
Author: Benjamin Otte <otte redhat com>
Date: Wed May 18 04:30:51 2011 +0200
cssprovider: Add a new setter for rulesets
We now have set-by-pspec (which is used for normal style properties) and
set-by-name (which is used by widget properties).
gtk/gtkcssprovider.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 2df8104..06eb4e4 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -955,6 +955,14 @@ gtk_css_ruleset_add_style (GtkCssRuleset *ruleset,
g_hash_table_insert (ruleset->style, name, value);
}
+static void
+gtk_css_ruleset_add (GtkCssRuleset *ruleset,
+ GParamSpec *pspec,
+ GValue *value)
+{
+ gtk_css_ruleset_add_style (ruleset, g_strdup (pspec->name), value);
+}
+
static gboolean
gtk_css_ruleset_matches (GtkCssRuleset *ruleset,
GtkWidgetPath *path,
@@ -1944,6 +1952,8 @@ parse_declaration (GtkCssScanner *scanner,
{
GValue *val;
+ g_free (name);
+
val = g_slice_new0 (GValue);
g_value_init (val, pspec->value_type);
@@ -1953,20 +1963,20 @@ parse_declaration (GtkCssScanner *scanner,
* to override other style providers when merged
*/
g_param_value_set_default (pspec, val);
- gtk_css_ruleset_add_style (ruleset, name, val);
+ gtk_css_ruleset_add (ruleset, pspec, val);
}
- else if (strcmp (name, "gtk-key-bindings") == 0)
+ else if (strcmp (pspec->name, "gtk-key-bindings") == 0)
{
/* Private property holding the binding sets */
resolve_binding_sets (value_str, val);
- gtk_css_ruleset_add_style (ruleset, name, val);
+ gtk_css_ruleset_add (ruleset, pspec, val);
}
else if (parse_func)
{
GError *error = NULL;
if ((*parse_func) (value_str, val, &error))
- gtk_css_ruleset_add_style (ruleset, name, val);
+ gtk_css_ruleset_add (ruleset, pspec, val);
else
gtk_css_provider_take_error (scanner->provider, scanner, error);
}
@@ -1979,13 +1989,12 @@ parse_declaration (GtkCssScanner *scanner,
value_str,
&error))
{
- gtk_css_ruleset_add_style (ruleset, name, val);
+ gtk_css_ruleset_add (ruleset, pspec, val);
}
else
{
g_value_unset (val);
g_slice_free (GValue, val);
- g_free (name);
gtk_css_provider_take_error (scanner->provider, scanner, error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]