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 658077 - Add theming support to GtkPathBar
Add theming support to GtkPathBar
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
3.1.x
Other All
: Normal enhancement
: ---
Assigned To: Federico Mena Quintero
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2011-09-02 17:02 UTC by Federico Mena Quintero
Modified: 2011-09-05 17:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Mockup of pathbar with jointed buttons (20.71 KB, image/png)
2011-09-02 17:02 UTC, Federico Mena Quintero
  Details
pathbar-get-path-for-child.diff (4.79 KB, patch)
2011-09-02 22:00 UTC, Federico Mena Quintero
none Details | Review
updated patch (4.83 KB, patch)
2011-09-03 02:41 UTC, Cosimo Cecchi
accepted-commit_now Details | Review
screenshot of the patch (116.96 KB, image/png)
2011-09-03 02:43 UTC, Cosimo Cecchi
  Details
GtkPathBar: Implement get_path_for_child (5.38 KB, patch)
2011-09-05 16:14 UTC, Matthias Clasen
committed Details | Review

Description Federico Mena Quintero 2011-09-02 17:02:59 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.
Comment 1 Federico Mena Quintero 2011-09-02 17:04:48 UTC
For reference, GtkBox and GtkToolbar implement ::get_path_for_child().
Comment 2 Federico Mena Quintero 2011-09-02 18:05:18 UTC
Note to self - look at gtk_box_invalidate_order(); we need to reset_style() when the children change ordering / visibility.
Comment 3 Federico Mena Quintero 2011-09-02 22:00:53 UTC
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.
Comment 4 Federico Mena Quintero 2011-09-02 22:01:20 UTC
I can't build GTK+ master at the moment - can anybody please try this patch?
Comment 5 Cosimo Cecchi 2011-09-03 02:41:33 UTC
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.
Comment 6 Cosimo Cecchi 2011-09-03 02:43:20 UTC
Created attachment 195553 [details]
screenshot of the patch

Here's the patch in action running with a patched Adwaita theme applying the linked style.
Comment 7 Lapo Calamandrei 2011-09-03 12:55:24 UTC
It needs some style fixes, but nice!
Comment 8 Matthias Clasen 2011-09-04 04:45:52 UTC
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.
Comment 9 Matthias Clasen 2011-09-05 16:14:33 UTC
The following fix has been pushed:
4ea01b2 GtkPathBar: Implement get_path_for_child
Comment 10 Matthias Clasen 2011-09-05 16:14:36 UTC
Created attachment 195714 [details] [review]
GtkPathBar: Implement get_path_for_child

This will allow nice theming of the path bar.
Comment 11 Federico Mena Quintero 2011-09-05 17:41:42 UTC
Looks super-pretty!  Thanks for fixing up the child_visible stuff, Cosimo.