GNOME Bugzilla – Bug 782396
Inconsistent deprecation documentation for gtk_paint_spinner
Last modified: 2017-10-10 09:55:05 UTC
There are conflicting suggestions about replacing gtk_paint_spinner. This suggests using gtk_render_icon instead: GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext and gtk_render_icon) void gtk_paint_spinner (GtkStyle *style, cairo_t *cr, GtkStateType state_type, GtkWidget *widget, const gchar *detail, guint step, gint x, gint y, gint width, gint height); While this suggests using gtk_render_activity: /** * gtk_paint_spinner: * @style: a #GtkStyle * @cr: a #cairo_t * @state_type: a state * @widget: (allow-none): the widget (may be %NULL) * @detail: (allow-none): a style detail (may be %NULL) * @step: the nth step * @x: the x origin of the rectangle in which to draw the spinner * @y: the y origin of the rectangle in which to draw the spinner * @width: the width of the rectangle in which to draw the spinner * @height: the height of the rectangle in which to draw the spinner * * Draws a spinner on @window using the given parameters. * * Deprecated:3.0: Use gtk_render_activity() instead */
The comment in the header file is newer, but it may have just been an oversight. The comment in the source file seems a more direct replacement
Except gtk_paint_spinner cannot be replaced with gtk_render_activity. I tried to do that for GdTogglePixbufRenderer (bug 782023), and I think that's why GtkCellRendererSpinner also continues to use gtk_paint_spinner. Or maybe I am missing something? (I dream of the day when we'll have scalable List/FlowBoxes and cell renderers would be a thing of the past. :)
Ah, OK. The problem was it didn't spin, right? That's probably lack of support for states or animation on CellRenderers. Various less-popular widgets kind of support CSS, but fall over when asked to do certain things. I noticed CellRenderers seem to cache an old currentColor rather than it being current, for example. Also, I've noticed problems with animation (e.g. bg colour on an entry selection) though I didn't try it on a CellRenderer. I guess these are because the widgets simply can't do what's asked, but I may be wrong. I presume gtk_render_icon() was equally ineffective in your case?
For all intents and purposes, nobody should ever use gtk_paint_spinner() in newly written code. Sadly, cell renderers are not "newly written code", so you'll have to live with the deprecated API. For GTK+ 4.0 we'll have to figure out a way to use render nodes with cell renderers, so the advice to stop using gtk_paint_spinner() will also apply to them. In any case, the documentation stanza should be updated to reflect the annotation in the header.
Created attachment 359328 [details] [review] docs: Update the deprecation annotation for gtk_paint_spinner() Bring it in line with the deprecation warning in the header.
Created attachment 359329 [details] [review] docs: Make the gtk_paint_spinner deprecation notice consistent Only for gtk-3-22, because gtk_paint_spinner is no longer public API in gtk-4.x.
Comment on attachment 359329 [details] [review] docs: Make the gtk_paint_spinner deprecation notice consistent Oops! Sorry. :)
(In reply to Daniel Boles from comment #3) > Ah, OK. The problem was it didn't spin, right? That's probably lack of > support for states or animation on CellRenderers. Yes, it didn't spin. > I presume gtk_render_icon() was equally ineffective in your case? Umm... probably. It was a while ago and I don't remember.
(In reply to Daniel Boles from comment #3) > Various less-popular widgets kind of support CSS, but fall over when asked > to do certain things. I noticed CellRenderers seem to cache an old > currentColor rather than it being current, for example. Also, I've noticed > problems with animation (e.g. bg colour on an entry selection) though I > didn't try it on a CellRenderer. > > I guess these are because the widgets simply can't do what's asked, but I > may be wrong. (In reply to Emmanuele Bassi (:ebassi) from comment #4) > For all intents and purposes, nobody should ever use gtk_paint_spinner() in > newly written code. Sadly, cell renderers are not "newly written code", so > you'll have to live with the deprecated API. > > For GTK+ 4.0 we'll have to figure out a way to use render nodes with cell > renderers, so the advice to stop using gtk_paint_spinner() will also apply > to them. I see, ok. Thanks for the explanation.
Attachment 359328 [details] pushed as e06bce7 - docs: Update the deprecation annotation for gtk_paint_spinner()