GNOME Bugzilla – Bug 721665
Provide a better way to display contextual actions
Last modified: 2014-01-07 13:47:58 UTC
At the moment we don't have a great way to display contextual actions in a direct way. Of course, menus are still a nice way to display such things but they aren't directly accessible. We often use GtkToolbar with the inline style class. But toolbars are annoying for a number of reasons. They are a pain to pack with widgets due to the "items". They have odd overflow behaviors. They are used in so many different ways that they are hard to style without breaking someone else. So, recently we've been abusing GtkHeaderBar for this. We don't want to dilute the use of headbar because we'll fall into the same difficulty we have with theming toolbars. It is better to only use headers in the heading position. Here is a patch to add a simple bar with a centered child. It will be useful to implement action bars as seen in: https://raw.github.com/gnome-design-team/gnome-mockups/master/cheese/png/windowed-shooting.png and http://afaikblog.files.wordpress.com/2013/12/list2.png
Created attachment 265485 [details] [review] Add GtkActionBar A widget intended to offer contextual actions for a given view. It allows packing children into the start or end as well as offering a single centered child box.
Created attachment 265486 [details] [review] tests: use actionbar in headerbar test This is a great example of where headerbar should not be used.
Created attachment 265487 [details] [review] widget-factory: add actionbar
Created attachment 265505 [details] [review] a test
Here's a testcase I've written which reveals a flaw in the positioning of pack-end widgets. I've fixed it for GtkHeaderBar - GtkActionBar should get the same fix. No other comments, really. Looks like a fine, simple container to have. The documentation should probably have a reference to GtkHeaderBar, and the header bar docs one to GtkActionBar.
Created attachment 265507 [details] [review] Fix order of pack-end widgets
Created attachment 265508 [details] [review] Add an action bar test
Attachment 265485 [details] pushed as e72aca0 - Add GtkActionBar Attachment 265486 [details] pushed as 0a95515 - tests: use actionbar in headerbar test Attachment 265487 [details] pushed as 51d462e - widget-factory: add actionbar Attachment 265507 [details] pushed as b39f094 - Fix order of pack-end widgets Attachment 265508 [details] pushed as 07f9b3f - Add an action bar test