themingengine: Deprecate

This commit is contained in:
Benjamin Otte
2014-06-15 16:05:16 +02:00
parent 9ca04c0f9d
commit b59e6f1948
5 changed files with 88 additions and 34 deletions

View File

@ -141,6 +141,8 @@ gtk_css_custom_property_create_initial_value (GParamSpec *pspec)
g_value_init (&value, pspec->value_type); g_value_init (&value, pspec->value_type);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (pspec->value_type == GTK_TYPE_THEMING_ENGINE) if (pspec->value_type == GTK_TYPE_THEMING_ENGINE)
g_value_set_object (&value, gtk_theming_engine_load (NULL)); g_value_set_object (&value, gtk_theming_engine_load (NULL));
else if (pspec->value_type == PANGO_TYPE_FONT_DESCRIPTION) else if (pspec->value_type == PANGO_TYPE_FONT_DESCRIPTION)
@ -153,11 +155,9 @@ gtk_css_custom_property_create_initial_value (GParamSpec *pspec)
} }
else if (pspec->value_type == g_type_from_name ("GdkColor")) else if (pspec->value_type == g_type_from_name ("GdkColor"))
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GdkColor color; GdkColor color;
gdk_color_parse ("pink", &color); gdk_color_parse ("pink", &color);
g_value_set_boxed (&value, &color); g_value_set_boxed (&value, &color);
G_GNUC_END_IGNORE_DEPRECATIONS
} }
else if (pspec->value_type == GTK_TYPE_BORDER) else if (pspec->value_type == GTK_TYPE_BORDER)
{ {
@ -165,6 +165,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
} }
else else
g_param_value_set_default (pspec, &value); g_param_value_set_default (pspec, &value);
G_GNUC_END_IGNORE_DEPRECATIONS
result = _gtk_css_typed_value_new (&value); result = _gtk_css_typed_value_new (&value);
g_value_unset (&value); g_value_unset (&value);

View File

@ -562,6 +562,8 @@ theming_engine_value_parse (GtkCssParser *parser,
GtkThemingEngine *engine; GtkThemingEngine *engine;
char *str; char *str;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (_gtk_css_parser_try (parser, "none", TRUE)) if (_gtk_css_parser_try (parser, "none", TRUE))
{ {
g_value_set_object (value, gtk_theming_engine_load (NULL)); g_value_set_object (value, gtk_theming_engine_load (NULL));
@ -587,6 +589,8 @@ theming_engine_value_parse (GtkCssParser *parser,
g_value_set_object (value, engine); g_value_set_object (value, engine);
g_free (str); g_free (str);
return TRUE; return TRUE;
G_GNUC_END_IGNORE_DEPRECATIONS
} }
static void static void
@ -1021,10 +1025,16 @@ gtk_css_style_funcs_init (void)
string_value_parse, string_value_parse,
string_value_print, string_value_print,
NULL); NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
register_conversion_function (GTK_TYPE_THEMING_ENGINE, register_conversion_function (GTK_TYPE_THEMING_ENGINE,
theming_engine_value_parse, theming_engine_value_parse,
theming_engine_value_print, theming_engine_value_print,
NULL); NULL);
G_GNUC_END_IGNORE_DEPRECATIONS
register_conversion_function (GTK_TYPE_BORDER, register_conversion_function (GTK_TYPE_BORDER,
border_value_parse, border_value_parse,
border_value_print, border_value_print,

View File

@ -830,8 +830,10 @@ engine_query (GtkCssStyleProperty *property,
const GtkCssValue *css_value, const GtkCssValue *css_value,
GValue *value) GValue *value)
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_value_init (value, GTK_TYPE_THEMING_ENGINE); g_value_init (value, GTK_TYPE_THEMING_ENGINE);
g_value_set_object (value, _gtk_css_engine_value_get_engine (css_value)); g_value_set_object (value, _gtk_css_engine_value_get_engine (css_value));
G_GNUC_END_IGNORE_DEPRECATIONS
} }
static GtkCssValue * static GtkCssValue *
@ -1507,6 +1509,7 @@ _gtk_css_style_property_init_properties (void)
NULL, NULL,
_gtk_css_image_effect_value_new (GTK_CSS_IMAGE_EFFECT_NONE)); _gtk_css_image_effect_value_new (GTK_CSS_IMAGE_EFFECT_NONE));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_css_style_property_register ("engine", gtk_css_style_property_register ("engine",
GTK_CSS_PROPERTY_ENGINE, GTK_CSS_PROPERTY_ENGINE,
GTK_TYPE_THEMING_ENGINE, GTK_TYPE_THEMING_ENGINE,
@ -1515,6 +1518,7 @@ _gtk_css_style_property_init_properties (void)
engine_query, engine_query,
engine_assign, engine_assign,
_gtk_css_engine_value_new (gtk_theming_engine_load (NULL))); _gtk_css_engine_value_new (gtk_theming_engine_load (NULL)));
G_GNUC_END_IGNORE_DEPRECATIONS
/* Private property holding the binding sets */ /* Private property holding the binding sets */
gtk_css_style_property_register ("gtk-key-bindings", gtk_css_style_property_register ("gtk-key-bindings",

View File

@ -45,25 +45,23 @@
#include "fallback-c89.c" #include "fallback-c89.c"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/** /**
* SECTION:gtkthemingengine * SECTION:gtkthemingengine
* @Short_description: Theming renderers * @Short_description: Theming renderers
* @Title: GtkThemingEngine * @Title: GtkThemingEngine
* @See_also: #GtkStyleContext * @See_also: #GtkStyleContext
* *
* #GtkThemingEngine is the object used for rendering themed content * #GtkThemingEngine was the object used for rendering themed content
* in GTK+ widgets. Even though GTK+ has a default implementation, * in GTK+ widgets. It used to allow overriding GTK+'s default
* it can be overridden in CSS files by enforcing a #GtkThemingEngine * implementation of rendering functions by allowing engines to be
* object to be loaded as a module. * loaded as modules.
* *
* In order to implement a theming engine, a #GtkThemingEngine subclass * #GtkThemingEngine has been deprecated in GTK+ 3.14 and will be
* must be created, alongside the CSS file that will reference it, the * ignored for rendering. The advancements in CSS theming are good
* theming engine would be created as an .so library, and installed in * enough to allow themers to achieve their goals without the need
* $(gtk-modules-dir)/theming-engines/. * to modify source code.
*
* #GtkThemingEngines have limited access to the object they are
* rendering, the #GtkThemingEngine API has read-only accessors to the
* style information contained in the rendered objects #GtkStyleContext.
*/ */
enum { enum {
@ -356,6 +354,8 @@ _gtk_theming_engine_set_context (GtkThemingEngine *engine,
* to the currently rendered element. * to the currently rendered element.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_property (GtkThemingEngine *engine, gtk_theming_engine_get_property (GtkThemingEngine *engine,
@ -383,6 +383,8 @@ gtk_theming_engine_get_property (GtkThemingEngine *engine,
* rendered element. * rendered element.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_valist (GtkThemingEngine *engine, gtk_theming_engine_get_valist (GtkThemingEngine *engine,
@ -407,6 +409,8 @@ gtk_theming_engine_get_valist (GtkThemingEngine *engine,
* rendered element. * rendered element.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get (GtkThemingEngine *engine, gtk_theming_engine_get (GtkThemingEngine *engine,
@ -435,6 +439,8 @@ gtk_theming_engine_get (GtkThemingEngine *engine,
* Gets the value for a widget style property. * Gets the value for a widget style property.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_style_property (GtkThemingEngine *engine, gtk_theming_engine_get_style_property (GtkThemingEngine *engine,
@ -459,6 +465,8 @@ gtk_theming_engine_get_style_property (GtkThemingEngine *engine,
* currently rendered contents style. * currently rendered contents style.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_style_valist (GtkThemingEngine *engine, gtk_theming_engine_get_style_valist (GtkThemingEngine *engine,
@ -481,6 +489,8 @@ gtk_theming_engine_get_style_valist (GtkThemingEngine *engine,
* to the currently rendered contents style. * to the currently rendered contents style.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_style (GtkThemingEngine *engine, gtk_theming_engine_get_style (GtkThemingEngine *engine,
@ -507,6 +517,10 @@ gtk_theming_engine_get_style (GtkThemingEngine *engine,
* Looks up and resolves a color name in the current styles color map. * Looks up and resolves a color name in the current styles color map.
* *
* Returns: %TRUE if @color_name was found and resolved, %FALSE otherwise * Returns: %TRUE if @color_name was found and resolved, %FALSE otherwise
*
* Since: 3.0
*
* Deprecated: 3.14
**/ **/
gboolean gboolean
gtk_theming_engine_lookup_color (GtkThemingEngine *engine, gtk_theming_engine_lookup_color (GtkThemingEngine *engine,
@ -531,6 +545,8 @@ gtk_theming_engine_lookup_color (GtkThemingEngine *engine,
* Returns: the state flags * Returns: the state flags
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
GtkStateFlags GtkStateFlags
gtk_theming_engine_get_state (GtkThemingEngine *engine) gtk_theming_engine_get_state (GtkThemingEngine *engine)
@ -583,6 +599,8 @@ gtk_theming_engine_state_is_running (GtkThemingEngine *engine,
* Returns: (transfer none): A #GtkWidgetPath * Returns: (transfer none): A #GtkWidgetPath
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
const GtkWidgetPath * const GtkWidgetPath *
gtk_theming_engine_get_path (GtkThemingEngine *engine) gtk_theming_engine_get_path (GtkThemingEngine *engine)
@ -606,6 +624,8 @@ gtk_theming_engine_get_path (GtkThemingEngine *engine)
* Returns: %TRUE if @engine has @class_name defined * Returns: %TRUE if @engine has @class_name defined
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
gboolean gboolean
gtk_theming_engine_has_class (GtkThemingEngine *engine, gtk_theming_engine_has_class (GtkThemingEngine *engine,
@ -689,6 +709,8 @@ gtk_theming_engine_get_direction (GtkThemingEngine *engine)
* Returns: the widget direction * Returns: the widget direction
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
GtkJunctionSides GtkJunctionSides
gtk_theming_engine_get_junction_sides (GtkThemingEngine *engine) gtk_theming_engine_get_junction_sides (GtkThemingEngine *engine)
@ -710,6 +732,8 @@ gtk_theming_engine_get_junction_sides (GtkThemingEngine *engine)
* Gets the foreground color for a given state. * Gets the foreground color for a given state.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_color (GtkThemingEngine *engine, gtk_theming_engine_get_color (GtkThemingEngine *engine,
@ -733,6 +757,8 @@ gtk_theming_engine_get_color (GtkThemingEngine *engine,
* Gets the background color for a given state. * Gets the background color for a given state.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_background_color (GtkThemingEngine *engine, gtk_theming_engine_get_background_color (GtkThemingEngine *engine,
@ -756,6 +782,8 @@ gtk_theming_engine_get_background_color (GtkThemingEngine *engine,
* Gets the border color for a given state. * Gets the border color for a given state.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_border_color (GtkThemingEngine *engine, gtk_theming_engine_get_border_color (GtkThemingEngine *engine,
@ -779,6 +807,8 @@ gtk_theming_engine_get_border_color (GtkThemingEngine *engine,
* Gets the border for a given state as a #GtkBorder. * Gets the border for a given state as a #GtkBorder.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_border (GtkThemingEngine *engine, gtk_theming_engine_get_border (GtkThemingEngine *engine,
@ -802,6 +832,8 @@ gtk_theming_engine_get_border (GtkThemingEngine *engine,
* Gets the padding for a given state as a #GtkBorder. * Gets the padding for a given state as a #GtkBorder.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_padding (GtkThemingEngine *engine, gtk_theming_engine_get_padding (GtkThemingEngine *engine,
@ -825,6 +857,8 @@ gtk_theming_engine_get_padding (GtkThemingEngine *engine,
* Gets the margin for a given state as a #GtkBorder. * Gets the margin for a given state as a #GtkBorder.
* *
* Since: 3.0 * Since: 3.0
*
* Deprecated: 3.14
**/ **/
void void
gtk_theming_engine_get_margin (GtkThemingEngine *engine, gtk_theming_engine_get_margin (GtkThemingEngine *engine,
@ -949,6 +983,8 @@ gtk_theming_module_init (GtkThemingModule *module)
* *
* Returns: (transfer none): A theming engine, or %NULL if * Returns: (transfer none): A theming engine, or %NULL if
* the engine @name doesnt exist. * the engine @name doesnt exist.
*
* Deprecated: 3.14
**/ **/
GtkThemingEngine * GtkThemingEngine *
gtk_theming_engine_load (const gchar *name) gtk_theming_engine_load (const gchar *name)
@ -999,6 +1035,8 @@ gtk_theming_engine_load (const gchar *name)
* Returns the #GdkScreen to which @engine currently rendering to. * Returns the #GdkScreen to which @engine currently rendering to.
* *
* Returns: (transfer none): a #GdkScreen, or %NULL. * Returns: (transfer none): a #GdkScreen, or %NULL.
*
* Deprecated: 3.14
**/ **/
GdkScreen * GdkScreen *
gtk_theming_engine_get_screen (GtkThemingEngine *engine) gtk_theming_engine_get_screen (GtkThemingEngine *engine)
@ -2782,3 +2820,4 @@ gtk_theming_engine_render_icon_surface (GtkThemingEngine *engine,
cairo_restore (cr); cairo_restore (cr);
} }
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -187,7 +187,7 @@ struct _GtkThemingEngineClass
gpointer padding[14]; gpointer padding[14];
}; };
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
GType gtk_theming_engine_get_type (void) G_GNUC_CONST; GType gtk_theming_engine_get_type (void) G_GNUC_CONST;
/* function implemented in gtkcsscustomproperty.c */ /* function implemented in gtkcsscustomproperty.c */
@ -196,40 +196,40 @@ void gtk_theming_engine_register_property (const gchar *name_space,
GtkStylePropertyParser parse_func, GtkStylePropertyParser parse_func,
GParamSpec *pspec); GParamSpec *pspec);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_property (GtkThemingEngine *engine, void gtk_theming_engine_get_property (GtkThemingEngine *engine,
const gchar *property, const gchar *property,
GtkStateFlags state, GtkStateFlags state,
GValue *value); GValue *value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_valist (GtkThemingEngine *engine, void gtk_theming_engine_get_valist (GtkThemingEngine *engine,
GtkStateFlags state, GtkStateFlags state,
va_list args); va_list args);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get (GtkThemingEngine *engine, void gtk_theming_engine_get (GtkThemingEngine *engine,
GtkStateFlags state, GtkStateFlags state,
...) G_GNUC_NULL_TERMINATED; ...) G_GNUC_NULL_TERMINATED;
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_style_property (GtkThemingEngine *engine, void gtk_theming_engine_get_style_property (GtkThemingEngine *engine,
const gchar *property_name, const gchar *property_name,
GValue *value); GValue *value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_style_valist (GtkThemingEngine *engine, void gtk_theming_engine_get_style_valist (GtkThemingEngine *engine,
va_list args); va_list args);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_style (GtkThemingEngine *engine, void gtk_theming_engine_get_style (GtkThemingEngine *engine,
...); ...);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
gboolean gtk_theming_engine_lookup_color (GtkThemingEngine *engine, gboolean gtk_theming_engine_lookup_color (GtkThemingEngine *engine,
const gchar *color_name, const gchar *color_name,
GdkRGBA *color); GdkRGBA *color);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
const GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine); const GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
gboolean gtk_theming_engine_has_class (GtkThemingEngine *engine, gboolean gtk_theming_engine_has_class (GtkThemingEngine *engine,
const gchar *style_class); const gchar *style_class);
GDK_DEPRECATED_IN_3_14 GDK_DEPRECATED_IN_3_14
@ -237,7 +237,7 @@ gboolean gtk_theming_engine_has_region (GtkThemingEngine *engine,
const gchar *style_region, const gchar *style_region,
GtkRegionFlags *flags); GtkRegionFlags *flags);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
GtkStateFlags gtk_theming_engine_get_state (GtkThemingEngine *engine); GtkStateFlags gtk_theming_engine_get_state (GtkThemingEngine *engine);
GDK_DEPRECATED_IN_3_6 GDK_DEPRECATED_IN_3_6
gboolean gtk_theming_engine_state_is_running (GtkThemingEngine *engine, gboolean gtk_theming_engine_state_is_running (GtkThemingEngine *engine,
@ -247,32 +247,32 @@ gboolean gtk_theming_engine_state_is_running (GtkThemingEngine *engine,
GDK_DEPRECATED_IN_3_8_FOR(gtk_theming_engine_get_state) GDK_DEPRECATED_IN_3_8_FOR(gtk_theming_engine_get_state)
GtkTextDirection gtk_theming_engine_get_direction (GtkThemingEngine *engine); GtkTextDirection gtk_theming_engine_get_direction (GtkThemingEngine *engine);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
GtkJunctionSides gtk_theming_engine_get_junction_sides (GtkThemingEngine *engine); GtkJunctionSides gtk_theming_engine_get_junction_sides (GtkThemingEngine *engine);
/* Helper functions */ /* Helper functions */
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_color (GtkThemingEngine *engine, void gtk_theming_engine_get_color (GtkThemingEngine *engine,
GtkStateFlags state, GtkStateFlags state,
GdkRGBA *color); GdkRGBA *color);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_background_color (GtkThemingEngine *engine, void gtk_theming_engine_get_background_color (GtkThemingEngine *engine,
GtkStateFlags state, GtkStateFlags state,
GdkRGBA *color); GdkRGBA *color);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_border_color (GtkThemingEngine *engine, void gtk_theming_engine_get_border_color (GtkThemingEngine *engine,
GtkStateFlags state, GtkStateFlags state,
GdkRGBA *color); GdkRGBA *color);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_border (GtkThemingEngine *engine, void gtk_theming_engine_get_border (GtkThemingEngine *engine,
GtkStateFlags state, GtkStateFlags state,
GtkBorder *border); GtkBorder *border);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_padding (GtkThemingEngine *engine, void gtk_theming_engine_get_padding (GtkThemingEngine *engine,
GtkStateFlags state, GtkStateFlags state,
GtkBorder *padding); GtkBorder *padding);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
void gtk_theming_engine_get_margin (GtkThemingEngine *engine, void gtk_theming_engine_get_margin (GtkThemingEngine *engine,
GtkStateFlags state, GtkStateFlags state,
GtkBorder *margin); GtkBorder *margin);
@ -281,10 +281,10 @@ GDK_DEPRECATED_IN_3_8_FOR(gtk_theming_engine_get)
const PangoFontDescription * gtk_theming_engine_get_font (GtkThemingEngine *engine, const PangoFontDescription * gtk_theming_engine_get_font (GtkThemingEngine *engine,
GtkStateFlags state); GtkStateFlags state);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
GtkThemingEngine * gtk_theming_engine_load (const gchar *name); GtkThemingEngine * gtk_theming_engine_load (const gchar *name);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_3_14
GdkScreen * gtk_theming_engine_get_screen (GtkThemingEngine *engine); GdkScreen * gtk_theming_engine_get_screen (GtkThemingEngine *engine);
G_END_DECLS G_END_DECLS