[gtk+/wip/css: 56/97] styleproperties: Implement unsetting directly



commit a8c57780e08fa65a03811d8f792488e20d25d85e
Author: Benjamin Otte <otte redhat com>
Date:   Sat Dec 31 22:17:25 2011 +0100

    styleproperties: Implement unsetting directly
    
    With subproperties, there's no need anymore for custom unset functions.

 gtk/gtkstyleproperties.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c
index e1913a6..9d26f3a 100644
--- a/gtk/gtkstyleproperties.c
+++ b/gtk/gtkstyleproperties.c
@@ -886,10 +886,23 @@ gtk_style_properties_unset_property (GtkStyleProperties *props,
       g_warning ("Style property \"%s\" is not registered", property);
       return;
     }
+  if (_gtk_style_property_get_value_type (node) == G_TYPE_NONE)
+    {
+      g_warning ("Style property \"%s\" is not settable", property);
+      return;
+    }
 
-  if (node->unset_func)
+  if (GTK_IS_CSS_SHORTHAND_PROPERTY (node))
     {
-      node->unset_func (props, state);
+      GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (node);
+
+      for (pos = 0; pos < _gtk_css_shorthand_property_get_n_subproperties (shorthand); pos++)
+        {
+          GtkCssStyleProperty *sub = _gtk_css_shorthand_property_get_subproperty (shorthand, pos);
+          gtk_style_properties_unset_property (props,
+                                               _gtk_style_property_get_name (GTK_STYLE_PROPERTY (sub)),
+                                               state);
+        }
       return;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]