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 644007 - GtkLabel does not allow a minimum width to be set
GtkLabel does not allow a minimum width to be set
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkLabel
2.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-03-06 07:14 UTC by Steven Sheehy
Modified: 2011-06-01 05:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test_min_width.c (1.28 KB, text/plain)
2011-03-06 07:14 UTC, Steven Sheehy
Details

Description Steven Sheehy 2011-03-06 07:14:06 UTC
Created attachment 182597 [details]
test_min_width.c

GtkLabel should have some way to specify a minimum width (in pixels or characters) for the widget. For example, if the min width is set to 50 px and the size of the text occupies 75 px then the size of the GtkLabel should be 75. If the text is updated to only be 30 px, then the size of the GtkLabel should be 50 px.

The description of gtk_widget_set_size_request() states that it "Sets the minimum size of a widget". This implies that the widget cannot grow smaller than its min width request, but that it can grow larger. However, calling gtk_widget_set_size_request(widget, width, -1) for a GtkLabel has the effect of setting an exact width for the widget. That is, the width of the widget neither decreases or increases with the size of its internal dynamic content.

I have attached a small test case to demonstrate this. This program has an GtkHBox with a static label and a dynamic label. The dynamic label is updated every second to increase the text by one character in length. Once it fills the width of the label, the text should in theory cause the label width to increase in size. Instead the text gets cut off and the dynamic label does not change size.
Comment 1 Matthias Clasen 2011-06-01 05:13:08 UTC
This works correctly in GTK+ 3.x