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 780268 - Zenity message dialogs doesn't wrap text and grow in height with message length
Zenity message dialogs doesn't wrap text and grow in height with message length
Product: zenity
Classification: Core
Component: general
Other Linux
: Normal normal
: ---
Assigned To: Zenity Maintainers
Zenity Maintainers
Depends on:
Reported: 2017-03-19 16:05 UTC by Alan
Modified: 2017-04-04 13:52 UTC
See Also:
GNOME target: ---
GNOME version: ---

Fix message dialog width and height on recent Gtk (2.29 KB, patch)
2017-03-19 16:05 UTC, Alan
none Details | Review

Description Alan 2017-03-19 16:05:35 UTC
Created attachment 348262 [details] [review]
Fix message dialog width and height on recent Gtk

The fix for "Bug 670496 - Zenity info/error windows grow in height with message length" ( doesn't work with Gtk 3.22

While investigating the issue with GTK Inspector, I found that the label has the right height, but the dialog is too heigh. It turns out that the

    gtk_widget_set_size_request (widget, allocation->width/2, -1);

made in zenity_text_size_allocate has no effect anymore. Commenting it out doesn't change anything, and with very long text the label fits the entire window width, while it should only fit half of it.

Zenity 3.22.0 built with GTK 3.14.5-1+deb8u1 doesn't have the issue. The same zenity built with GTK 3.22.9-3 has the issue.

The bug in GTK seems to be Unfortunately the documented workaround apparently stopped working.

The attached patche fixes most of the issue. However, with message length less than 60 characters, it makes the dialog wider than it could be. The following python code could be used to fix that (I don't have the skills to translate this into C):

longest_line = max([len(l) for l in text.splitlines()])
label.set_width_chars(min(longest_line, 60))
Comment 2 Arx Cruz 2017-04-04 13:20:44 UTC
(In reply to Arx Cruz from comment #1)
> Fixed! Thanks!
> ?id=db4a0c3c0f8b224870ea23a3b3c25f800ee4870a

Ignore it, was a fix for another bug, sorry for the inconvenience.
Comment 3 Arx Cruz 2017-04-04 13:52:01 UTC
I REALLY hope, this time we fix this problem for real! 
Fixed in

I changed the 'magic number' from 60 to 10 because it was changing the space between the icon and text when you resize the window.

Also I change the glade file in order to icon not fill the all the space.