GNOME Bugzilla – Bug 658077
Add theming support to GtkPathBar
Last modified: 2011-09-05 17:41:42 UTC
Created attachment 195507 [details] Mockup of pathbar with jointed buttons We had a discussion on IRC about adding support to GtkPathBar for making it look pretty. See the attached mockup. First, we need to make it possible for the theme to know that the buttons in the pathbar form a left-to-right region. There are two alternatives: 1. Make the pathbar add junction sides by hand to each sub-button. This would "just work" to make the buttons appear visually linked, but the theme would still not know that they are part of a semantic group. 2. Make the pathbar support GtkContainer::get_path_for_child() so that themes can style the buttons as they please, while knowing that they are part of a semantic group. Themes can use "first", "last", and other CSS magic then. While (2) involves a bit more work, it's also better in the long term, as we can remove visual considerations from the code and move them to the theme instead. This also involves adding support to the theme for styling pathbar buttons appropriately.
For reference, GtkBox and GtkToolbar implement ::get_path_for_child().
Note to self - look at gtk_box_invalidate_order(); we need to reset_style() when the children change ordering / visibility.
Created attachment 195539 [details] [review] pathbar-get-path-for-child.diff Tentative patch; this implements ::get_path_for_child() and invalidates the children's styles when appropriate.
I can't build GTK+ master at the moment - can anybody please try this patch?
Created attachment 195551 [details] [review] updated patch The patch needed a bit of work to function properly, as GtkPathBar uses gtk_widget_set_child_visible() to tweak children's visibility. Here's an updated patch for git master tested to work.
Created attachment 195553 [details] screenshot of the patch Here's the patch in action running with a patched Adwaita theme applying the linked style.
It needs some style fixes, but nice!
Review of attachment 195551 [details] [review]: Looks good to me. ::: gtk/gtkpathbar.c @@ +858,3 @@ } +/* Implementation of GtkContainer::get_path_for_child() */ This comment doesn't add anything.
The following fix has been pushed: 4ea01b2 GtkPathBar: Implement get_path_for_child
Created attachment 195714 [details] [review] GtkPathBar: Implement get_path_for_child This will allow nice theming of the path bar.
Looks super-pretty! Thanks for fixing up the child_visible stuff, Cosimo.