GNOME Bugzilla – Bug 704274
Add API to show a close button on GtkInfoBar
Last modified: 2013-07-24 21:04:05 UTC
It might be nice to have a consistent and easy way to add a close button to GtkInfoBar. Currently, most applications add a "_Cancel" or "_Close" button. This is isn't great because it takes up a lot of room which can interfere with the "info" message. Or they can be inconsistently used. We probably need to make this opt-in because not all info bars are dismissable. Style-wise the close button should look something like this: https://raw.github.com/gnome-design-team/gnome-mockups/master/documents/documents-notifications.png
Created attachment 249245 [details] [review] Add an optional close button to the info bar Similar to the one for the search bar. This can replace Cancel buttons.
Created attachment 249246 [details] [review] demo: add a close button to the info bar demo
Checked the code, and should we use GTK_RESPONSE_CLOSE instead of CANCEL?
I wondered that too. I used cancel because the "close" keybinding seems to send cancel currently.
Created attachment 249279 [details] [review] Change to use the CLOSE response.
Created attachment 249836 [details] [review] Add an optional close button to the info bar Similar to the one for the search bar. This can replace Cancel buttons.
Created attachment 249837 [details] [review] demo: add a close button to the info bar demo
Review of attachment 249279 [details] [review]: See inline comments ::: gtk/gtkinfobar.c @@ +1221,3 @@ +void +gtk_info_bar_set_show_close_button (GtkInfoBar *info_bar, + gboolean setting) validate the boolean? ::: gtk/gtkinfobar.ui @@ +47,3 @@ + <style> + <class name="raised"/> + <class name="close"/> is this style correct? maybe image-button?
Created attachment 249942 [details] [review] Add an optional close button to the info bar Similar to the one for the search bar. This can replace Cancel buttons.
Created attachment 249943 [details] [review] demo: add a close button to the info bar demo
If it was for gedit I'd ask for the validation of the parameter and to rename setting to show_close_button. Apart from that patches look good to me. If gtk maintainers do not care of those details go ahead :)
Review of attachment 249279 [details] [review]: ::: gtk/gtkinfobar.c @@ +1222,3 @@ +gtk_info_bar_set_show_close_button (GtkInfoBar *info_bar, + gboolean setting) +{ Looks fine to me since we're just passing it through. But you do need a g_object_notify (G_OBJECT (info_bar), "show-close-button"); here
Review of attachment 249942 [details] [review]: Looks ok to me. Might be nice to mention the close button api in the long description, when pointing out similarities (and differences) to GtkDialog
Review of attachment 249943 [details] [review]: sure
Attachment 249942 [details] pushed as 88771f7 - Add an optional close button to the info bar Attachment 249943 [details] pushed as fbf0b29 - demo: add a close button to the info bar demo