[gtk/deprecate-render: 54/54] stylecontext: Deprecate most apis
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/deprecate-render: 54/54] stylecontext: Deprecate most apis
- Date: Mon, 10 Oct 2022 03:39:50 +0000 (UTC)
commit 64ee48fdb02b0ae55e14e4aad9106d2ce26765f6
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Oct 9 23:30:06 2022 -0400
stylecontext: Deprecate most apis
The notable exception here are the
add_remove_provider_for_display apis,
which are needed in some form and don't
have a replacement yet.
gtk/gtkstylecontext.c | 39 +++++++++++++++++++++++++++++++++++++++
gtk/gtkstylecontext.h | 38 +++++++++++++++++++-------------------
gtk/gtkwidget.c | 10 ++++++++++
3 files changed, 68 insertions(+), 19 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 18c90bf0d9..2eff189886 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -220,7 +220,9 @@ gtk_style_context_impl_set_property (GObject *object,
switch (prop_id)
{
case PROP_DISPLAY:
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_set_display (context, g_value_get_object (value));
+G_GNUC_END_IGNORE_DEPRECATIONS
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -341,6 +343,8 @@ gtk_style_context_new_for_node (GtkCssNode *node)
* Note: If both priorities are the same, a `GtkStyleProvider`
* added through this function takes precedence over another added
* through [func@Gtk.StyleContext.add_provider_for_display].
+ *
+ * Deprecated: 4.10: Use style classes instead
*/
void
gtk_style_context_add_provider (GtkStyleContext *context,
@@ -376,6 +380,8 @@ gtk_style_context_add_provider (GtkStyleContext *context,
* @provider: a `GtkStyleProvider`
*
* Removes @provider from the style providers list in @context.
+ *
+ * Deprecated: 4.10
*/
void
gtk_style_context_remove_provider (GtkStyleContext *context,
@@ -454,6 +460,8 @@ gtk_style_context_remove_provider_for_display (GdkDisplay *display,
* @flags: state to represent
*
* Sets the state to be used for style matching.
+ *
+ * Deprecated: 4.10: You should not use this api
*/
void
gtk_style_context_set_state (GtkStyleContext *context,
@@ -479,6 +487,8 @@ gtk_style_context_set_state (GtkStyleContext *context,
* [method@Gtk.Widget.get_state_flags].
*
* Returns: the state flags
+ *
+ * Deprecated: 4.10: Use [method@Gtk.Widget.get_state_flags] instead
**/
GtkStateFlags
gtk_style_context_get_state (GtkStyleContext *context)
@@ -496,6 +506,8 @@ gtk_style_context_get_state (GtkStyleContext *context)
* @scale: scale
*
* Sets the scale to use when getting image assets for the style.
+ *
+ * Deprecated: 4.10: You should not use this api
**/
void
gtk_style_context_set_scale (GtkStyleContext *context,
@@ -529,6 +541,8 @@ gtk_style_context_set_scale (GtkStyleContext *context,
* Returns the scale used for assets.
*
* Returns: the scale
+ *
+ * Deprecated 4.10: Use [method@Gtk.Widget.get_scale_factor] instead
**/
int
gtk_style_context_get_scale (GtkStyleContext *context)
@@ -586,6 +600,8 @@ gtk_style_context_save_to_node (GtkStyleContext *context,
*
* The matching call to [method@Gtk.StyleContext.restore]
* must be done before GTK returns to the main loop.
+ *
+ * Deprecated: 4.10: This API will be removed in GTK 5
**/
void
gtk_style_context_save (GtkStyleContext *context)
@@ -616,6 +632,8 @@ gtk_style_context_save (GtkStyleContext *context)
* Restores @context state to a previous stage.
*
* See [method Gtk StyleContext save].
+ *
+ * Deprecated: 4.10: This API will be removed in GTK 5
**/
void
gtk_style_context_restore (GtkStyleContext *context)
@@ -653,6 +671,7 @@ gtk_style_context_restore (GtkStyleContext *context)
* ```css
* .search { ... }
* ```
+ * Deprecated: 4.10: Use [method@Gtk.Widget.add_class] instead
*/
void
gtk_style_context_add_class (GtkStyleContext *context,
@@ -675,6 +694,8 @@ gtk_style_context_add_class (GtkStyleContext *context,
* @class_name: class name to remove
*
* Removes @class_name from @context.
+ *
+ * Deprecated: 4.10: Use [method@Gtk.Widget.remove_class] instead
*/
void
gtk_style_context_remove_class (GtkStyleContext *context,
@@ -702,6 +723,8 @@ gtk_style_context_remove_class (GtkStyleContext *context,
* given class name.
*
* Returns: %TRUE if @context has @class_name defined
+ *
+ * Deprecated: 4.10: Use [method@Gtk.Widget.has_class] instead
**/
gboolean
gtk_style_context_has_class (GtkStyleContext *context,
@@ -742,6 +765,8 @@ _gtk_style_context_peek_property (GtkStyleContext *context,
* If you are using a `GtkStyleContext` returned from
* [method@Gtk.Widget.get_style_context], you do not need to
* call this yourself.
+ *
+ * Deprecated: 4.10: You should not be using this api
*/
void
gtk_style_context_set_display (GtkStyleContext *context,
@@ -780,6 +805,8 @@ gtk_style_context_set_display (GtkStyleContext *context,
* Returns the `GdkDisplay` to which @context is attached.
*
* Returns: (transfer none): a `GdkDisplay`.
+ *
+ * Deprecated: 4.10: Use [method@Gtk.Widget.get_display] instead
*/
GdkDisplay *
gtk_style_context_get_display (GtkStyleContext *context)
@@ -824,6 +851,8 @@ gtk_style_context_resolve_color (GtkStyleContext *context,
* Looks up and resolves a color name in the @context color map.
*
* Returns: %TRUE if @color_name was found and resolved, %FALSE otherwise
+ *
+ * Deprecated: 4.10: This api will be removed in GTK 5
*/
gboolean
gtk_style_context_lookup_color (GtkStyleContext *context,
@@ -850,6 +879,8 @@ gtk_style_context_lookup_color (GtkStyleContext *context,
* @color: (out): return value for the foreground color
*
* Gets the foreground color for a given state.
+ *
+ * Deprecated: 4.10: This api will be removed in GTK 5
*/
void
gtk_style_context_get_color (GtkStyleContext *context,
@@ -867,6 +898,8 @@ gtk_style_context_get_color (GtkStyleContext *context,
* @border: (out): return value for the border settings
*
* Gets the border for a given state as a `GtkBorder`.
+ *
+ * Deprecated: 4.10: This api will be removed in GTK 5
*/
void
gtk_style_context_get_border (GtkStyleContext *context,
@@ -891,6 +924,8 @@ gtk_style_context_get_border (GtkStyleContext *context,
* @padding: (out): return value for the padding settings
*
* Gets the padding for a given state as a `GtkBorder`.
+ *
+ * Deprecated: 4.10: This api will be removed in GTK 5
*/
void
gtk_style_context_get_padding (GtkStyleContext *context,
@@ -915,6 +950,8 @@ gtk_style_context_get_padding (GtkStyleContext *context,
* @margin: (out): return value for the margin settings
*
* Gets the margin for a given state as a `GtkBorder`.
+ *
+ * Deprecated: 4.10: This api will be removed in GTK 5
*/
void
gtk_style_context_get_margin (GtkStyleContext *context,
@@ -981,6 +1018,8 @@ _gtk_style_context_get_cursor_color (GtkStyleContext *context,
* the format of the returned string, it may change.
*
* Returns: a newly allocated string representing @context
+ *
+ * Deprecated: 4.10: This api will be removed in GTK 5
*/
char *
gtk_style_context_to_string (GtkStyleContext *context,
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 21462ef501..9d39cb3f5f 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -69,64 +69,64 @@ GDK_AVAILABLE_IN_ALL
void gtk_style_context_remove_provider_for_display (GdkDisplay *display,
GtkStyleProvider *provider);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_add_provider (GtkStyleContext *context,
GtkStyleProvider *provider,
guint priority);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_remove_provider (GtkStyleContext *context,
GtkStyleProvider *provider);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_save (GtkStyleContext *context);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_restore (GtkStyleContext *context);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_set_state (GtkStyleContext *context,
GtkStateFlags flags);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
GtkStateFlags gtk_style_context_get_state (GtkStyleContext *context);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_set_scale (GtkStyleContext *context,
int scale);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
int gtk_style_context_get_scale (GtkStyleContext *context);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_add_class (GtkStyleContext *context,
const char *class_name);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_remove_class (GtkStyleContext *context,
const char *class_name);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
gboolean gtk_style_context_has_class (GtkStyleContext *context,
const char *class_name);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_set_display (GtkStyleContext *context,
GdkDisplay *display);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
GdkDisplay *gtk_style_context_get_display (GtkStyleContext *context);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
gboolean gtk_style_context_lookup_color (GtkStyleContext *context,
const char *color_name,
GdkRGBA *color);
/* Some helper functions to retrieve most common properties */
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_get_color (GtkStyleContext *context,
GdkRGBA *color);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_get_border (GtkStyleContext *context,
GtkBorder *border);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_get_padding (GtkStyleContext *context,
GtkBorder *padding);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
void gtk_style_context_get_margin (GtkStyleContext *context,
GtkBorder *margin);
@@ -137,7 +137,7 @@ typedef enum {
GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE = 1 << 2
} GtkStyleContextPrintFlags;
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_10
char * gtk_style_context_to_string (GtkStyleContext *context,
GtkStyleContextPrintFlags flags);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 8ef948c304..2333b2fb75 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2442,8 +2442,10 @@ gtk_widget_root (GtkWidget *widget)
priv->root = priv->parent->priv->root;
}
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (priv->context)
gtk_style_context_set_display (priv->context, gtk_root_get_display (priv->root));
+G_GNUC_END_IGNORE_DEPRECATIONS
if (priv->surface_transform_data)
add_parent_surface_transform_changed_listener (widget);
@@ -2479,8 +2481,10 @@ gtk_widget_unroot (GtkWidget *widget)
GTK_WIDGET_GET_CLASS (widget)->unroot (widget);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (priv->context)
gtk_style_context_set_display (priv->context, gdk_display_get_default ());
+G_GNUC_END_IGNORE_DEPRECATIONS
if (priv->layout_manager)
gtk_layout_manager_set_root (priv->layout_manager, NULL);
@@ -3410,10 +3414,12 @@ gtk_widget_realize (GtkWidget *widget)
g_signal_emit (widget, widget_signals[REALIZE], 0);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (priv->context)
gtk_style_context_set_scale (priv->context, gtk_widget_get_scale_factor (widget));
else
gtk_widget_get_style_context (widget);
+G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_pop_verify_invariants (widget);
}
@@ -6737,8 +6743,10 @@ _gtk_widget_scale_changed (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (widget));
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (priv->context)
gtk_style_context_set_scale (priv->context, gtk_widget_get_scale_factor (widget));
+G_GNUC_END_IGNORE_DEPRECATIONS
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_SCALE_FACTOR]);
@@ -10726,11 +10734,13 @@ gtk_widget_get_style_context (GtkWidget *widget)
priv->context = gtk_style_context_new_for_node (priv->cssnode);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_set_scale (priv->context, gtk_widget_get_scale_factor (widget));
display = _gtk_widget_get_display (widget);
if (display)
gtk_style_context_set_display (priv->context, display);
+G_GNUC_END_IGNORE_DEPRECATIONS
}
return priv->context;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]