[gtk+/wip/baedert/drawing] Remove all widget style property code



commit 8bd7d73851a4465b93792e123df4a3dfda42c667
Author: Timm Bäder <mail baedert org>
Date:   Sun Jun 18 13:17:00 2017 +0200

    Remove all widget style property code

 docs/reference/gtk/gtk4-sections.txt |    8 -
 gtk/gtkcssprovider.c                 |  308 ----------------------------------
 gtk/gtkstylecascade.c                |   31 ----
 gtk/gtkstylecontext.c                |  277 ------------------------------
 gtk/gtkstylecontext.h                |   11 --
 gtk/gtkstyleprovider.c               |   38 ----
 gtk/gtkstyleprovider.h               |   16 --
 gtk/gtkwidget.c                      |  189 ---------------------
 gtk/gtkwidget.h                      |   17 --
 tests/testtreepos.c                  |    2 +-
 10 files changed, 1 insertions(+), 896 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 732015b..11d7023 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4572,11 +4572,7 @@ gtk_widget_queue_draw_area
 gtk_widget_queue_draw_region
 gtk_widget_set_redraw_on_allocate
 gtk_widget_mnemonic_activate
-gtk_widget_class_install_style_property
-gtk_widget_class_find_style_property
 gtk_widget_send_focus_change
-gtk_widget_style_get
-gtk_widget_style_get_valist
 gtk_widget_class_set_accessible_type
 gtk_widget_class_set_accessible_role
 gtk_widget_get_accessible
@@ -5015,7 +5011,6 @@ GTK_STYLE_PROVIDER_PRIORITY_THEME
 GTK_STYLE_PROVIDER_PRIORITY_SETTINGS
 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
 GTK_STYLE_PROVIDER_PRIORITY_USER
-gtk_style_provider_get_style_property
 <SUBSECTION Standard>
 GTK_TYPE_STYLE_PROVIDER
 GTK_STYLE_PROVIDER
@@ -5136,9 +5131,6 @@ gtk_style_context_get_property
 gtk_style_context_get_screen
 gtk_style_context_get_frame_clock
 gtk_style_context_get_state
-gtk_style_context_get_style
-gtk_style_context_get_style_property
-gtk_style_context_get_style_valist
 gtk_style_context_get_valist
 gtk_style_context_get_section
 gtk_style_context_get_color
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 123d3aa..5515dd7 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -81,7 +81,6 @@
 typedef struct GtkCssRuleset GtkCssRuleset;
 typedef struct _GtkCssScanner GtkCssScanner;
 typedef struct _PropertyValue PropertyValue;
-typedef struct _WidgetPropertyValue WidgetPropertyValue;
 typedef enum ParserScope ParserScope;
 typedef enum ParserSymbol ParserSymbol;
 
@@ -91,24 +90,14 @@ struct _PropertyValue {
   GtkCssSection       *section;
 };
 
-struct _WidgetPropertyValue {
-  WidgetPropertyValue *next;
-  char *name;
-  char *value;
-
-  GtkCssSection *section;
-};
-
 struct GtkCssRuleset
 {
   GtkCssSelector *selector;
   GtkCssSelectorTree *selector_match;
-  WidgetPropertyValue *widget_style;
   PropertyValue *styles;
   GtkBitmask *set_styles;
   guint n_styles;
   guint owns_styles : 1;
-  guint owns_widget_style : 1;
 };
 
 struct _GtkCssScanner
@@ -145,7 +134,6 @@ static guint css_provider_signals[LAST_SIGNAL] = { 0 };
 static void gtk_css_provider_finalize (GObject *object);
 static void gtk_css_style_provider_iface_init (GtkStyleProviderIface *iface);
 static void gtk_css_style_provider_private_iface_init (GtkStyleProviderPrivateInterface *iface);
-static void widget_property_value_list_free (WidgetPropertyValue *head);
 static void gtk_css_style_provider_emit_error (GtkStyleProviderPrivate *provider,
                                                GtkCssSection           *section,
                                                const GError            *error);
@@ -255,8 +243,6 @@ gtk_css_ruleset_init_copy (GtkCssRuleset       *new,
   /* First copy takes over ownership */
   if (ruleset->owns_styles)
     ruleset->owns_styles = FALSE;
-  if (ruleset->owns_widget_style)
-    ruleset->owns_widget_style = FALSE;
   if (new->set_styles)
     new->set_styles = _gtk_bitmask_copy (new->set_styles);
 }
@@ -279,82 +265,12 @@ gtk_css_ruleset_clear (GtkCssRuleset *ruleset)
     }
   if (ruleset->set_styles)
     _gtk_bitmask_free (ruleset->set_styles);
-  if (ruleset->owns_widget_style)
-    widget_property_value_list_free (ruleset->widget_style);
   if (ruleset->selector)
     _gtk_css_selector_free (ruleset->selector);
 
   memset (ruleset, 0, sizeof (GtkCssRuleset));
 }
 
-static WidgetPropertyValue *
-widget_property_value_new (char *name, GtkCssSection *section)
-{
-  WidgetPropertyValue *value;
-
-  value = g_slice_new0 (WidgetPropertyValue);
-
-  value->name = name;
-  if (gtk_keep_css_sections)
-    value->section = gtk_css_section_ref (section);
-
-  return value;
-}
-
-static void
-widget_property_value_free (WidgetPropertyValue *value)
-{
-  g_free (value->value);
-  g_free (value->name);
-  if (value->section)
-    gtk_css_section_unref (value->section);
-
-  g_slice_free (WidgetPropertyValue, value);
-}
-
-static void
-widget_property_value_list_free (WidgetPropertyValue *head)
-{
-  WidgetPropertyValue *l, *next;
-  for (l = head; l != NULL; l = next)
-    {
-      next = l->next;
-      widget_property_value_free (l);
-    }
-}
-
-static WidgetPropertyValue *
-widget_property_value_list_remove_name (WidgetPropertyValue *head, const char *name)
-{
-  WidgetPropertyValue *l, **last;
-
-  last = &head;
-
-  for (l = head; l != NULL; l = l->next)
-    {
-      if (strcmp (l->name, name) == 0)
-       {
-         *last = l->next;
-         widget_property_value_free (l);
-         break;
-       }
-
-      last = &l->next;
-    }
-
-  return head;
-}
-
-static void
-gtk_css_ruleset_add_style (GtkCssRuleset *ruleset,
-                           char          *name,
-                           WidgetPropertyValue *value)
-{
-  value->next = widget_property_value_list_remove_name (ruleset->widget_style, name);
-  ruleset->widget_style = value;
-  ruleset->owns_widget_style = TRUE;
-}
-
 static void
 gtk_css_ruleset_add (GtkCssRuleset       *ruleset,
                      GtkCssStyleProperty *property,
@@ -622,92 +538,9 @@ verify_tree_get_change_results (GtkCssProvider *provider,
 }
 
 
-static gboolean
-gtk_css_provider_get_style_property (GtkStyleProvider *provider,
-                                     GtkWidgetPath    *path,
-                                     GtkStateFlags     state,
-                                     GParamSpec       *pspec,
-                                     GValue           *value)
-{
-  GtkCssProvider *css_provider = GTK_CSS_PROVIDER (provider);
-  GtkCssProviderPrivate *priv = css_provider->priv;
-  WidgetPropertyValue *val;
-  GPtrArray *tree_rules;
-  GtkCssMatcher matcher;
-  gboolean found = FALSE;
-  gchar *prop_name;
-  gint i;
-
-  if (state == gtk_widget_path_iter_get_state (path, -1))
-    {
-      gtk_widget_path_ref (path);
-    }
-  else
-    {
-      path = gtk_widget_path_copy (path);
-      gtk_widget_path_iter_set_state (path, -1, state);
-    }
-
-  if (!_gtk_css_matcher_init (&matcher, path, NULL))
-    {
-      gtk_widget_path_unref (path);
-      return FALSE;
-    }
-
-  tree_rules = _gtk_css_selector_tree_match_all (priv->tree, &matcher);
-  if (tree_rules)
-    {
-      verify_tree_match_results (css_provider, &matcher, tree_rules);
-
-      prop_name = g_strdup_printf ("-%s-%s",
-                                   g_type_name (pspec->owner_type),
-                                   pspec->name);
-
-      for (i = tree_rules->len - 1; i >= 0; i--)
-        {
-          GtkCssRuleset *ruleset = tree_rules->pdata[i];
-
-          if (ruleset->widget_style == NULL)
-            continue;
-
-          for (val = ruleset->widget_style; val != NULL; val = val->next)
-            {
-              if (strcmp (val->name, prop_name) == 0)
-                {
-                  GtkCssScanner *scanner;
-
-                 scanner = gtk_css_scanner_new (css_provider,
-                                                 NULL,
-                                                 val->section,
-                                                 val->section != NULL ? gtk_css_section_get_file 
(val->section) : NULL,
-                                                 val->value);
-                  if (!val->section)
-                    gtk_css_scanner_push_section (scanner, GTK_CSS_SECTION_VALUE);
-                  found = _gtk_css_style_funcs_parse_value (value, scanner->parser);
-                  if (!val->section)
-                    gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_VALUE);
-                  gtk_css_scanner_destroy (scanner);
-                 break;
-                }
-            }
-
-          if (found)
-            break;
-        }
-
-      g_free (prop_name);
-      g_ptr_array_free (tree_rules, TRUE);
-    }
-
-  gtk_widget_path_unref (path);
-
-  return found;
-}
-
 static void
 gtk_css_style_provider_iface_init (GtkStyleProviderIface *iface)
 {
-  iface->get_style_property = gtk_css_provider_get_style_property;
 }
 
 static GtkCssValue *
@@ -916,12 +749,6 @@ css_provider_commit (GtkCssProvider *css_provider,
 
   priv = css_provider->priv;
 
-  if (ruleset->styles == NULL && ruleset->widget_style == NULL)
-    {
-      g_slist_free_full (selectors, (GDestroyNotify) _gtk_css_selector_free);
-      return;
-    }
-
   for (l = selectors; l; l = l->next)
     {
       GtkCssRuleset new;
@@ -1311,67 +1138,6 @@ parse_selector_list (GtkCssScanner *scanner)
   return selectors;
 }
 
-static gboolean
-name_is_style_property (const char *name)
-{
-  if (name[0] != '-')
-    return FALSE;
-
-  if (g_str_has_prefix (name, "-gtk-"))
-    return FALSE;
-
-  return TRUE;
-}
-
-static void
-warn_if_deprecated (GtkCssScanner *scanner,
-                    const gchar   *name)
-{
-  gchar *n = NULL;
-  gchar *p;
-  const gchar *type_name;
-  const gchar *property_name;
-  GType type;
-  GTypeClass *class = NULL;
-  GParamSpec *pspec;
-
-  n = g_strdup (name);
-
-  /* skip initial - */
-  type_name = n + 1;
-
-  p = strchr (type_name, '-');
-  if (!p)
-    goto out;
-
-  p[0] = '\0';
-  property_name = p + 1;
-
-  type = g_type_from_name (type_name);
-  if (type == G_TYPE_INVALID ||
-      !g_type_is_a (type, GTK_TYPE_WIDGET))
-    goto out;
-
-  class = g_type_class_ref (type);
-  pspec = gtk_widget_class_find_style_property (GTK_WIDGET_CLASS (class), property_name);
-  if (!pspec)
-    goto out;
-
-  if (!(pspec->flags & G_PARAM_DEPRECATED))
-    goto out;
-
-  _gtk_css_parser_error_full (scanner->parser,
-                              GTK_CSS_PROVIDER_ERROR_DEPRECATED,
-                              "The style property %s:%s is deprecated and shouldn't be "
-                              "used anymore. It will be removed in a future version",
-                              g_type_name (pspec->owner_type), pspec->name);
-
-out:
-  g_free (n);
-  if (class)
-    g_type_class_unref (class);
-}
-
 static void
 parse_declaration (GtkCssScanner *scanner,
                    GtkCssRuleset *ruleset)
@@ -1386,19 +1152,6 @@ parse_declaration (GtkCssScanner *scanner,
     goto check_for_semicolon;
 
   property = _gtk_style_property_lookup (name);
-  if (property == NULL && !name_is_style_property (name))
-    {
-      gtk_css_provider_error (scanner->provider,
-                              scanner,
-                              GTK_CSS_PROVIDER_ERROR,
-                              GTK_CSS_PROVIDER_ERROR_NAME,
-                              "'%s' is not a valid property name",
-                              name);
-      _gtk_css_parser_resync (scanner->parser, TRUE, '}');
-      g_free (name);
-      gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_DECLARATION);
-      return;
-    }
 
   if (property != NULL && strcmp (name, property->name) != 0)
     {
@@ -1490,34 +1243,6 @@ parse_declaration (GtkCssScanner *scanner,
 
       gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_VALUE);
     }
-  else if (name_is_style_property (name))
-    {
-      char *value_str;
-
-      warn_if_deprecated (scanner, name);
-
-      gtk_css_scanner_push_section (scanner, GTK_CSS_SECTION_VALUE);
-
-      value_str = _gtk_css_parser_read_value (scanner->parser);
-      if (value_str)
-        {
-          WidgetPropertyValue *val;
-
-          val = widget_property_value_new (name, scanner->section);
-         val->value = value_str;
-
-          gtk_css_ruleset_add_style (ruleset, name, val);
-        }
-      else
-        {
-          _gtk_css_parser_resync (scanner->parser, TRUE, '}');
-          gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_VALUE);
-          gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_DECLARATION);
-          return;
-        }
-
-      gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_VALUE);
-    }
   else
     g_free (name);
 
@@ -2145,20 +1870,10 @@ compare_properties (gconstpointer a, gconstpointer b, gpointer style)
                  _gtk_style_property_get_name (GTK_STYLE_PROPERTY (styles[*ub].property)));
 }
 
-static int
-compare_names (gconstpointer a, gconstpointer b)
-{
-  const WidgetPropertyValue *aa = a;
-  const WidgetPropertyValue *bb = b;
-  return strcmp (aa->name, bb->name);
-}
-
 static void
 gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
                        GString             *str)
 {
-  GList *values, *walk;
-  WidgetPropertyValue *widget_value;
   guint i;
 
   _gtk_css_selector_tree_match_print (ruleset->selector_match, str);
@@ -2188,29 +1903,6 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
       g_free (sorted);
     }
 
-  if (ruleset->widget_style)
-    {
-      values = NULL;
-      for (widget_value = ruleset->widget_style; widget_value != NULL; widget_value = widget_value->next)
-       values = g_list_prepend (values, widget_value);
-
-      /* so the output is identical for identical selector styles */
-      values = g_list_sort (values, compare_names);
-
-      for (walk = values; walk; walk = walk->next)
-        {
-         widget_value = walk->data;
-
-          g_string_append (str, "  ");
-          g_string_append (str, widget_value->name);
-          g_string_append (str, ": ");
-          g_string_append (str, widget_value->value);
-          g_string_append (str, ";\n");
-        }
-
-      g_list_free (values);
-    }
-
   g_string_append (str, "}\n");
 }
 
diff --git a/gtk/gtkstylecascade.c b/gtk/gtkstylecascade.c
index 7d947b2..985099c 100644
--- a/gtk/gtkstylecascade.c
+++ b/gtk/gtkstylecascade.c
@@ -96,40 +96,9 @@ gtk_style_cascade_iter_clear (GtkStyleCascadeIter *iter)
   g_free (iter->cascade_index);
 }
 
-static gboolean
-gtk_style_cascade_get_style_property (GtkStyleProvider *provider,
-                                      GtkWidgetPath    *path,
-                                      GtkStateFlags     state,
-                                      GParamSpec       *pspec,
-                                      GValue           *value)
-{
-  GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
-  GtkStyleCascadeIter iter;
-  GtkStyleProvider *item;
-
-  for (item = gtk_style_cascade_iter_init (cascade, &iter);
-       item;
-       item = gtk_style_cascade_iter_next (cascade, &iter))
-    {
-      if (gtk_style_provider_get_style_property (item,
-                                                 path,
-                                                 state,
-                                                 pspec,
-                                                 value))
-        {
-          gtk_style_cascade_iter_clear (&iter);
-          return TRUE;
-        }
-    }
-
-  gtk_style_cascade_iter_clear (&iter);
-  return FALSE;
-}
-
 static void
 gtk_style_cascade_provider_iface_init (GtkStyleProviderIface *iface)
 {
-  iface->get_style_property = gtk_style_cascade_get_style_property;
 }
 
 static GtkSettings *
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 15157bd..c22c67b 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1314,22 +1314,6 @@ gtk_style_context_list_classes (GtkStyleContext *context)
   return classes_list;
 }
 
-static gint
-style_property_values_cmp (gconstpointer bsearch_node1,
-                           gconstpointer bsearch_node2)
-{
-  const PropertyValue *val1 = bsearch_node1;
-  const PropertyValue *val2 = bsearch_node2;
-
-  if (val1->widget_type != val2->widget_type)
-    return val1->widget_type < val2->widget_type ? -1 : 1;
-
-  if (val1->pspec != val2->pspec)
-    return val1->pspec < val2->pspec ? -1 : 1;
-
-  return 0;
-}
-
 GtkCssValue *
 _gtk_style_context_peek_property (GtkStyleContext *context,
                                   guint            property_id)
@@ -1339,267 +1323,6 @@ _gtk_style_context_peek_property (GtkStyleContext *context,
   return gtk_css_style_get_value (values, property_id);
 }
 
-const GValue *
-_gtk_style_context_peek_style_property (GtkStyleContext *context,
-                                        GType            widget_type,
-                                        GParamSpec      *pspec)
-{
-  GtkStyleContextPrivate *priv;
-  GtkWidgetPath *path;
-  PropertyValue *pcache, key = { 0 };
-  guint i;
-
-  priv = context->priv;
-
-  /* ensure the style cache is valid by forcing a validation */
-  gtk_style_context_lookup_style (context);
-
-  key.widget_type = widget_type;
-  key.pspec = pspec;
-
-  /* need value cache array */
-  pcache = bsearch (&key,
-                    priv->property_cache->data, priv->property_cache->len,
-                    sizeof (PropertyValue), style_property_values_cmp);
-  if (pcache)
-    return &pcache->value;
-
-  i = 0;
-  while (i < priv->property_cache->len &&
-         style_property_values_cmp (&key, &g_array_index (priv->property_cache, PropertyValue, i)) >= 0)
-    i++;
-
-  g_array_insert_val (priv->property_cache, i, key);
-  pcache = &g_array_index (priv->property_cache, PropertyValue, i);
-
-  /* cache miss, initialize value type, then set contents */
-  g_param_spec_ref (pcache->pspec);
-  g_value_init (&pcache->value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-
-  path = gtk_css_node_create_widget_path (gtk_style_context_get_root (context));
-  if (path && gtk_widget_path_length (path) > 0)
-    {
-      if (gtk_style_provider_get_style_property (GTK_STYLE_PROVIDER (priv->cascade),
-                                                 path,
-                                                 gtk_widget_path_iter_get_state (path, -1),
-                                                 pspec, &pcache->value))
-        {
-          gtk_widget_path_unref (path);
-
-          return &pcache->value;
-        }
-    }
-
-  gtk_widget_path_unref (path);
-
-  /* not supplied by any provider, revert to default */
-  g_param_value_set_default (pspec, &pcache->value);
-
-  return &pcache->value;
-}
-
-/**
- * gtk_style_context_get_style_property:
- * @context: a #GtkStyleContext
- * @property_name: the name of the widget style property
- * @value: Return location for the property value
- *
- * Gets the value for a widget style property.
- *
- * When @value is no longer needed, g_value_unset() must be called
- * to free any allocated memory.
- **/
-void
-gtk_style_context_get_style_property (GtkStyleContext *context,
-                                      const gchar     *property_name,
-                                      GValue          *value)
-{
-  GtkCssNode *root;
-  GtkWidgetClass *widget_class;
-  GParamSpec *pspec;
-  const GValue *peek_value;
-  GType widget_type;
-
-  g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-  g_return_if_fail (property_name != NULL);
-  g_return_if_fail (value != NULL);
-
-  root = gtk_style_context_get_root (context);
-
-  if (GTK_IS_CSS_WIDGET_NODE (root))
-    {
-      GtkWidget *widget;
-
-      widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (root));
-      if (widget == NULL)
-        return;
-
-      widget_type = G_OBJECT_TYPE (widget);
-    }
-  else if (GTK_IS_CSS_PATH_NODE (root))
-    {
-      GtkWidgetPath *path;
-
-      path = gtk_css_path_node_get_widget_path (GTK_CSS_PATH_NODE (root));
-      if (path == NULL)
-        return;
-
-      widget_type = gtk_widget_path_get_object_type (path);
-
-      if (!g_type_is_a (widget_type, GTK_TYPE_WIDGET))
-        {
-          g_warning ("%s: can't get style properties for non-widget class '%s'",
-                     G_STRLOC,
-                     g_type_name (widget_type));
-          return;
-        }
-    }
-  else
-    {
-      return;
-    }
-
-  widget_class = g_type_class_ref (widget_type);
-  pspec = gtk_widget_class_find_style_property (widget_class, property_name);
-  g_type_class_unref (widget_class);
-
-  if (!pspec)
-    {
-      g_warning ("%s: widget class '%s' has no style property named '%s'",
-                 G_STRLOC,
-                 g_type_name (widget_type),
-                 property_name);
-      return;
-    }
-
-  peek_value = _gtk_style_context_peek_style_property (context, widget_type, pspec);
-
-  if (G_VALUE_TYPE (value) == G_VALUE_TYPE (peek_value))
-    g_value_copy (peek_value, value);
-  else if (g_value_type_transformable (G_VALUE_TYPE (peek_value), G_VALUE_TYPE (value)))
-    g_value_transform (peek_value, value);
-  else
-    g_warning ("can't retrieve style property '%s' of type '%s' as value of type '%s'",
-               pspec->name,
-               G_VALUE_TYPE_NAME (peek_value),
-               G_VALUE_TYPE_NAME (value));
-}
-
-/**
- * gtk_style_context_get_style_valist:
- * @context: a #GtkStyleContext
- * @args: va_list of property name/return location pairs, followed by %NULL
- *
- * Retrieves several widget style properties from @context according to the
- * current style.
- *
- * Since: 3.0
- **/
-void
-gtk_style_context_get_style_valist (GtkStyleContext *context,
-                                    va_list          args)
-{
-  GtkCssNode *root;
-  const gchar *prop_name;
-  GType widget_type;
-
-  g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-
-  prop_name = va_arg (args, const gchar *);
-  root = gtk_style_context_get_root (context);
-
-  if (GTK_IS_CSS_WIDGET_NODE (root))
-    {
-      GtkWidget *widget;
-
-      widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (root));
-      if (widget == NULL)
-        return;
-
-      widget_type = G_OBJECT_TYPE (widget);
-    }
-  else if (GTK_IS_CSS_PATH_NODE (root))
-    {
-      GtkWidgetPath *path;
-
-      path = gtk_css_path_node_get_widget_path (GTK_CSS_PATH_NODE (root));
-      if (path == NULL)
-        return;
-
-      widget_type = gtk_widget_path_get_object_type (path);
-
-      if (!g_type_is_a (widget_type, GTK_TYPE_WIDGET))
-        {
-          g_warning ("%s: can't get style properties for non-widget class '%s'",
-                     G_STRLOC,
-                     g_type_name (widget_type));
-          return;
-        }
-    }
-  else
-    {
-      return;
-    }
-
-  while (prop_name)
-    {
-      GtkWidgetClass *widget_class;
-      GParamSpec *pspec;
-      const GValue *peek_value;
-      gchar *error;
-
-      widget_class = g_type_class_ref (widget_type);
-      pspec = gtk_widget_class_find_style_property (widget_class, prop_name);
-      g_type_class_unref (widget_class);
-
-      if (!pspec)
-        {
-          g_warning ("%s: widget class '%s' has no style property named '%s'",
-                     G_STRLOC,
-                     g_type_name (widget_type),
-                     prop_name);
-          break;
-        }
-
-      peek_value = _gtk_style_context_peek_style_property (context, widget_type, pspec);
-
-      G_VALUE_LCOPY (peek_value, args, 0, &error);
-
-      if (error)
-        {
-          g_warning ("can't retrieve style property '%s' of type '%s': %s",
-                     pspec->name,
-                     G_VALUE_TYPE_NAME (peek_value),
-                     error);
-          g_free (error);
-          break;
-        }
-
-      prop_name = va_arg (args, const gchar *);
-    }
-}
-
-/**
- * gtk_style_context_get_style:
- * @context: a #GtkStyleContext
- * @...: property name /return value pairs, followed by %NULL
- *
- * Retrieves several widget style properties from @context according to the
- * current style.
- *
- * Since: 3.0
- **/
-void
-gtk_style_context_get_style (GtkStyleContext *context,
-                             ...)
-{
-  va_list args;
-
-  va_start (args, context);
-  gtk_style_context_get_style_valist (context, args);
-  va_end (args);
-}
-
 /**
  * gtk_style_context_set_screen:
  * @context: a #GtkStyleContext
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 59ff199..67d63d6 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -1049,17 +1049,6 @@ gboolean gtk_style_context_has_class    (GtkStyleContext *context,
                                          const gchar     *class_name);
 
 GDK_AVAILABLE_IN_ALL
-void gtk_style_context_get_style_property (GtkStyleContext *context,
-                                           const gchar     *property_name,
-                                           GValue          *value);
-GDK_AVAILABLE_IN_ALL
-void gtk_style_context_get_style_valist   (GtkStyleContext *context,
-                                           va_list          args);
-GDK_AVAILABLE_IN_ALL
-void gtk_style_context_get_style          (GtkStyleContext *context,
-                                           ...);
-
-GDK_AVAILABLE_IN_ALL
 void        gtk_style_context_set_screen (GtkStyleContext *context,
                                           GdkScreen       *screen);
 GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtkstyleprovider.c b/gtk/gtkstyleprovider.c
index a604340..2f5ddda 100644
--- a/gtk/gtkstyleprovider.c
+++ b/gtk/gtkstyleprovider.c
@@ -53,41 +53,3 @@ static void
 gtk_style_provider_iface_init (gpointer g_iface)
 {
 }
-
-/**
- * gtk_style_provider_get_style_property:
- * @provider: a #GtkStyleProvider
- * @path: #GtkWidgetPath to query
- * @state: state to query the style property for
- * @pspec: The #GParamSpec to query
- * @value: (out): return location for the property value
- *
- * Looks up a widget style property as defined by @provider for
- * the widget represented by @path.
- *
- * Returns: %TRUE if the property was found and has a value, %FALSE otherwise
- *
- * Since: 3.0
- **/
-gboolean
-gtk_style_provider_get_style_property (GtkStyleProvider *provider,
-                                       GtkWidgetPath    *path,
-                                       GtkStateFlags     state,
-                                       GParamSpec       *pspec,
-                                       GValue           *value)
-{
-  GtkStyleProviderIface *iface;
-
-  g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), FALSE);
-  g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
-  g_return_val_if_fail (path != NULL, FALSE);
-  g_return_val_if_fail (g_type_is_a (gtk_widget_path_get_object_type (path), pspec->owner_type), FALSE);
-  g_return_val_if_fail (value != NULL, FALSE);
-
-  iface = GTK_STYLE_PROVIDER_GET_IFACE (provider);
-
-  if (!iface->get_style_property)
-    return FALSE;
-
-  return iface->get_style_property (provider, path, state, pspec, value);
-}
diff --git a/gtk/gtkstyleprovider.h b/gtk/gtkstyleprovider.h
index 730290f..38bcd3b 100644
--- a/gtk/gtkstyleprovider.h
+++ b/gtk/gtkstyleprovider.h
@@ -89,32 +89,16 @@ typedef struct _GtkStyleProvider GtkStyleProvider; /* dummy typedef */
 
 /**
  * GtkStyleProviderIface:
- * @get_style_property: Gets the value of a widget style property that applies to a widget path.
  */
 struct _GtkStyleProviderIface
 {
   /*< private >*/
   GTypeInterface g_iface;
-
-  /*< public >*/
-
-  gboolean (* get_style_property) (GtkStyleProvider *provider,
-                                   GtkWidgetPath    *path,
-                                   GtkStateFlags     state,
-                                   GParamSpec       *pspec,
-                                   GValue           *value);
 };
 
 GDK_AVAILABLE_IN_ALL
 GType gtk_style_provider_get_type (void) G_GNUC_CONST;
 
-GDK_AVAILABLE_IN_ALL
-gboolean gtk_style_provider_get_style_property (GtkStyleProvider *provider,
-                                                GtkWidgetPath    *path,
-                                                GtkStateFlags     state,
-                                                GParamSpec       *pspec,
-                                                GValue           *value);
-
 G_END_DECLS
 
 #endif /* __GTK_STYLE_PROVIDER_H__ */
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index d33f88b..558712f 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -259,22 +259,6 @@
  * If this has a value other than -1 you need to align the widget such that the baseline
  * appears at the position.
  *
- * # Style Properties
- *
- * #GtkWidget introduces “style
- * properties” - these are basically object properties that are stored
- * not on the object, but in the style object associated to the widget. Style
- * properties are set in [resource files][gtk3-Resource-Files].
- * This mechanism is used for configuring such things as the location of the
- * scrollbar arrows through the theme, giving theme authors more control over the
- * look of applications without the need to write a theme engine in C.
- *
- * Use gtk_widget_class_install_style_property() to install style properties for
- * a widget class, gtk_widget_class_find_style_property() or
- * gtk_widget_class_list_style_properties() to get information about existing
- * style properties and gtk_widget_style_get_property(), gtk_widget_style_get() or
- * gtk_widget_style_get_valist() to obtain the value of a style property.
- *
  * # GtkWidget as GtkBuildable
  *
  * The GtkWidget implementation of the GtkBuildable interface supports a
@@ -776,7 +760,6 @@ static gint             GtkWidget_private_offset = 0;
 static gpointer         gtk_widget_parent_class = NULL;
 static guint            widget_signals[LAST_SIGNAL] = { 0 };
 GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
-static GParamSpecPool  *style_property_spec_pool = NULL;
 
 static GQuark          quark_property_parser = 0;
 static GQuark          quark_accel_path = 0;
@@ -1016,7 +999,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
   quark_font_options = g_quark_from_static_string ("gtk-widget-font-options");
   quark_font_map = g_quark_from_static_string ("gtk-widget-font-map");
 
-  style_property_spec_pool = g_param_spec_pool_new (FALSE);
   _gtk_widget_child_property_pool = g_param_spec_pool_new (TRUE);
   cpn_context.quark_notify_queue = g_quark_from_static_string ("GtkWidget-child-property-notify-queue");
   cpn_context.dispatcher = child_property_notify_dispatcher;
@@ -3181,18 +3163,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 static void
 gtk_widget_base_class_finalize (GtkWidgetClass *klass)
 {
-  GList *list, *node;
-
-  list = g_param_spec_pool_list_owned (style_property_spec_pool, G_OBJECT_CLASS_TYPE (klass));
-  for (node = list; node; node = node->next)
-    {
-      GParamSpec *pspec = node->data;
-
-      g_param_spec_pool_remove (style_property_spec_pool, pspec);
-      g_param_spec_unref (pspec);
-    }
-  g_list_free (list);
-
   template_data_free (klass->priv->template);
 }
 
@@ -11177,165 +11147,6 @@ gtk_widget_input_shape_combine_region (GtkWidget      *widget,
   gtk_widget_update_input_shape (widget);
 }
 
-
-/* style properties
- */
-static void
-gtk_widget_class_install_style_property_parser (GtkWidgetClass     *klass,
-                                               GParamSpec         *pspec,
-                                               GtkRcPropertyParser parser)
-{
-  g_return_if_fail (GTK_IS_WIDGET_CLASS (klass));
-  g_return_if_fail (G_IS_PARAM_SPEC (pspec));
-  g_return_if_fail (pspec->flags & G_PARAM_READABLE);
-  g_return_if_fail (!(pspec->flags & (G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT)));
-
-  if (g_param_spec_pool_lookup (style_property_spec_pool, pspec->name, G_OBJECT_CLASS_TYPE (klass), FALSE))
-    {
-      g_warning (G_STRLOC ": class '%s' already contains a style property named '%s'",
-                G_OBJECT_CLASS_NAME (klass),
-                pspec->name);
-      return;
-    }
-
-  g_param_spec_ref_sink (pspec);
-  g_param_spec_set_qdata (pspec, quark_property_parser, (gpointer) parser);
-  g_param_spec_pool_insert (style_property_spec_pool, pspec, G_OBJECT_CLASS_TYPE (klass));
-}
-
-/**
- * gtk_widget_class_install_style_property:
- * @klass: a #GtkWidgetClass
- * @pspec: the #GParamSpec for the property
- *
- * Installs a style property on a widget class. The parser for the
- * style property is determined by the value type of @pspec.
- **/
-void
-gtk_widget_class_install_style_property (GtkWidgetClass *klass,
-                                        GParamSpec     *pspec)
-{
-  GtkRcPropertyParser parser;
-
-  g_return_if_fail (GTK_IS_WIDGET_CLASS (klass));
-  g_return_if_fail (G_IS_PARAM_SPEC (pspec));
-
-  parser = _gtk_rc_property_parser_from_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
-
-  gtk_widget_class_install_style_property_parser (klass, pspec, parser);
-}
-
-/**
- * gtk_widget_class_find_style_property:
- * @klass: a #GtkWidgetClass
- * @property_name: the name of the style property to find
- *
- * Finds a style property of a widget class by name.
- *
- * Returns: (transfer none): the #GParamSpec of the style property or
- *   %NULL if @class has no style property with that name.
- *
- * Since: 2.2
- */
-GParamSpec*
-gtk_widget_class_find_style_property (GtkWidgetClass *klass,
-                                     const gchar    *property_name)
-{
-  g_return_val_if_fail (property_name != NULL, NULL);
-
-  return g_param_spec_pool_lookup (style_property_spec_pool,
-                                  property_name,
-                                  G_OBJECT_CLASS_TYPE (klass),
-                                  TRUE);
-}
-
-/**
- * gtk_widget_style_get_valist:
- * @widget: a #GtkWidget
- * @first_property_name: the name of the first property to get
- * @var_args: a va_list of pairs of property names and
- *     locations to return the property values, starting with the location
- *     for @first_property_name.
- *
- * Non-vararg variant of gtk_widget_style_get(). Used primarily by language
- * bindings.
- */
-void
-gtk_widget_style_get_valist (GtkWidget   *widget,
-                            const gchar *first_property_name,
-                            va_list      var_args)
-{
-  GtkStyleContext *context;
-  const gchar *name;
-
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-
-  g_object_ref (widget);
-  context = _gtk_widget_get_style_context (widget);
-
-  name = first_property_name;
-  while (name)
-    {
-      const GValue *peek_value;
-      GParamSpec *pspec;
-      gchar *error;
-
-      pspec = g_param_spec_pool_lookup (style_property_spec_pool,
-                                       name,
-                                       G_OBJECT_TYPE (widget),
-                                       TRUE);
-      if (!pspec)
-       {
-         g_warning ("%s: widget class '%s' has no property named '%s'",
-                    G_STRLOC,
-                    G_OBJECT_TYPE_NAME (widget),
-                    name);
-         break;
-       }
-      /* style pspecs are always readable so we can spare that check here */
-
-      peek_value = _gtk_style_context_peek_style_property (context,
-                                                           G_OBJECT_TYPE (widget),
-                                                           pspec);
-
-      G_VALUE_LCOPY (peek_value, var_args, 0, &error);
-      if (error)
-       {
-         g_warning ("%s: %s", G_STRLOC, error);
-         g_free (error);
-         break;
-       }
-
-      name = va_arg (var_args, gchar*);
-    }
-
-  g_object_unref (widget);
-}
-
-/**
- * gtk_widget_style_get:
- * @widget: a #GtkWidget
- * @first_property_name: the name of the first property to get
- * @...: pairs of property names and locations to return the
- *     property values, starting with the location for
- *     @first_property_name, terminated by %NULL.
- *
- * Gets the values of a multiple style properties of @widget.
- */
-void
-gtk_widget_style_get (GtkWidget   *widget,
-                     const gchar *first_property_name,
-                     ...)
-{
-  va_list var_args;
-
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-
-  va_start (var_args, first_property_name);
-  gtk_widget_style_get_valist (widget, first_property_name, var_args);
-  va_end (var_args);
-}
-
 /**
  * gtk_requisition_new:
  *
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index ce94238..48555ab 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -925,23 +925,6 @@ GDK_AVAILABLE_IN_ALL
 PangoLayout  *gtk_widget_create_pango_layout  (GtkWidget   *widget,
                                               const gchar *text);
 
-/* widget style properties
- */
-GDK_AVAILABLE_IN_ALL
-void gtk_widget_class_install_style_property        (GtkWidgetClass     *klass,
-                                                    GParamSpec         *pspec);
-GDK_AVAILABLE_IN_ALL
-GParamSpec*  gtk_widget_class_find_style_property   (GtkWidgetClass     *klass,
-                                                    const gchar        *property_name);
-GDK_AVAILABLE_IN_ALL
-void gtk_widget_style_get_valist   (GtkWidget       *widget,
-                                   const gchar    *first_property_name,
-                                   va_list         var_args);
-GDK_AVAILABLE_IN_ALL
-void gtk_widget_style_get          (GtkWidget       *widget,
-                                   const gchar    *first_property_name,
-                                   ...) G_GNUC_NULL_TERMINATED;
-
 /* Functions for setting directionality for widgets */
 
 GDK_AVAILABLE_IN_ALL
diff --git a/tests/testtreepos.c b/tests/testtreepos.c
index 4f1d1c7..2c8fd88 100644
--- a/tests/testtreepos.c
+++ b/tests/testtreepos.c
@@ -25,7 +25,7 @@ clicked_icon (GtkTreeView  *tv,
        */
       depth = gtk_tree_path_get_depth (*path);
       level_indentation = gtk_tree_view_get_level_indentation (tv);
-      gtk_widget_style_get (GTK_WIDGET (tv), "expander-size", &expander_size, NULL);
+      expander_size = 16; /* Hardcoded in gtktreeview.c */
       expander_size += 4;
       indent = (depth - 1) * level_indentation + depth * expander_size;
 #else


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