[gtk+/wip/cssvalue: 39/141] styleproperty: Add support for equal_func



commit 92c7a7171e1240b6d961ee5b6f9ab6b596e98904
Author: Benjamin Otte <otte redhat com>
Date:   Sat Mar 24 07:02:59 2012 +0100

    styleproperty: Add support for equal_func

 gtk/gtkcssstylepropertyimpl.c |   56 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index efaf308..f1482ac 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -59,6 +59,7 @@ gtk_css_style_property_register (const char *                   name,
                                  GtkCssStylePropertyParseFunc   parse_value,
                                  GtkCssStylePropertyPrintFunc   print_value,
                                  GtkCssStylePropertyComputeFunc compute_value,
+                                 GtkCssStylePropertyEqualFunc   equal_func,
                                  ...)
 {
   GtkCssStyleProperty *node;
@@ -67,7 +68,7 @@ gtk_css_style_property_register (const char *                   name,
   char *error = NULL;
   va_list args;
 
-  va_start (args, compute_value);
+  va_start (args, equal_func);
   G_VALUE_COLLECT_INIT (&initial_gvalue, specified_type,
                         args, 0, &error);
   if (error)
@@ -95,6 +96,8 @@ gtk_css_style_property_register (const char *                   name,
     node->print_value = print_value;
   if (compute_value)
     node->compute_value = compute_value;
+  if (equal_func)
+    node->equal_func = equal_func;
 
   _gtk_css_value_unref (initial_value);
 }
@@ -895,6 +898,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           color_compute,
+                                          NULL,
                                           symbolic);
   gtk_symbolic_color_unref (symbolic);
   gtk_css_style_property_register        ("font-size",
@@ -905,6 +909,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           10.0);
 
   /* properties that aren't referenced when computing values
@@ -918,6 +923,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           color_compute,
+                                          NULL,
                                           symbolic);
   gtk_symbolic_color_unref (symbolic);
 
@@ -929,6 +935,7 @@ _gtk_css_style_property_init_properties (void)
                                           font_family_parse,
                                           font_family_value_print,
                                           NULL,
+                                          NULL,
                                           default_font_family);
   gtk_css_style_property_register        ("font-style",
                                           PANGO_TYPE_STYLE,
@@ -938,6 +945,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           PANGO_STYLE_NORMAL);
   gtk_css_style_property_register        ("font-variant",
                                           PANGO_TYPE_VARIANT,
@@ -947,6 +955,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           PANGO_VARIANT_NORMAL);
   /* xxx: need to parse this properly, ie parse the numbers */
   gtk_css_style_property_register        ("font-weight",
@@ -957,6 +966,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           PANGO_WEIGHT_NORMAL);
 
   gtk_css_style_property_register        ("text-shadow",
@@ -967,6 +977,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           NULL);
 
   gtk_css_style_property_register        ("icon-shadow",
@@ -977,6 +988,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           NULL);
 
   gtk_css_style_property_register        ("box-shadow",
@@ -987,6 +999,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           NULL);
 
   _gtk_css_number_init (&number, 0, GTK_CSS_PX);
@@ -998,6 +1011,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_margin,
                                           NULL,
                                           compute_margin,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("margin-left",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1007,6 +1021,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_margin,
                                           NULL,
                                           compute_margin,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("margin-bottom",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1016,6 +1031,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_margin,
                                           NULL,
                                           compute_margin,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("margin-right",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1025,6 +1041,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_margin,
                                           NULL,
                                           compute_margin,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("padding-top",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1034,6 +1051,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_padding,
                                           NULL,
                                           compute_padding,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("padding-left",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1043,6 +1061,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_padding,
                                           NULL,
                                           compute_padding,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("padding-bottom",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1052,6 +1071,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_padding,
                                           NULL,
                                           compute_padding,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("padding-right",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1061,6 +1081,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_padding,
                                           NULL,
                                           compute_padding,
+                                          NULL,
                                           &number);
   /* IMPORTANT: compute_border_width() requires that the border-width
    * properties be immeditaly followed by the border-style properties
@@ -1073,6 +1094,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           GTK_BORDER_STYLE_NONE);
   gtk_css_style_property_register        ("border-top-width",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1082,6 +1104,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_border_width,
                                           NULL,
                                           compute_border_width,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("border-left-style",
                                           GTK_TYPE_BORDER_STYLE,
@@ -1091,6 +1114,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           GTK_BORDER_STYLE_NONE);
   gtk_css_style_property_register        ("border-left-width",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1100,6 +1124,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_border_width,
                                           NULL,
                                           compute_border_width,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("border-bottom-style",
                                           GTK_TYPE_BORDER_STYLE,
@@ -1109,6 +1134,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           GTK_BORDER_STYLE_NONE);
   gtk_css_style_property_register        ("border-bottom-width",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1118,6 +1144,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_border_width,
                                           NULL,
                                           compute_border_width,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("border-right-style",
                                           GTK_TYPE_BORDER_STYLE,
@@ -1127,6 +1154,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           GTK_BORDER_STYLE_NONE);
   gtk_css_style_property_register        ("border-right-width",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1136,6 +1164,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_border_width,
                                           NULL,
                                           compute_border_width,
+                                          NULL,
                                           &number);
 
   gtk_css_style_property_register        ("border-top-left-radius",
@@ -1146,6 +1175,7 @@ _gtk_css_style_property_init_properties (void)
                                           border_corner_radius_value_parse,
                                           border_corner_radius_value_print,
                                           NULL,
+                                          NULL,
                                           &no_corner_radius);
   gtk_css_style_property_register        ("border-top-right-radius",
                                           GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
@@ -1155,6 +1185,7 @@ _gtk_css_style_property_init_properties (void)
                                           border_corner_radius_value_parse,
                                           border_corner_radius_value_print,
                                           NULL,
+                                          NULL,
                                           &no_corner_radius);
   gtk_css_style_property_register        ("border-bottom-right-radius",
                                           GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
@@ -1164,6 +1195,7 @@ _gtk_css_style_property_init_properties (void)
                                           border_corner_radius_value_parse,
                                           border_corner_radius_value_print,
                                           NULL,
+                                          NULL,
                                           &no_corner_radius);
   gtk_css_style_property_register        ("border-bottom-left-radius",
                                           GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
@@ -1173,6 +1205,7 @@ _gtk_css_style_property_init_properties (void)
                                           border_corner_radius_value_parse,
                                           border_corner_radius_value_print,
                                           NULL,
+                                          NULL,
                                           &no_corner_radius);
 
   gtk_css_style_property_register        ("outline-style",
@@ -1183,6 +1216,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           GTK_BORDER_STYLE_NONE);
   gtk_css_style_property_register        ("outline-width",
                                           GTK_TYPE_CSS_NUMBER,
@@ -1192,6 +1226,7 @@ _gtk_css_style_property_init_properties (void)
                                           parse_border_width,
                                           NULL,
                                           compute_border_width,
+                                          NULL,
                                           &number);
   gtk_css_style_property_register        ("outline-offset",
                                           G_TYPE_INT,
@@ -1201,6 +1236,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           0);
 
   gtk_css_style_property_register        ("background-clip",
@@ -1211,6 +1247,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           GTK_CSS_AREA_BORDER_BOX);
   gtk_css_style_property_register        ("background-origin",
                                           GTK_TYPE_CSS_AREA,
@@ -1220,6 +1257,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           GTK_CSS_AREA_PADDING_BOX);
   gtk_css_style_property_register        ("background-size",
                                           GTK_TYPE_CSS_BACKGROUND_SIZE,
@@ -1229,6 +1267,7 @@ _gtk_css_style_property_init_properties (void)
                                           background_size_parse,
                                           background_size_print,
                                           background_size_compute,
+                                          NULL,
                                           &default_background_size);
   gtk_css_style_property_register        ("background-position",
                                           GTK_TYPE_CSS_BACKGROUND_POSITION,
@@ -1238,6 +1277,7 @@ _gtk_css_style_property_init_properties (void)
                                           background_position_parse,
                                           background_position_print,
                                           background_position_compute,
+                                          NULL,
                                           &default_background_position);
 
   gtk_css_style_property_register        ("border-top-color",
@@ -1248,6 +1288,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           color_compute,
+                                          NULL,
                                           _gtk_symbolic_color_get_current_color ());
   gtk_css_style_property_register        ("border-right-color",
                                           GTK_TYPE_SYMBOLIC_COLOR,
@@ -1257,6 +1298,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           color_compute,
+                                          NULL,
                                           _gtk_symbolic_color_get_current_color ());
   gtk_css_style_property_register        ("border-bottom-color",
                                           GTK_TYPE_SYMBOLIC_COLOR,
@@ -1266,6 +1308,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           color_compute,
+                                          NULL,
                                           _gtk_symbolic_color_get_current_color ());
   gtk_css_style_property_register        ("border-left-color",
                                           GTK_TYPE_SYMBOLIC_COLOR,
@@ -1275,6 +1318,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           color_compute,
+                                          NULL,
                                           _gtk_symbolic_color_get_current_color ());
   gtk_css_style_property_register        ("outline-color",
                                           GTK_TYPE_SYMBOLIC_COLOR,
@@ -1284,6 +1328,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           color_compute,
+                                          NULL,
                                           _gtk_symbolic_color_get_current_color ());
 
   gtk_css_style_property_register        ("background-repeat",
@@ -1294,6 +1339,7 @@ _gtk_css_style_property_init_properties (void)
                                           background_repeat_value_parse,
                                           background_repeat_value_print,
                                           NULL,
+                                          NULL,
                                           GTK_CSS_BACKGROUND_REPEAT | (GTK_CSS_BACKGROUND_REPEAT << GTK_CSS_BACKGROUND_REPEAT_SHIFT));
   gtk_css_style_property_register        ("background-image",
                                           GTK_TYPE_CSS_IMAGE,
@@ -1303,6 +1349,7 @@ _gtk_css_style_property_init_properties (void)
                                           css_image_value_parse,
                                           css_image_value_print,
                                           css_image_value_compute,
+                                          NULL,
                                           NULL);
 
   gtk_css_style_property_register        ("border-image-source",
@@ -1313,6 +1360,7 @@ _gtk_css_style_property_init_properties (void)
                                           css_image_value_parse,
                                           css_image_value_print,
                                           css_image_value_compute,
+                                          NULL,
                                           NULL);
   gtk_css_style_property_register        ("border-image-repeat",
                                           GTK_TYPE_CSS_BORDER_IMAGE_REPEAT,
@@ -1322,6 +1370,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           &border_image_repeat);
 
   /* XXX: The initial value is wrong, it should be 100% */
@@ -1333,6 +1382,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           &border_of_ones);
   gtk_css_style_property_register        ("border-image-width",
                                           GTK_TYPE_BORDER,
@@ -1342,6 +1392,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           NULL);
   gtk_css_style_property_register        ("engine",
                                           GTK_TYPE_THEMING_ENGINE,
@@ -1351,6 +1402,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           gtk_theming_engine_load (NULL));
   gtk_css_style_property_register        ("transition",
                                           GTK_TYPE_ANIMATION_DESCRIPTION,
@@ -1360,6 +1412,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
+                                          NULL,
                                           NULL);
 
   /* Private property holding the binding sets */
@@ -1371,6 +1424,7 @@ _gtk_css_style_property_init_properties (void)
                                           bindings_value_parse,
                                           bindings_value_print,
                                           NULL,
+                                          NULL,
                                           NULL);
 }
 



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