From b59e6f1948bda1245840cecfc2df115cd582cdcd Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 15 Jun 2014 16:05:16 +0200 Subject: [PATCH] themingengine: Deprecate --- gtk/gtkcsscustomproperty.c | 5 +-- gtk/gtkcssstylefuncs.c | 10 ++++++ gtk/gtkcssstylepropertyimpl.c | 4 +++ gtk/gtkthemingengine.c | 63 ++++++++++++++++++++++++++++------- gtk/gtkthemingengine.h | 40 +++++++++++----------- 5 files changed, 88 insertions(+), 34 deletions(-) diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c index 21dd0f1917..5b3c1c37f3 100644 --- a/gtk/gtkcsscustomproperty.c +++ b/gtk/gtkcsscustomproperty.c @@ -141,6 +141,8 @@ gtk_css_custom_property_create_initial_value (GParamSpec *pspec) g_value_init (&value, pspec->value_type); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS if (pspec->value_type == GTK_TYPE_THEMING_ENGINE) g_value_set_object (&value, gtk_theming_engine_load (NULL)); 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")) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS GdkColor color; gdk_color_parse ("pink", &color); g_value_set_boxed (&value, &color); -G_GNUC_END_IGNORE_DEPRECATIONS } else if (pspec->value_type == GTK_TYPE_BORDER) { @@ -165,6 +165,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS } else g_param_value_set_default (pspec, &value); +G_GNUC_END_IGNORE_DEPRECATIONS result = _gtk_css_typed_value_new (&value); g_value_unset (&value); diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c index 8b5393a79b..a2da562df6 100644 --- a/gtk/gtkcssstylefuncs.c +++ b/gtk/gtkcssstylefuncs.c @@ -562,6 +562,8 @@ theming_engine_value_parse (GtkCssParser *parser, GtkThemingEngine *engine; char *str; +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + if (_gtk_css_parser_try (parser, "none", TRUE)) { 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_free (str); return TRUE; + +G_GNUC_END_IGNORE_DEPRECATIONS } static void @@ -1021,10 +1025,16 @@ gtk_css_style_funcs_init (void) string_value_parse, string_value_print, NULL); + + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + register_conversion_function (GTK_TYPE_THEMING_ENGINE, theming_engine_value_parse, theming_engine_value_print, NULL); + + G_GNUC_END_IGNORE_DEPRECATIONS + register_conversion_function (GTK_TYPE_BORDER, border_value_parse, border_value_print, diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index 442c2b42fa..27e77dbc6c 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -830,8 +830,10 @@ engine_query (GtkCssStyleProperty *property, const GtkCssValue *css_value, GValue *value) { +G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_value_init (value, GTK_TYPE_THEMING_ENGINE); g_value_set_object (value, _gtk_css_engine_value_get_engine (css_value)); +G_GNUC_END_IGNORE_DEPRECATIONS } static GtkCssValue * @@ -1507,6 +1509,7 @@ _gtk_css_style_property_init_properties (void) NULL, _gtk_css_image_effect_value_new (GTK_CSS_IMAGE_EFFECT_NONE)); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_css_style_property_register ("engine", GTK_CSS_PROPERTY_ENGINE, GTK_TYPE_THEMING_ENGINE, @@ -1515,6 +1518,7 @@ _gtk_css_style_property_init_properties (void) engine_query, engine_assign, _gtk_css_engine_value_new (gtk_theming_engine_load (NULL))); +G_GNUC_END_IGNORE_DEPRECATIONS /* Private property holding the binding sets */ gtk_css_style_property_register ("gtk-key-bindings", diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c index 683128d850..580e8a55c6 100644 --- a/gtk/gtkthemingengine.c +++ b/gtk/gtkthemingengine.c @@ -45,25 +45,23 @@ #include "fallback-c89.c" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /** * SECTION:gtkthemingengine * @Short_description: Theming renderers * @Title: GtkThemingEngine * @See_also: #GtkStyleContext * - * #GtkThemingEngine is the object used for rendering themed content - * in GTK+ widgets. Even though GTK+ has a default implementation, - * it can be overridden in CSS files by enforcing a #GtkThemingEngine - * object to be loaded as a module. + * #GtkThemingEngine was the object used for rendering themed content + * in GTK+ widgets. It used to allow overriding GTK+'s default + * implementation of rendering functions by allowing engines to be + * loaded as modules. * - * In order to implement a theming engine, a #GtkThemingEngine subclass - * must be created, alongside the CSS file that will reference it, the - * theming engine would be created as an .so library, and installed in - * $(gtk-modules-dir)/theming-engines/. - * - * #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 object’s #GtkStyleContext. + * #GtkThemingEngine has been deprecated in GTK+ 3.14 and will be + * ignored for rendering. The advancements in CSS theming are good + * enough to allow themers to achieve their goals without the need + * to modify source code. */ enum { @@ -356,6 +354,8 @@ _gtk_theming_engine_set_context (GtkThemingEngine *engine, * to the currently rendered element. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void gtk_theming_engine_get_property (GtkThemingEngine *engine, @@ -383,6 +383,8 @@ gtk_theming_engine_get_property (GtkThemingEngine *engine, * rendered element. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void gtk_theming_engine_get_valist (GtkThemingEngine *engine, @@ -407,6 +409,8 @@ gtk_theming_engine_get_valist (GtkThemingEngine *engine, * rendered element. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void gtk_theming_engine_get (GtkThemingEngine *engine, @@ -435,6 +439,8 @@ gtk_theming_engine_get (GtkThemingEngine *engine, * Gets the value for a widget style property. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void gtk_theming_engine_get_style_property (GtkThemingEngine *engine, @@ -459,6 +465,8 @@ gtk_theming_engine_get_style_property (GtkThemingEngine *engine, * currently rendered content’s style. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void gtk_theming_engine_get_style_valist (GtkThemingEngine *engine, @@ -481,6 +489,8 @@ gtk_theming_engine_get_style_valist (GtkThemingEngine *engine, * to the currently rendered content’s style. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void 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 style’s color map. * * Returns: %TRUE if @color_name was found and resolved, %FALSE otherwise + * + * Since: 3.0 + * + * Deprecated: 3.14 **/ gboolean gtk_theming_engine_lookup_color (GtkThemingEngine *engine, @@ -531,6 +545,8 @@ gtk_theming_engine_lookup_color (GtkThemingEngine *engine, * Returns: the state flags * * Since: 3.0 + * + * Deprecated: 3.14 **/ GtkStateFlags gtk_theming_engine_get_state (GtkThemingEngine *engine) @@ -583,6 +599,8 @@ gtk_theming_engine_state_is_running (GtkThemingEngine *engine, * Returns: (transfer none): A #GtkWidgetPath * * Since: 3.0 + * + * Deprecated: 3.14 **/ const GtkWidgetPath * 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 * * Since: 3.0 + * + * Deprecated: 3.14 **/ gboolean gtk_theming_engine_has_class (GtkThemingEngine *engine, @@ -689,6 +709,8 @@ gtk_theming_engine_get_direction (GtkThemingEngine *engine) * Returns: the widget direction * * Since: 3.0 + * + * Deprecated: 3.14 **/ GtkJunctionSides 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. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void 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. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void 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. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void 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. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void 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. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void 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. * * Since: 3.0 + * + * Deprecated: 3.14 **/ void 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 * the engine @name doesn’t exist. + * + * Deprecated: 3.14 **/ GtkThemingEngine * 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: (transfer none): a #GdkScreen, or %NULL. + * + * Deprecated: 3.14 **/ GdkScreen * gtk_theming_engine_get_screen (GtkThemingEngine *engine) @@ -2782,3 +2820,4 @@ gtk_theming_engine_render_icon_surface (GtkThemingEngine *engine, cairo_restore (cr); } +G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gtk/gtkthemingengine.h b/gtk/gtkthemingengine.h index 7e75b1bc44..469504fe43 100644 --- a/gtk/gtkthemingengine.h +++ b/gtk/gtkthemingengine.h @@ -187,7 +187,7 @@ struct _GtkThemingEngineClass gpointer padding[14]; }; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 GType gtk_theming_engine_get_type (void) G_GNUC_CONST; /* function implemented in gtkcsscustomproperty.c */ @@ -196,40 +196,40 @@ void gtk_theming_engine_register_property (const gchar *name_space, GtkStylePropertyParser parse_func, GParamSpec *pspec); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_property (GtkThemingEngine *engine, const gchar *property, GtkStateFlags state, GValue *value); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_valist (GtkThemingEngine *engine, GtkStateFlags state, va_list args); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get (GtkThemingEngine *engine, GtkStateFlags state, ...) G_GNUC_NULL_TERMINATED; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_style_property (GtkThemingEngine *engine, const gchar *property_name, GValue *value); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_style_valist (GtkThemingEngine *engine, va_list args); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 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, const gchar *color_name, GdkRGBA *color); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 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, const gchar *style_class); GDK_DEPRECATED_IN_3_14 @@ -237,7 +237,7 @@ gboolean gtk_theming_engine_has_region (GtkThemingEngine *engine, const gchar *style_region, GtkRegionFlags *flags); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 GtkStateFlags gtk_theming_engine_get_state (GtkThemingEngine *engine); GDK_DEPRECATED_IN_3_6 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) 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); /* Helper functions */ -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_color (GtkThemingEngine *engine, GtkStateFlags state, GdkRGBA *color); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_background_color (GtkThemingEngine *engine, GtkStateFlags state, GdkRGBA *color); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_border_color (GtkThemingEngine *engine, GtkStateFlags state, GdkRGBA *color); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_border (GtkThemingEngine *engine, GtkStateFlags state, GtkBorder *border); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_padding (GtkThemingEngine *engine, GtkStateFlags state, GtkBorder *padding); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 void gtk_theming_engine_get_margin (GtkThemingEngine *engine, GtkStateFlags state, 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, GtkStateFlags state); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_14 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); G_END_DECLS