]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcsscustomproperty.c
texthandle: Set a bigger input shape, covering the line height
[~andy/gtk] / gtk / gtkcsscustomproperty.c
index 0f20c1fc7f842ceead4c561b30e06e9d7265bc7c..4c0437983ff59fdfcf54e2170c208700a903e284 100644 (file)
 #include <string.h>
 
 #include "gtkcssstylefuncsprivate.h"
+#include "gtkcsstypedvalueprivate.h"
 #include "gtkstylepropertiesprivate.h"
 #include "gtkthemingengine.h"
 
+#include "deprecated/gtksymboliccolor.h"
+
 G_DEFINE_TYPE (GtkCssCustomProperty, _gtk_css_custom_property, GTK_TYPE_CSS_STYLE_PROPERTY)
 
 static GType
 gtk_css_custom_property_get_specified_type (GParamSpec *pspec)
 {
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   if (pspec->value_type == GDK_TYPE_RGBA ||
       pspec->value_type == GDK_TYPE_COLOR)
     return GTK_TYPE_SYMBOLIC_COLOR;
   else
     return pspec->value_type;
+
+  G_GNUC_END_IGNORE_DEPRECATIONS;
 }
 
 static GtkCssValue *
 gtk_css_custom_property_parse_value (GtkStyleProperty *property,
-                                     GtkCssParser     *parser,
-                                     GFile            *base)
+                                     GtkCssParser     *parser)
 {
   GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
   GValue value = G_VALUE_INIT;
-  GtkCssValue *result;
   gboolean success;
 
   if (custom->property_parse_func)
@@ -69,7 +74,7 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
     {
       g_value_init (&value, gtk_css_custom_property_get_specified_type (custom->pspec));
 
-      success = _gtk_css_style_parse_value (&value, parser, base);
+      success = _gtk_css_style_parse_value (&value, parser);
     }
 
   if (!success)
@@ -78,10 +83,7 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
       return NULL;
     }
 
-  result = _gtk_css_value_new_from_gvalue (&value);
-  g_value_unset (&value);
-
-  return result;
+  return _gtk_css_typed_value_new_take (&value);
 }
 
 static void
@@ -91,14 +93,15 @@ gtk_css_custom_property_query (GtkStyleProperty   *property,
                                gpointer            query_data)
 {
   GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (property);
+  GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
   GtkCssValue *css_value;
   
   css_value = (* query_func) (_gtk_css_style_property_get_id (style), query_data);
   if (css_value == NULL)
-    css_value =_gtk_css_style_property_get_initial_value (style);
+    css_value = _gtk_css_style_property_get_initial_value (style);
 
-  _gtk_css_value_init_gvalue (css_value, value);
-  g_assert (GTK_CSS_CUSTOM_PROPERTY (property)->pspec->value_type == G_VALUE_TYPE (value));
+  g_value_init (value, custom->pspec->value_type);
+  g_value_copy (_gtk_css_typed_value_get (css_value), value);
 }
 
 static void
@@ -107,7 +110,7 @@ gtk_css_custom_property_assign (GtkStyleProperty   *property,
                                 GtkStateFlags       state,
                                 const GValue       *value)
 {
-  GtkCssValue *css_value = _gtk_css_value_new_from_gvalue (value);
+  GtkCssValue *css_value = _gtk_css_typed_value_new (value);
   _gtk_style_properties_set_property_by_property (props,
                                                   GTK_CSS_STYLE_PROPERTY (property),
                                                   state,
@@ -125,22 +128,9 @@ _gtk_css_custom_property_class_init (GtkCssCustomPropertyClass *klass)
   property_class->assign = gtk_css_custom_property_assign;
 }
 
-static GtkCssValue *
-gtk_css_custom_property_compute_value (GtkCssStyleProperty *property,
-                                       GtkStyleContext     *context,
-                                       GtkCssValue         *specified)
-{
-  GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
-
-  return _gtk_css_style_compute_value (context, custom->pspec->value_type, specified);
-}
-
 static void
 _gtk_css_custom_property_init (GtkCssCustomProperty *custom)
 {
-  GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (custom);
-
-  style->compute_value = gtk_css_custom_property_compute_value;
 }
 
 static GtkCssValue *
@@ -174,7 +164,7 @@ gtk_css_custom_property_create_initial_value (GParamSpec *pspec)
   else
     g_param_value_set_default (pspec, &value);
 
-  result = _gtk_css_value_new_from_gvalue (&value);
+  result = _gtk_css_typed_value_new (&value);
   g_value_unset (&value);
 
   return result;
@@ -221,6 +211,8 @@ gtk_css_custom_property_create_initial_value (GParamSpec *pspec)
  * </note>
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: Code should use the default properties provided by CSS.
  **/
 void
 gtk_theming_engine_register_property (const gchar            *name_space,
@@ -270,6 +262,8 @@ gtk_theming_engine_register_property (const gchar            *name_space,
  * a theming engine, you want to use that function instead.
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: Code should use the default properties provided by CSS.
  **/
 void
 gtk_style_properties_register_property (GtkStylePropertyParser  parse_func,
@@ -313,6 +307,9 @@ gtk_style_properties_register_property (GtkStylePropertyParser  parse_func,
  * Returns: %TRUE if the property is registered, %FALSE otherwise
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: This code could only look up custom properties and
+ *     those are deprecated.
  **/
 gboolean
 gtk_style_properties_lookup_property (const gchar             *property_name,