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 675042 - plugins/gtk+.xml.in: always store GtkButton [x|y]align properties
plugins/gtk+.xml.in: always store GtkButton [x|y]align properties
Status: RESOLVED FIXED
Product: glade
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Glade 3 Maintainers
Glade 3 Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-28 20:48 UTC by Carl-Anton Ingmarsson
Modified: 2012-05-04 19:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
plugins/gtk+.xml.in: always store GtkButton [x|y]align properties (1.04 KB, patch)
2012-04-28 20:48 UTC, Carl-Anton Ingmarsson
none Details | Review
Testfile showing the problem (719 bytes, application/xml)
2012-05-01 21:37 UTC, Carl-Anton Ingmarsson
  Details

Description Carl-Anton Ingmarsson 2012-04-28 20:48:09 UTC
gtk+ only set the alignment on the GtkButton child if the alignment has been
explicitly set, so we always save the values of the [x|y]align properties.
Comment 1 Carl-Anton Ingmarsson 2012-04-28 20:48:11 UTC
Created attachment 213033 [details] [review]
plugins/gtk+.xml.in: always store GtkButton [x|y]align properties
Comment 2 Juan Pablo Ugarte 2012-04-29 22:24:59 UTC
Yes, we only save properties if they are not on its default value.
The save-always feature is only for properties that declares a default value in the parameter spec but have a different one in runtime.
So why do you want to set GtkButton:[x|y]align properties to save always?¿
Comment 3 Carl-Anton Ingmarsson 2012-04-30 07:24:25 UTC
If you look at gtkbutton.c you can see that the alignment is only set on the child when (priv->align_set != 0), e.g. http://git.gnome.org/browse/gtk+/tree/gtk/gtkbutton.c#n1224.

priv->align_set gets set to  1 in gtk_button_set_alignment which is called by the xalign/yalign property setters.

The problem I'm having is with togglebuttons with draw_indicator=FALSE. Even though I set xalign to the default 0.5 the label get left aligned.
Comment 4 Juan Pablo Ugarte 2012-04-30 17:32:36 UTC
You should have started with that!, can you attach a glade file showing the bug?
I created a tooglebutton which by default has draw_indicator=FALSE and the label is centered.
Comment 5 Carl-Anton Ingmarsson 2012-05-01 21:37:52 UTC
Created attachment 213240 [details]
Testfile showing the problem

The above glade file contains a GtkCheckButton which label is correctly horizontally centered when viewed in glade. But when you "preview" it the label is left-aligned. (You have to expand the window a bit horizontally to see it).
Comment 6 Juan Pablo Ugarte 2012-05-02 20:51:18 UTC
Ohh I see what you mean, now, why did not you mention checkbuttons before?
The problem is that checkbutton set the halign value to 0, but if set it back to .5 (GtkButton default) it wont get saved!

hmm we really need a way to override default values, in the mean time I set save-always but only in the checkbutton class
Comment 7 Carl-Anton Ingmarsson 2012-05-02 21:35:35 UTC
I also get the same problem using GtkRadioButton.
Comment 8 Juan Pablo Ugarte 2012-05-02 23:05:37 UTC
Right, its fixed in master. If you are not using glade master, I suggest you to set save always to xalign for radio and check buttons
Comment 9 Tristan Van Berkom 2012-05-04 19:25:19 UTC
Note, if I recall correctly, the 'radio' class derives from the 'check' class
(hence the problem in both), so there should be no need to specify anything
explicitly for the radio class (as the save-always attribute will be derived).