GNOME Bugzilla – Bug 345349
gtkmessagedialog wrapping
Last modified: 2011-10-18 07:16:55 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.
Created attachment 67648 [details] [review] proposed patch
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?
_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)
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.
(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.
Created attachment 160030 [details] [review] Updated Updated the since tags and removed the unneeded comment. The property name, param spec and function name all follow the how GtkLabel defines them. gtk_label_set_word_wrap_mode
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.
I wonder if this is really needed now that we have the extended-layout stuff in current GTK+
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.
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.
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
Ugh, patch on wrong bug
If I read comment #10 right, then this is a WONTFIX, correct?
Comment on attachment 170579 [details] [review] add a destroy notify wrong patch as per comment #12
Closing as per comment #13. Please reopen if this is not the case.