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 704274 - Add API to show a close button on GtkInfoBar
Add API to show a close button on GtkInfoBar
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 704296
 
 
Reported: 2013-07-15 17:11 UTC by William Jon McCann
Modified: 2013-07-24 21:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add an optional close button to the info bar (7.49 KB, patch)
2013-07-15 21:26 UTC, William Jon McCann
none Details | Review
demo: add a close button to the info bar demo (1.04 KB, patch)
2013-07-15 21:26 UTC, William Jon McCann
none Details | Review
Change to use the CLOSE response. (7.66 KB, patch)
2013-07-16 16:14 UTC, William Jon McCann
reviewed Details | Review
Add an optional close button to the info bar (7.55 KB, patch)
2013-07-22 19:52 UTC, William Jon McCann
none Details | Review
demo: add a close button to the info bar demo (1.04 KB, patch)
2013-07-22 19:52 UTC, William Jon McCann
none Details | Review
Add an optional close button to the info bar (7.75 KB, patch)
2013-07-23 20:56 UTC, William Jon McCann
committed Details | Review
demo: add a close button to the info bar demo (1.04 KB, patch)
2013-07-23 20:56 UTC, William Jon McCann
committed Details | Review

Description William Jon McCann 2013-07-15 17:11:11 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
Comment 1 William Jon McCann 2013-07-15 21:26:08 UTC
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.
Comment 2 William Jon McCann 2013-07-15 21:26:11 UTC
Created attachment 249246 [details] [review]
demo: add a close button to the info bar demo
Comment 3 Ignacio Casal Quinteiro (nacho) 2013-07-16 06:23:24 UTC
Checked the code, and should we use GTK_RESPONSE_CLOSE instead of CANCEL?
Comment 4 William Jon McCann 2013-07-16 15:54:35 UTC
I wondered that too. I used cancel because the "close" keybinding seems to send cancel currently.
Comment 5 William Jon McCann 2013-07-16 16:14:55 UTC
Created attachment 249279 [details] [review]
Change to use the CLOSE response.
Comment 6 William Jon McCann 2013-07-22 19:52:12 UTC
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.
Comment 7 William Jon McCann 2013-07-22 19:52:15 UTC
Created attachment 249837 [details] [review]
demo: add a close button to the info bar demo
Comment 8 Ignacio Casal Quinteiro (nacho) 2013-07-22 19:58:58 UTC
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?
Comment 9 William Jon McCann 2013-07-23 20:56:01 UTC
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.
Comment 10 William Jon McCann 2013-07-23 20:56:03 UTC
Created attachment 249943 [details] [review]
demo: add a close button to the info bar demo
Comment 11 Ignacio Casal Quinteiro (nacho) 2013-07-23 21:26:25 UTC
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 :)
Comment 12 Matthias Clasen 2013-07-24 20:50:16 UTC
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
Comment 13 Matthias Clasen 2013-07-24 20:58:28 UTC
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
Comment 14 Matthias Clasen 2013-07-24 20:58:54 UTC
Review of attachment 249943 [details] [review]:

sure
Comment 15 William Jon McCann 2013-07-24 21:03:58 UTC
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