[gtk+] symboliccolor: Deprecate



commit fb643c1c1255a867ec37d5e6d087782295cbba69
Author: Benjamin Otte <otte redhat com>
Date:   Sun Nov 25 03:34:08 2012 +0100

    symboliccolor: Deprecate
    
    Symbolic colors are an implementation detail of the CSS engine and have
    been superceded by GtkCssColorValue. We don't want them clobbering the
    public API. In particular because the only use I could find in the
    public API is people using it to shade colors.

 gtk/gtkcsscustomproperty.c |    4 ++++
 gtk/gtkcssimagegradient.c  |    2 ++
 gtk/gtkcssstylefuncs.c     |   12 ++++++++++++
 gtk/gtkgradient.c          |    2 ++
 gtk/gtkmodifierstyle.c     |    4 ++++
 gtk/gtkstylecontext.c      |    4 ++++
 gtk/gtkstyleproperties.c   |   22 +++++++++++++++++++++-
 gtk/gtkstyleproperties.h   |    2 ++
 gtk/gtksymboliccolor.c     |   26 ++++++++++++++++++++++++++
 gtk/gtksymboliccolor.h     |   10 ++++++++++
 10 files changed, 87 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c
index 6d9230f..1a304af 100644
--- a/gtk/gtkcsscustomproperty.c
+++ b/gtk/gtkcsscustomproperty.c
@@ -34,11 +34,15 @@ G_DEFINE_TYPE (GtkCssCustomProperty, _gtk_css_custom_property, GTK_TYPE_CSS_STYL
 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 *
diff --git a/gtk/gtkcssimagegradient.c b/gtk/gtkcssimagegradient.c
index e6580eb..fa6aacf 100644
--- a/gtk/gtkcssimagegradient.c
+++ b/gtk/gtkcssimagegradient.c
@@ -19,6 +19,8 @@
 
 #include "config.h"
 
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
 #include "gtkcssimagegradientprivate.h"
 
 #include "gtkcssprovider.h"
diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c
index b19a3e6..5b2b5db 100644
--- a/gtk/gtkcssstylefuncs.c
+++ b/gtk/gtkcssstylefuncs.c
@@ -172,6 +172,8 @@ rgba_value_parse (GtkCssParser *parser,
   GtkSymbolicColor *symbolic;
   GdkRGBA rgba;
 
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   symbolic = _gtk_css_symbolic_value_new (parser);
   if (symbolic == NULL)
     return FALSE;
@@ -188,6 +190,8 @@ rgba_value_parse (GtkCssParser *parser,
       g_value_take_boxed (value, symbolic);
     }
 
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
   return TRUE;
 }
 
@@ -254,6 +258,8 @@ color_value_parse (GtkCssParser *parser,
   GtkSymbolicColor *symbolic;
   GdkRGBA rgba;
 
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   symbolic = _gtk_css_symbolic_value_new (parser);
   if (symbolic == NULL)
     return FALSE;
@@ -275,6 +281,8 @@ color_value_parse (GtkCssParser *parser,
       g_value_take_boxed (value, symbolic);
     }
 
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
   return TRUE;
 }
 
@@ -353,6 +361,8 @@ symbolic_color_value_print (const GValue *value,
 {
   GtkSymbolicColor *symbolic = g_value_get_boxed (value);
 
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   if (symbolic == NULL)
     g_string_append (string, "none");
   else
@@ -361,6 +371,8 @@ symbolic_color_value_print (const GValue *value,
       g_string_append (string, s);
       g_free (s);
     }
+
+  G_GNUC_END_IGNORE_DEPRECATIONS;
 }
 
 static gboolean 
diff --git a/gtk/gtkgradient.c b/gtk/gtkgradient.c
index f810c3b..78c0694 100644
--- a/gtk/gtkgradient.c
+++ b/gtk/gtkgradient.c
@@ -17,6 +17,8 @@
 
 #include "config.h"
 
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
 #include "gtkgradientprivate.h"
 
 #include "gtkcsscolorvalueprivate.h"
diff --git a/gtk/gtkmodifierstyle.c b/gtk/gtkmodifierstyle.c
index 9c12191..4d3cc35 100644
--- a/gtk/gtkmodifierstyle.c
+++ b/gtk/gtkmodifierstyle.c
@@ -256,12 +256,16 @@ _gtk_modifier_style_map_color (GtkModifierStyle *style,
 
   priv = style->priv;
 
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   if (color)
     symbolic_color = gtk_symbolic_color_new_literal (color);
 
   gtk_style_properties_map_color (priv->style,
                                   name, symbolic_color);
 
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
   g_signal_emit (style, signals[CHANGED], 0);
   _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
 }
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index b74163e..46822e2 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2283,6 +2283,8 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
                                                  widget_path,
                                                  state, pspec, &pcache->value))
         {
+          G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
           /* Resolve symbolic colors to GdkColor/GdkRGBA */
           if (G_VALUE_TYPE (&pcache->value) == GTK_TYPE_SYMBOLIC_COLOR)
             {
@@ -2319,6 +2321,8 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
               gtk_symbolic_color_unref (color);
             }
 
+          G_GNUC_END_IGNORE_DEPRECATIONS;
+
           if (priv->widget)
             gtk_widget_path_free (widget_path);
 
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c
index e86672a..e98cd44 100644
--- a/gtk/gtkstyleproperties.c
+++ b/gtk/gtkstyleproperties.c
@@ -289,7 +289,17 @@ static GtkCssValue *
 gtk_style_properties_provider_get_color (GtkStyleProviderPrivate *provider,
                                          const char              *name)
 {
-  return _gtk_symbolic_color_get_css_value (gtk_style_properties_lookup_color (GTK_STYLE_PROPERTIES (provider), name));
+  GtkSymbolicColor *symbolic;
+
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
+  symbolic = gtk_style_properties_lookup_color (GTK_STYLE_PROPERTIES (provider), name);
+  if (symbolic == NULL)
+    return NULL;
+
+  return _gtk_symbolic_color_get_css_value (symbolic);
+
+  G_GNUC_END_IGNORE_DEPRECATIONS;
 }
 
 static void
@@ -368,6 +378,8 @@ gtk_style_properties_new (void)
  * gtk_style_properties_lookup_color()
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 void
 gtk_style_properties_map_color (GtkStyleProperties *props,
@@ -382,6 +394,8 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
 
   priv = props->priv;
 
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   if (G_UNLIKELY (!priv->color_map))
     priv->color_map = g_hash_table_new_full (g_str_hash,
                                              g_str_equal,
@@ -392,6 +406,8 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
                         g_strdup (name),
                         gtk_symbolic_color_ref (color));
 
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
   _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
 }
 
@@ -406,6 +422,8 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
  * Returns: (transfer none): The mapped color
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 GtkSymbolicColor *
 gtk_style_properties_lookup_color (GtkStyleProperties *props,
@@ -862,7 +880,9 @@ gtk_style_properties_merge (GtkStyleProperties       *props,
               g_hash_table_lookup (priv->color_map, name))
             continue;
 
+          G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
           gtk_style_properties_map_color (props, name, color);
+          G_GNUC_END_IGNORE_DEPRECATIONS;
         }
     }
 
diff --git a/gtk/gtkstyleproperties.h b/gtk/gtkstyleproperties.h
index cf644d9..eb8ff70 100644
--- a/gtk/gtkstyleproperties.h
+++ b/gtk/gtkstyleproperties.h
@@ -74,9 +74,11 @@ gboolean gtk_style_properties_lookup_property   (const gchar             *proper
 
 GtkStyleProperties * gtk_style_properties_new (void);
 
+GDK_DEPRECATED_IN_3_8
 void               gtk_style_properties_map_color    (GtkStyleProperties *props,
                                                       const gchar        *name,
                                                       GtkSymbolicColor   *color);
+GDK_DEPRECATED_IN_3_8
 GtkSymbolicColor * gtk_style_properties_lookup_color (GtkStyleProperties *props,
                                                       const gchar        *name);
 
diff --git a/gtk/gtksymboliccolor.c b/gtk/gtksymboliccolor.c
index 5952cd7..db85a3b 100644
--- a/gtk/gtksymboliccolor.c
+++ b/gtk/gtksymboliccolor.c
@@ -16,6 +16,9 @@
  */
 
 #include "config.h"
+
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
 #include "gtkcsscolorvalueprivate.h"
 #include "gtkcssrgbavalueprivate.h"
 #include "gtkcssstylepropertyprivate.h"
@@ -43,6 +46,9 @@
  * It is not normally necessary to deal directly with #GtkSymbolicColors,
  * since they are mostly used behind the scenes by #GtkStyleContext and
  * #GtkCssProvider.
+ *
+ * #GtkSymbolicColor is deprecated. Symbolic colors are considered an
+ * implementation detail of GTK+.
  */
 
 G_DEFINE_BOXED_TYPE (GtkSymbolicColor, gtk_symbolic_color,
@@ -75,6 +81,8 @@ gtk_symbolic_color_new (GtkCssValue *value)
  * Returns: a newly created #GtkSymbolicColor
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 GtkSymbolicColor *
 gtk_symbolic_color_new_literal (const GdkRGBA *color)
@@ -95,6 +103,8 @@ gtk_symbolic_color_new_literal (const GdkRGBA *color)
  * Returns: a newly created #GtkSymbolicColor
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 GtkSymbolicColor *
 gtk_symbolic_color_new_name (const gchar *name)
@@ -117,6 +127,8 @@ gtk_symbolic_color_new_name (const gchar *name)
  * Returns: A newly created #GtkSymbolicColor
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 GtkSymbolicColor *
 gtk_symbolic_color_new_shade (GtkSymbolicColor *color,
@@ -141,6 +153,8 @@ gtk_symbolic_color_new_shade (GtkSymbolicColor *color,
  * Returns: A newly created #GtkSymbolicColor
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 GtkSymbolicColor *
 gtk_symbolic_color_new_alpha (GtkSymbolicColor *color,
@@ -165,6 +179,8 @@ gtk_symbolic_color_new_alpha (GtkSymbolicColor *color,
  * Returns: A newly created #GtkSymbolicColor
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 GtkSymbolicColor *
 gtk_symbolic_color_new_mix (GtkSymbolicColor *color1,
@@ -194,6 +210,8 @@ gtk_symbolic_color_new_mix (GtkSymbolicColor *color1,
  * Returns: A newly created #GtkSymbolicColor
  *
  * Since: 3.4
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  */
 GtkSymbolicColor *
 gtk_symbolic_color_new_win32 (const gchar *theme_class,
@@ -213,6 +231,8 @@ gtk_symbolic_color_new_win32 (const gchar *theme_class,
  * Returns: the same @color
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 GtkSymbolicColor *
 gtk_symbolic_color_ref (GtkSymbolicColor *color)
@@ -232,6 +252,8 @@ gtk_symbolic_color_ref (GtkSymbolicColor *color)
  * reference count reaches 0.
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 void
 gtk_symbolic_color_unref (GtkSymbolicColor *color)
@@ -265,6 +287,8 @@ gtk_symbolic_color_unref (GtkSymbolicColor *color)
  * Returns: %TRUE if the color has been resolved
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 gboolean
 gtk_symbolic_color_resolve (GtkSymbolicColor   *color,
@@ -304,6 +328,8 @@ gtk_symbolic_color_resolve (GtkSymbolicColor   *color,
  * create the same symbolic color from it.
  *
  * Returns: a new string representing @color
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
  **/
 char *
 gtk_symbolic_color_to_string (GtkSymbolicColor *color)
diff --git a/gtk/gtksymboliccolor.h b/gtk/gtksymboliccolor.h
index ee0c55e..937f935 100644
--- a/gtk/gtksymboliccolor.h
+++ b/gtk/gtksymboliccolor.h
@@ -31,23 +31,33 @@ G_BEGIN_DECLS
 
 GType              gtk_symbolic_color_get_type    (void) G_GNUC_CONST;
 
+GDK_DEPRECATED_IN_3_8
 GtkSymbolicColor * gtk_symbolic_color_new_literal (const GdkRGBA      *color);
+GDK_DEPRECATED_IN_3_8
 GtkSymbolicColor * gtk_symbolic_color_new_name    (const gchar        *name);
+GDK_DEPRECATED_IN_3_8
 GtkSymbolicColor * gtk_symbolic_color_new_shade   (GtkSymbolicColor   *color,
                                                    gdouble             factor);
+GDK_DEPRECATED_IN_3_8
 GtkSymbolicColor * gtk_symbolic_color_new_alpha   (GtkSymbolicColor   *color,
                                                    gdouble             factor);
+GDK_DEPRECATED_IN_3_8
 GtkSymbolicColor * gtk_symbolic_color_new_mix     (GtkSymbolicColor   *color1,
                                                    GtkSymbolicColor   *color2,
                                                    gdouble             factor);
+GDK_DEPRECATED_IN_3_8
 GtkSymbolicColor * gtk_symbolic_color_new_win32   (const gchar        *theme_class,
                                                    gint                id);
 
+GDK_DEPRECATED_IN_3_8
 GtkSymbolicColor * gtk_symbolic_color_ref         (GtkSymbolicColor   *color);
+GDK_DEPRECATED_IN_3_8
 void               gtk_symbolic_color_unref       (GtkSymbolicColor   *color);
 
+GDK_DEPRECATED_IN_3_8
 char *             gtk_symbolic_color_to_string   (GtkSymbolicColor   *color);
 
+GDK_DEPRECATED_IN_3_8
 gboolean           gtk_symbolic_color_resolve     (GtkSymbolicColor   *color,
                                                    GtkStyleProperties *props,
                                                    GdkRGBA            *resolved_color);



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