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 70961 - Extension to change alignment of stock image/labels in gtkbuttons
Extension to change alignment of stock image/labels in gtkbuttons
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
1.3.x
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2002-02-08 18:17 UTC by Jody Goldberg
Modified: 2011-02-04 16:12 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
stock alignment (7.05 KB, patch)
2003-07-04 21:53 UTC, Matthias Clasen
none Details | Review
button child alignment (10.85 KB, patch)
2003-07-18 19:48 UTC, Matthias Clasen
none Details | Review

Description Jody Goldberg 2002-02-08 18:17:53 UTC
The current code hard codes stock icons as being centered within the
button.  This is unpleasant when aligning button.  There are 2
simple solutions

1) Add stock_[xy]_alignment properties to gtkbutton.
2) Add a gtkbutton_get_stock_alignment

The former is obviously more controlled than the later.  Would
either patch be accepted ? are there any preferences for which
approach to take ?
Comment 2 Matthias Clasen 2003-07-04 21:52:03 UTC
Here is a patch which adds stock_xalign plus getter and setter.
Comment 3 Matthias Clasen 2003-07-04 21:53:13 UTC
Created attachment 18047 [details] [review]
stock alignment
Comment 4 Owen Taylor 2003-07-18 17:44:52 UTC
* Big-picture-question; it seems a bit weird to me and
  probably to users that this property applies to 
  stock items in particular, which don't seem on the
  face of it different than labels.

  It would be a bit hacky to implement, but maybe we
  should just have ::xalign ::yalign properties that
  magically hook up correctly if GTK_IS_MISC() or
  GTK_IS_ALIGNMENT() bin->child? 

  (Or maybe they only hook up when GTK+ creates the
  immediate child and not in other cases; that would
  be easier to implement)

* If the above isn't followed, then I think the text
  that appears in multiple places
  
   "horizontal alignment of the stock item" 

  needs improvement. What is the stock item? Stock items
  aren't GUI objects. I'd say "the horizontal alignment
  of the stock image and label" or something like that.
 

* I'd put the #define and the private structure typedef 
  in the C file, not the H file.

* IMO assigning priv variables at top of function
  is cleaner, rather than doing them where they are 
  needed. (Referring in particular to gtk_button_init())

* I think the extra complexity to change the align
  of the alignment on the fly rather than reconstructing
  is worth it. It seems to me bad to have:

   gtk_button_new_from_stock() 
   gtk_button_set_stock_xalign()

  create-destroy-create 3 widgets.
Comment 5 Matthias Clasen 2003-07-18 19:47:21 UTC
Here is a new patch which does things more in the way you proposed. It
compiles, but I haven't tested it. Does gtk_button_add() look correct ?
Comment 6 Matthias Clasen 2003-07-18 19:48:02 UTC
Created attachment 18416 [details] [review]
button child alignment
Comment 7 Matthias Clasen 2003-12-15 00:01:01 UTC
I've tested the patch now, and since it works fine, I went ahead and
committed it.