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 163850 - Gtk+ dialogs should use HIG spacing by default.
Gtk+ dialogs should use HIG spacing by default.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 165083 328018 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-01-12 19:52 UTC by Dennis Cranston
Modified: 2011-02-04 16:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (5.12 KB, patch)
2005-08-22 17:27 UTC, Dennis Cranston
none Details | Review
Proposed patch (4.75 KB, patch)
2005-08-25 04:01 UTC, Dennis Cranston
none Details | Review
Proposed patch (Font Selection Dialog) (3.31 KB, patch)
2005-08-25 05:47 UTC, Dennis Cranston
none Details | Review
Screenshot of the Font Selection dialog. (27.03 KB, image/png)
2005-08-25 05:48 UTC, Dennis Cranston
  Details
Proposed patch (Input Dialog) (9.44 KB, patch)
2005-08-25 07:19 UTC, Dennis Cranston
none Details | Review
Screenshot of the Input dialog (Axes tab). (14.98 KB, image/png)
2005-08-25 07:20 UTC, Dennis Cranston
  Details
Screenshot of the Input dialog (Keys tab). (13.08 KB, image/png)
2005-08-25 07:21 UTC, Dennis Cranston
  Details
Proposed patch (Color Selection Dialog) (7.34 KB, patch)
2005-08-25 21:53 UTC, Dennis Cranston
none Details | Review
Screenshot of the Color Selection dialog. (34.99 KB, image/png)
2005-08-25 21:54 UTC, Dennis Cranston
  Details
Updated proposed patch (Font Selection Dialog) (3.44 KB, patch)
2005-08-25 21:59 UTC, Dennis Cranston
none Details | Review
all-in-one patch (28.72 KB, patch)
2006-02-02 16:47 UTC, Christian Persch
none Details | Review
Updated all-in-one proposed patch (26.03 KB, patch)
2006-03-10 07:29 UTC, Dennis Cranston
none Details | Review
additional patch to change default button spacing (862 bytes, patch)
2006-03-10 21:49 UTC, Christian Persch
none Details | Review
Patch to fix a mnemonic conflict. (1.42 KB, patch)
2006-03-10 22:12 UTC, Dennis Cranston
none Details | Review
Patch to fix a mnemonic conflict and missing colon. (1.85 KB, patch)
2006-03-11 03:59 UTC, Dennis Cranston
none Details | Review

Description Dennis Cranston 2005-01-12 19:52:42 UTC
Currently, the gtk dialogs use non standard widget padding.  

This has always been confusing for developers, because the HIG asks for 12
pixels around the border and 12 pixels between the vbox and action area of the
dialog.  To achieve HIG compliant spacing, programmers must add code to their
application similar to the following:

gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);

I would prefer to see the dialog spacing HIG compliant by default so no
additional code is neccessary.  Or, at least the dialog should actually be HIG
compliant when adding the lines:

gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 12);

I am opening this bug in hopes that it can be fixed in Gtk+ version 3. ;-)
Comment 1 Dennis Cranston 2005-01-12 19:54:13 UTC
See bug 163317 for an example of the confusion this problem can cause.
Comment 2 Luca Ferretti 2005-01-13 10:50:10 UTC
The most simple way to create an HIG compliant dialog should be use this code in
GtkDialog init function:

	dialog->vbox = gtk_vbox_new (FALSE, 24);

	gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), 12);
	gtk_container_add (GTK_CONTAINER (dialog), dialog->vbox);

	gtk_widget_show (dialog->vbox);

	dialog->action_area = gtk_hbutton_box_new ();

	gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
	gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->action_area,
	                  FALSE, TRUE, 0);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->action_area),
                                   GTK_BUTTONBOX_END);

	gtk_widget_show (dialog->action_area);


Advantages:
- the dialog spacing/border sizes will be HIG compliant

- developers/UI designers can ignore spacing/padding of the dialog and take care
only of the stuff they put inside the dialog. So when you add a container in the
dialog it's well aligned (e.g. a GtkNotebook).

- all dialogs will have the same spacing/border size


Notes:

- this will break API compatibility with 2.x series (no more separator
properties/functions and no more content_area_border, button_spacing, and
action_area_border styles)

- dialog->vbox spacing and border width could be editable as style properties.
This could be useful for LargePrint a11y themes. But ask a11y people before do it.

- the gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6); call inside
GtkDialog init function is bad idea too. The default spacing of a GtkButtonBox
should be 6 pixel, maybe editable as style, so you don't have to change.

- Do we have to put the separator for Windows(TM)?

Enhancements:

- Could we use a different minimum padding for Help button?

	[  Help  ]  <-24px->  [  Apply ] [ Cancel ] [   OK   ]
                                        ^          ^
                                        ^----------^---6 px

- Could we add a default shortcut (F1) to activate Help button response?
Comment 4 Dennis Cranston 2005-08-22 17:27:20 UTC
Created attachment 51135 [details] [review]
Proposed patch

This patch makes the GtkDialog and GtkMessageDialog GNOME HIG compliant by
default.  Applications will no longer need to adjust the border width of the
dialog, dialog->vbox, and dialog->action_area themselves.  

Also, it removes the dialog title from the GtkMessageDialogs per the HIG.  And,
it fixes the spacing between buttons in the dialog->action_area to be HIG
compliant.
Comment 5 Dennis Cranston 2005-08-22 18:09:51 UTC
If the above patch (or something similar) is committed to CVS, then the
following code should be removed from GNOME applications.

  gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
  gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5);
  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
  gtk_window_set_title (GTK_WINDOW (dialog), "");

I can help remove this code from GNOME, since I am responsible for most of it
anyhow.

Comment 6 Matthias Clasen 2005-08-24 20:21:12 UTC
*** Bug 165083 has been marked as a duplicate of this bug. ***
Comment 7 Matthias Clasen 2005-08-24 20:23:35 UTC
The title issue is covered by bug 310443, which also has a patch
Comment 8 Dennis Cranston 2005-08-25 04:01:22 UTC
Created attachment 51308 [details] [review]
Proposed patch

Same as my previous patch except I removed the title issue fix since it is
covered by a patch in bug 310443.
Comment 9 Dennis Cranston 2005-08-25 05:47:32 UTC
Created attachment 51310 [details] [review]
Proposed patch (Font Selection Dialog)

This patch makes the Font Selection dialog HIG compliant.  It assumes the
previous patch for GtkDialog and GtkMessageDialog was applied.
Comment 10 Dennis Cranston 2005-08-25 05:48:24 UTC
Created attachment 51311 [details]
Screenshot of the Font Selection dialog.
Comment 11 Dennis Cranston 2005-08-25 07:19:34 UTC
Created attachment 51317 [details] [review]
Proposed patch (Input Dialog)
Comment 12 Dennis Cranston 2005-08-25 07:20:42 UTC
Created attachment 51318 [details]
Screenshot of the Input dialog (Axes tab).
Comment 13 Dennis Cranston 2005-08-25 07:21:23 UTC
Created attachment 51319 [details]
Screenshot of the Input dialog (Keys tab).
Comment 14 Dennis Cranston 2005-08-25 21:53:31 UTC
Created attachment 51346 [details] [review]
Proposed patch (Color Selection Dialog)
Comment 15 Dennis Cranston 2005-08-25 21:54:17 UTC
Created attachment 51347 [details]
Screenshot of the Color Selection dialog.
Comment 16 Dennis Cranston 2005-08-25 21:59:33 UTC
Created attachment 51348 [details] [review]
Updated proposed patch (Font Selection Dialog)

The previously proposed patch for the Font Selection dialog was missing one
line.
Comment 17 Christian Persch 2006-02-02 16:03:04 UTC
*** Bug 328018 has been marked as a duplicate of this bug. ***
Comment 18 Christian Persch 2006-02-02 16:47:01 UTC
Created attachment 58589 [details] [review]
all-in-one patch

This patch contains all above patches (to gtkmessagedialog.c, gtkcolorsel.c gtkcolorseldialog.c gtkinputdialog.c gtkfontsel.c) in one, with the exception of the changes to gtkdialog.c.
I think changing the default spacings of gtkdialog will break too much existing dialogues that rely on the default values, and make them of broken appearance. This patch instead sets the spacings/borders for each dialogue. IMHO this patch is therefore appropriate for a 2.x release.
Comment 19 Matthias Clasen 2006-02-03 04:51:30 UTC
The patch has string changes (why ?), so it will certainly not go into 2.8.x
Comment 20 Christian Persch 2006-02-03 12:20:41 UTC
Sorry, I meant that it's appropriate to add to an unstable gtk 2.odd.x release, as opposed to the 'gtk 3' that comment 0 speaks of :)

The string changes seem to be mostly accelerator _ added/removed, not sure why it was done (I can't see the input dialogue since I have no inputs)...
Comment 21 Dennis Cranston 2006-02-03 17:14:08 UTC
Thanks for combining these patches into one.  

The string changes were also part of the HIG fixes. 
  * remove trailing space from label as per HIG
  * add or remove mnemonics as per HIG
  * add missing colon to labels as per HIG
  * fix capitalization as per HIG
Comment 22 Dennis Cranston 2006-03-08 02:44:35 UTC
Any chance of this stuff getting fixed for GTK+ 2.10 / Project Ridley?
Comment 23 Matthias Clasen 2006-03-10 05:03:46 UTC
I think I'm fine with most of the changes, but I don't think we should 
just ignore the message-border style property. If I understood the
code correctly, we should probably do something like

  if (parent)
    {
      gtk_widget_style_get (widget, "message-border",
                            &border_width, NULL);
      
      gtk_container_set_border_width (GTK_CONTAINER (parent),
                                      MAX (0, border_width - 7));
    }

to account for the fact that the hbox only receives 5 of the default 12
in the default setup.
Comment 24 Dennis Cranston 2006-03-10 07:29:37 UTC
Created attachment 61020 [details] [review]
Updated all-in-one proposed patch

Matthais, Thanks for your feedback.  I updated the all-in-one patch with the changes you recommended in comment #23.
Comment 25 Matthias Clasen 2006-03-10 21:39:25 UTC
2006-03-10  Matthias Clasen  <mclasen@redhat.com>

	Apply a patch from Dennis Cranston to make dialogs more
	consistent  (#163850)
	
	* gtk/gtkcolorsel.c (make_label_spinbutton): Left-align labels.
	
	* gtk/gtkfontsel.c (gtk_font_selection_init): 
	* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): 
	* gtk/gtkcolorsel.c (gtk_color_selection_init): 
	* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init): 
	* gtk/gtkinputdialog.c (gtk_input_dialog_init): Update the layout
	of the dialog to follow HIG recommendations. Also update labels.

	* gtk/gtkmessagedialog.c (gtk_message_dialog_init): HIG-compatible 
	spacing.
	(gtk_message_dialog_font_size_change): Merged into 
	 gtk_message_dialog_style_set.
Comment 26 Christian Persch 2006-03-10 21:49:01 UTC
Created attachment 61058 [details] [review]
additional patch to change default button spacing

The other GtkDialog spacings can't be changed compatibly, but IMHO changing the default button spacing to HIG-default of 6px should be compatible enough; what do you think?
Comment 27 Dennis Cranston 2006-03-10 22:12:30 UTC
Created attachment 61059 [details] [review]
Patch to fix a mnemonic conflict.

The patch applied to CVS uses the 'O' for the "Opacity" label mnemonic which will conflict with the 'O' mnemonic for the "OK" button.  This patch fixes the mnemonic conflict.
Comment 28 Dennis Cranston 2006-03-11 03:59:51 UTC
Created attachment 61069 [details] [review]
Patch to fix a mnemonic conflict and missing colon.

Two label fixes from the all-in-one patch were not applied to CVS.  

2006-03-10  Dennis Cranston  <dennis_cranston@yahoo.com>

	* gtk/gtkcolorsel.c: (gtk_color_selection_init): Fix a mnemonic
	conflict.  Add a missing colon to the pallete label.
Comment 29 Christian Persch 2006-05-01 14:48:39 UTC
Comment on attachment 61058 [details] [review]
additional patch to change default button spacing

Can this patch be committed too? It's just changing the default dialog buttonbox spacing from 10 to 6 (HIG) and should be sufficiently compatible...