mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
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.
This commit is contained in:
parent
df25349d63
commit
fb643c1c12
@ -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 *
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "gtkcssimagegradientprivate.h"
|
||||
|
||||
#include "gtkcssprovider.h"
|
||||
|
@ -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
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "gtkgradientprivate.h"
|
||||
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user