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 345349 - gtkmessagedialog wrapping
gtkmessagedialog wrapping
Product: gtk+
Classification: Platform
Component: Widget: Other
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
Depends on:
Blocks: 595791 597610
Reported: 2006-06-19 19:04 UTC by Christian Persch
Modified: 2011-10-18 07:16 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement

proposed patch (3.93 KB, patch)
2006-06-19 19:08 UTC, Christian Persch
none Details | Review
Update of chpe's patch to trunk and add gtk_message_dialog_get_line_wrap_mode (4.58 KB, patch)
2008-11-26 16:46 UTC, Björn Lindqvist
needs-work Details | Review
Updated (5.12 KB, patch)
2010-04-30 23:53 UTC, Garrett Regier
needs-work Details | Review
add a destroy notify (4.44 KB, patch)
2010-09-19 04:48 UTC, Matthias Clasen
rejected Details | Review

Description Christian Persch 2006-06-19 19:04:58 UTC
GtkMessageDialog is often used to display alerts whose text contains filenames. Those filenames may be very long, leading to the dialogue expanding instead of wrapping at a sensible width (in extreme cases, the dialogue buttons may be outside the screen). To fix this, one can set the line wrap mode of the labels to PANGO_WRAP_WORD_CHAR using the newly introduced gtk_label_set_line_wrap_mode, which, while not giving the best wrapping imaginable, at least makes the label wrap at a sensible width.
Since there's no public way to get at the secondary label in the message dialogue, I propose a public way to set the primary and secondary label's wrap mode.
Comment 1 Christian Persch 2006-06-19 19:08:27 UTC
Created attachment 67648 [details] [review]
proposed patch
Comment 2 Björn Lindqvist 2008-03-23 15:35:55 UTC
Shouldn't there be a matching gtk_message_dialog_get_line_wrap_mode too? I see that all attributes in GtkMessageDialog misses getters, is that really good style?
Comment 3 Christian Dywan 2008-09-10 12:53:23 UTC
_set_line_wrap_mode should really match PROP_WRAP_MODE

And yes, it definitely needs a getter.

(GtkMessageDialog missing other getters is out of the scope of this bug, but basically also very much needed)
Comment 4 Björn Lindqvist 2008-11-26 16:46:06 UTC
Created attachment 123453 [details] [review]
Update of chpe's patch to trunk and add gtk_message_dialog_get_line_wrap_mode

Patch is untested. Also see comment in gtk_message_dialog_get_line_wrap_mode.
Comment 5 Christian Dywan 2008-11-26 17:06:15 UTC
(In reply to comment #4)
> Created an attachment (id=123453) [edit]
> Update of chpe's patch to trunk and add gtk_message_dialog_get_line_wrap_mode
> Patch is untested. Also see comment in gtk_message_dialog_get_line_wrap_mode.

The property still doesn't match the function names and the param spec actually is a mix of both, *please* fix that.

> /* Note that the line wrap property will get out of sync if someone
>    manually sets it on a label by traversing the widget
>    hierarchy. */

That seems unneeded to me. If an application manually pokes around in there it has to expect that. There are too many ways for an application to mess up composited widgets to fix or even documented them all.
Comment 6 Garrett Regier 2010-04-30 23:53:54 UTC
Created attachment 160030 [details] [review]

Updated the since tags and removed the unneeded comment.

The property name, param spec and function name all follow the how GtkLabel defines them. 

Comment 7 Christian Dywan 2010-05-10 11:04:18 UTC
Review of attachment 160030 [details] [review]:

gtk_message_dialog_set_line_wrap_mode versus GtkMessageDialog::wrap-mode

Again, we want the accessors functions to match the property name. This is important for intuitive programming, as you can infere one from the other without reading documentation and also helpful for bindings.
Comment 8 Javier Jardón (IRC: jjardon) 2010-06-02 16:37:34 UTC
I wonder if this is really needed now that we have the extended-layout stuff in current GTK+
Comment 9 Christian Persch 2010-06-02 16:49:09 UTC
I guess extended-layout still breaks the text in the places the wrap mode tell it to, no? If so, then this is still necessary.
Comment 10 Matthias Clasen 2010-06-24 05:32:54 UTC
I'm not convinced that this is needed.

I am seeing message dialog examples with long filenames get wrapped somewhat sensibly with current git master. Please try it and show me a still-problematic example, if you find one. 

And even if there was one, I guess we really want to control the breaking in a more flexible way than just PANGO_WRAP_WORD_CHAR, maybe using attributes.
Comment 11 Matthias Clasen 2010-09-19 04:48:44 UTC
Created attachment 170579 [details] [review]
add a destroy notify

Here is a patch which adds a destroy notify to the new gtk_menu_popup_for_device function. You can use that with NULL for the device instead of gtk_menu_popup
Comment 12 Matthias Clasen 2010-09-20 12:42:25 UTC
Ugh, patch on wrong bug
Comment 13 Tobias Mueller 2011-02-08 15:05:03 UTC
If I read comment #10 right, then this is a WONTFIX, correct?
Comment 14 Tobias Mueller 2011-06-30 19:52:03 UTC
Comment on attachment 170579 [details] [review]
add a destroy notify

wrong patch as per comment #12
Comment 15 Tobias Mueller 2011-10-18 07:16:55 UTC
Closing as per comment #13. Please reopen if this is not the case.