After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 733312 - Deprecate GtkTreeView:rules-hint
Deprecate GtkTreeView:rules-hint
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other All
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2014-07-17 12:08 UTC by Emmanuele Bassi (:ebassi)
Modified: 2015-12-15 12:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
treeview: Deprecated rules-hint (5.50 KB, patch)
2014-07-17 12:08 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Emmanuele Bassi (:ebassi) 2014-07-17 12:08:38 UTC
it's just not useful as an application-level API, if we defer it to a theme to honour what is a usability setting.

application developers cannot design their own UI in a reasonable, reliable way if we let a theme disregard this - and our own default theme disregards it.

plus, the main study on zebra striping has not shown conclusively that it helps, only that it does not hinder readability; and it did that on non-interactive tables.
Comment 1 Emmanuele Bassi (:ebassi) 2014-07-17 12:08:46 UTC
Created attachment 280964 [details] [review]
treeview: Deprecated rules-hint

The rules-hint property has always been a fairly bad application API, as
it set some wrong expectations for the developers; deferring to the
theme makes it impossible to design application reliably, and if this is
a usability setting we should either impose this setting on every theme,
or simply drop it.

Our own default theme does not honour the zebra striping, which makes
this function even more questionable.

In practice, usability studies on zebra striping have demonstrated that
alternating colors on a list it improves readability just as much as
clear ruling between rows, or by visually differentiating the selected
row. Zebra striping improves readability (or, at least, it does not
hinder it) on static displays, like a table on paper or a document; on a
dynamic display, like an application's UI, there are different
strategies that yield similar, if not better, results.
Comment 2 Emmanuele Bassi (:ebassi) 2014-07-17 12:36:05 UTC
the links to the 2008 semi-formal study:

  http://alistapart.com/article/zebrastripingdoesithelp
  http://alistapart.com/article/zebrastripingmoredataforthecase
Comment 3 Lapo Calamandrei 2014-07-17 12:57:36 UTC
I have a wip style for our default theme (not commited yet), anyway, yeah I'm all for deprecation it
Comment 4 Matthias Clasen 2014-07-18 19:20:33 UTC
fine with me, too
Comment 5 Matthias Clasen 2014-07-25 19:00:38 UTC
Review of attachment 280964 [details] [review]:

.
Comment 6 Matthias Clasen 2014-08-03 00:51:15 UTC
Attachment 280964 [details] pushed as 0ed766e - treeview: Deprecated rules-hint
Comment 7 Andrés G. Aragoneses (IRC: knocte) 2014-08-03 08:54:32 UTC
What does this exactly mean, then? That it will be entirely the decision of the theme now?
Comment 8 Emmanuele Bassi (:ebassi) 2014-08-03 12:03:24 UTC
(In reply to comment #7)
> What does this exactly mean, then? That it will be entirely the decision of the
> theme now?

it *already* is a decision left entirely to the theme. it has always been the case since this API was introduced in GTK+ 2, actually.

all that the :rules-hint property does is to tell the GtkTreeView to annotate each row CSS path with the 'even' or 'odd' regions. what happens afterwards is entirely and completely up to the theme.

what deprecation means is that this API will be removed from GTK+ 4, whenever that happens.
Comment 9 Andrés G. Aragoneses (IRC: knocte) 2014-08-04 10:44:38 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > What does this exactly mean, then? That it will be entirely the decision of the
> > theme now?
> 
> it *already* is a decision left entirely to the theme.

"entirely"? Well, not really, right?, because the theme would need to apply it only if gtk_tree_view_set_rules_hint is used (using the odd/even regions).

> what deprecation means is that this API will be removed from GTK+ 4, whenever
> that happens.

Right, and then my real question is: if that API is gone now, the only way to have zebra-stripping style is to have a theme that decides to *always* apply the this style, to all gtkTreeViews, right? So now the decision is entirely left to the theme ("entirely" as opposed to "in combination" with the application).

Or is it that odd/even regions are left as non-deprecated and if the widget doesn't want zebra stripping it should simply not mark these regions for the theme to use?

Thanks
Comment 10 Emmanuele Bassi (:ebassi) 2014-08-04 12:56:55 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > What does this exactly mean, then? That it will be entirely the decision of the
> > > theme now?
> > 
> > it *already* is a decision left entirely to the theme.
> 
> "entirely"? Well, not really, right?, because the theme would need to apply it
> only if gtk_tree_view_set_rules_hint is used (using the odd/even regions).

that's inconsequential. it is, and has always been, entirely up to the theme to honor this property, so nobody using :rules-hint can actually *rely* on it being present, and there's no way for application to discover whether or not the theme has support for even/odd rules in the CSS and adopt countermeasures.

it's like having a light switch in your house that may or may not turn on your light, assuming that somebody put a specific lamp in the room, and you cannot know that because the room is dark, and people may change the lamps in the room without you knowing.

> > what deprecation means is that this API will be removed from GTK+ 4, whenever
> > that happens.
> 
> Right, and then my real question is: if that API is gone now

but the API is not *gone* now: you can still use it, and hope for the best, just like it was before. once we release GTK+ 4 that API will not be there any more, but it may have been replaced by something else entirely, or we may have figured out something better.

in reality, the end goal is to kill off the regions usage inside GTK+ as well, but for that we'll need better CSS support for non-GTK bits, like cell renderers. once we can drop the region usage, we should be able to tag rows with normal CSS selectors, and the theme authors may decide to use even/odd rules regardless of application API.
Comment 11 Leo Ufimtsev 2015-02-10 15:28:56 UTC
btw, are there any plans to deprecate tree-lines are is that gonna stay around for a while?

In swt, we were using rules-hint. Since it is deprecated, I was thinking of changing it to tree-lines instead?
Comment 12 gnome 2015-12-14 23:14:29 UTC
So this is deprecated, but there is currently no replacement for the functionality?  Did I read that correctly?  I see a lot of philosophy but no clear explanation of what not using this function entails.  Other than that Adwaita ignored it anyway.
Comment 13 Emmanuele Bassi (:ebassi) 2015-12-14 23:24:14 UTC
You should both ask on gtk-devel-list@gnome.org — Bugzilla is not a forum.

(In reply to Leo Ufimtsev from comment #11)
> btw, are there any plans to deprecate tree-lines are is that gonna stay
> around for a while?

"Tree lines"?

(In reply to gnome from comment #12)
> So this is deprecated, but there is currently no replacement for the
> functionality?  Did I read that correctly?

Correct. The API is deprecated, and GtkTreeView does not emit regions for even/odd rows, as CSS regions are also a hack, and have been deprecated. New CSS attributes are being written that would make it possible to mark even/odd rows, but are currently not available.

> I see a lot of philosophy but no clear explanation of what not using this function entails.

The "philosophy" you see are usability studies which question the usefulness of the zebra striping.

The explanation is in the commit message. Calling the set_rules_hint() method yields no result with any theme; the documentation was clear that the property is, and always was, just a hint, and that both GTK and themes are free to honour or ignore it at their leisure. Application developers should not rely on it actually doing anything.
Comment 14 gnome 2015-12-15 12:03:11 UTC
Thank you, very clear.  Really the documentation does not make this at all obvious, and neither does the commit message to be honest.