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 408244 - add GtkDialog::content-area-spacing
add GtkDialog::content-area-spacing
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2007-02-15 14:24 UTC by Tim Janik
Modified: 2008-09-24 08:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
maemo patch implementing GtkDialog::content-area-spacing (2.93 KB, patch)
2007-02-15 14:29 UTC, Tim Janik
needs-work Details | Review
Updated Patch (includes the requested fixes) (2.92 KB, patch)
2007-07-06 09:15 UTC, Sven Herzberg
accepted-commit_after_freeze Details | Review
Added spacing_set (5.54 KB, patch)
2008-06-05 17:40 UTC, Christian Dywan
none Details | Review
Made spacing_set private (4.67 KB, patch)
2008-06-09 11:44 UTC, Christian Dywan
none Details | Review
content-area-spacing, update to after GSEAL (4.68 KB, patch)
2008-06-23 12:39 UTC, Christian Dywan
none Details | Review
content-area-spacing, updated, better docs (4.83 KB, patch)
2008-08-08 09:39 UTC, Christian Dywan
committed Details | Review

Description Tim Janik 2007-02-15 14:24:34 UTC
the maemo platform introduces and uses a new style property GtkDialog::content-area-spacing similar in spirit to the existing sytle properties ::button-spacing and ::content-area-border, which alowes configuraiton of the main area box spacing. this change seems to make sense in upstream as well.
Comment 1 Tim Janik 2007-02-15 14:29:58 UTC
Created attachment 82607 [details] [review]
maemo patch implementing GtkDialog::content-area-spacing
Comment 2 Matthias Clasen 2007-07-03 16:22:26 UTC
Hmm, I am not 100% convinced that it makes the same amount of sense as the other spacing style properties, but I won't object. I do object to the "Since: memo 1.0"
in the docstring, though...
Comment 3 Tim Janik 2007-07-04 11:09:44 UTC
(In reply to comment #2)
> Hmm, I am not 100% convinced that it makes the same amount of sense as the
> other spacing style properties, but I won't object. I do object to the "Since:
> memo 1.0"
> in the docstring, though...

oops, that was not to stay in there of course ;)
as for the property itself, maemo themes make active use of it, the question is whether we want to support that for upstream themes as well. i tend to say yes, similar to the other spacing properties (but wasn't entirely sure which is why it got filed as a bug).
Comment 4 Sven Herzberg 2007-07-06 09:15:15 UTC
Created attachment 91290 [details] [review]
Updated Patch (includes the requested fixes)
Comment 5 Matthias Clasen 2007-07-06 13:31:00 UTC
Looks fine, except that the Since should probably say Since: 2.14, since we are already on the last stretch towards 2.12
Comment 6 Christian Persch 2007-07-06 13:46:59 UTC
Why doesn't this make the style property default to 2 instead of 0? That would make it HIG compliant by default.
Comment 7 Tim Janik 2007-07-06 13:49:51 UTC
(In reply to comment #6)
> Why doesn't this make the style property default to 2 instead of 0? That would
> make it HIG compliant by default.

because that'd be a possibly incompatible change and a different change/bug to discuss actually.
Comment 8 Christian Persch 2007-07-06 14:52:36 UTC
But this seems to me to already be a hugely incompatible change. There are tons of dialogues in GNOME that do "gtk_box_set_spacing (GTK_DIALOG (dialog)->vbox, SOMETHING)" either in their _init function (for derived classes) or after instantiating the dialogue; with this patch gtkdialog's style-set handler will re-set them all to 0, breaking their HIGginess.

(Actually always using "2" wouldn't cut it either, since it needs to be 14 for "alert" style dialogues.)
Comment 9 Xan Lopez 2007-08-16 06:50:10 UTC
(In reply to comment #8)
> But this seems to me to already be a hugely incompatible change. There are tons
> of dialogues in GNOME that do "gtk_box_set_spacing (GTK_DIALOG (dialog)->vbox,
> SOMETHING)" either in their _init function (for derived classes) or after
> instantiating the dialogue; with this patch gtkdialog's style-set handler will
> re-set them all to 0, breaking their HIGginess.

Maybe we could not set any value if the property hasn't been modified? Like setting it to -1 by default and ignoring that (that may be stupid, but something with the same effect). The only important thing here is being able to set this from the rc files, really.

> 
> (Actually always using "2" wouldn't cut it either, since it needs to be 14 for
> "alert" style dialogues.)
> 

Comment 10 Sven Herzberg 2008-02-11 14:33:52 UTC
What about adding a property GtkBox::spacing-set ? struct _GtkBox can still be expanded by a 1 bit guint for that property.
Comment 11 Christian Dywan 2008-06-05 17:40:27 UTC
Created attachment 112228 [details] [review]
Added spacing_set

This is an enhanced version of the previous patch, adding a GtkBox::spacing-set property. Also Since was bumped up one version. Now the new style property is only respected if the spacing was not set manually before.
Comment 12 Jan Arne Petersen 2008-06-05 18:08:46 UTC
(In reply to comment #11)
> Created an attachment (id=112228) [edit]
> Added spacing_set

 update_spacings (GtkDialog *dialog)
+  g_object_get (G_OBJECT (dialog),
+                "spacing-set", &spacing_set,
+                NULL);

I assume that should be dialog->vbox.

+  if (!spacing_set)
+    gtk_box_set_spacing (GTK_BOX (dialog->vbox), content_area_spacing);

Now spacing_set==TRUE and the spacing will not be updated on theme change.
Comment 13 Tim Janik 2008-06-06 09:48:55 UTC
(In reply to comment #11)
> Created an attachment (id=112228) [edit]
> Added spacing_set
> 
> This is an enhanced version of the previous patch, adding a GtkBox::spacing-set
> property. Also Since was bumped up one version. Now the new style property is
> only respected if the spacing was not set manually before.

I think it's better to maka GtkBox::spacing-set an internal flag. I.e. don't export a property here, but instead just add:
  void     _gtk_box_set_spacing_set (GtkBox*,gboolean);
  gboolean _gtk_box_get_spacing_set (GtkBox*);
Rationale is that the only reason we introduce this flag is for an internal workaround, so we don't need to add and maintain public API for this.
Comment 14 Christian Dywan 2008-06-09 11:44:02 UTC
Created attachment 112411 [details] [review]
Made spacing_set private

I changed GtkBox:spacing-set into a private variable with _gtk_box_{get,set}_spacing_set according to Tim's suggestion. This also solves the problem that spacing-set would be set by internal use.
Comment 15 Tim Janik 2008-06-19 11:11:12 UTC
(In reply to comment #14)
> Created an attachment (id=112411) [edit]
> Made spacing_set private

The patch looks mostly good now, except:

+gboolean _gtk_box_get_spacing_set (GtkBox *box)
+{

return values in function definitions need to go on their own line.

@@ -59,6 +59,9 @@ struct _GtkBox
   GList *children;
   gint16 spacing;
   guint homogeneous : 1;
+
+  /*< private >*/
+  guint spacing_set : 1;

You might just wait a week here, then scratch "/*< private >*/" and just use GSEAL (spacing_set) ;)
Comment 16 Christian Dywan 2008-06-23 12:39:40 UTC
Created attachment 113253 [details] [review]
content-area-spacing, update to after GSEAL

Updated the patch according to the comments after GSEAL was merged.
Comment 17 Diego Escalante Urrelo (not reading bugmail) 2008-07-29 06:01:44 UTC
Ping :)
Comment 18 Christian Dywan 2008-08-04 13:21:20 UTC
Any chance we still can have this in 2.14?
Comment 19 Tim Janik 2008-08-08 08:39:59 UTC
The last patch looks good and can go in. The property docs could be a bit more elaborate though, e.g. add something along:
  ...this is the default spacing used for dialog->box and will be used
  unless gtk_box_set_spacing() is called on dialog->box directly...
Comment 20 Christian Dywan 2008-08-08 09:39:47 UTC
Created attachment 116125 [details] [review]
content-area-spacing, updated, better docs

The same patch, with improved doc comment
Comment 21 Matthias Clasen 2008-08-14 14:24:56 UTC
Lets hold nonessential api additions until 2.15 at this point 
Comment 22 Matthias Clasen 2008-09-18 15:53:10 UTC
Please update the since tags to 2.16.