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 681660 - GtkGrid doesn't support nth-child
GtkGrid doesn't support nth-child
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: Other
3.5.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 769876 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-08-11 20:06 UTC by Sébastien Wilmet
Modified: 2018-04-22 19:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Inline toolbar in a vertical GtkBox: OK (4.68 KB, image/png)
2012-08-11 20:17 UTC, Sébastien Wilmet
Details
Inline toolbar in a vertical GtkGrid: less beautiful (4.56 KB, image/png)
2012-08-11 20:18 UTC, Sébastien Wilmet
Details

Description Sébastien Wilmet 2012-08-11 20:06:48 UTC
If an inline toolbar (GTK_STYLE_CLASS_INLINE_TOOLBAR) is added in a vertical GtkGrid, the style is not perfect: the line separating the above widget from the toolbar is thicker, and the corners at the bottom are not rounded.

With a vertical GtkBox, no problem.

I'll attach two screenshots.
Comment 1 Sébastien Wilmet 2012-08-11 20:17:39 UTC
Created attachment 220930 [details]
Inline toolbar in a vertical GtkBox: OK
Comment 2 Sébastien Wilmet 2012-08-11 20:18:45 UTC
Created attachment 220931 [details]
Inline toolbar in a vertical GtkGrid: less beautiful
Comment 3 Cosimo Cecchi 2012-08-12 13:32:41 UTC
This is not really a theme bug; the problem is that GtkGrid doesn't support the advanced CSS siblings features we use to get that effect, such as nth-child.

The fix would involve implementing GtkContainer:get_path_for_child() in GtkGrid, but it's unclear what's the best behavior to have here, since the grid can pack children in both directions.
As a very simple implementation, I think it could work following the value of the GtkGrid's orientation, and treat the children in that direction as a linear list.
Comment 4 Sébastien Wilmet 2013-09-08 12:34:23 UTC
Close as WONTFIX for now, because GtkBox will not be deprecated (see bug #706269).
Comment 5 Daniel Boles 2018-04-22 19:31:41 UTC
*** Bug 769876 has been marked as a duplicate of this bug. ***
Comment 6 Daniel Boles 2018-04-22 19:39:29 UTC
(In reply to Cosimo Cecchi from comment #3)
> As a very simple implementation, I think it could work following the value
> of the GtkGrid's orientation, and treat the children in that direction as a
> linear list.

This appears already to work. A gotcha arises because GtkBox actually reorders its child nodes in RTL, so that :first-child is always leftmost and so on, whereas other widgets don't. Benjamin argues that's wrong and should be dropped in GTK+ 4.

See the result/differences here: https://bug769876.bugzilla-attachments.gnome.org/attachment.cgi?id=347098