GNOME Bugzilla – Bug 644007
GtkLabel does not allow a minimum width to be set
Last modified: 2011-06-01 05:13:08 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.
This works correctly in GTK+ 3.x