Prevent the legend text making the features dialog too wide (#7)

With the Gtk3 port the File System Support dialog has become too wide
because the legend text is no longer wrapped.  Set the max-width-chars
property to specify the natural size of the widget in terms of
characters [1].  It is converted to pixels using the average character
width in the current font.

Also use PACK_EXPAND_WIDGET when adding the label to the box so that if
the dialog is resized extra space is used to increase the size of this
child widget [2].

[1] GNOME HowDoI / Labels
    https://wiki.gnome.org/HowDoI/Labels

[2] Gtkmm 3.0 Enums and Flags, enum Gtk::PackOptions
    "PACK_EXPAND_WIDGET  Space is expanded, with extra space filled by
    increasing the child widget size."
    https://developer.gnome.org/gtkmm/3.0/group__gtkmmEnums.html#ga83727a1b6fed51566dfd5c8e58890dba

Closes #7 - Port to Gtk3
This commit is contained in:
Luca Bacci 2019-01-22 20:52:48 +01:00 committed by Mike Fleetwood
parent bf39c221b8
commit c091c9f458
1 changed files with 3 additions and 1 deletions

View File

@ -77,7 +77,9 @@ DialogFeatures::DialogFeatures()
Glib::ustring str_temp( _("This chart shows the actions supported on file systems.") ) ;
str_temp += "\n" ;
str_temp += _("Not all actions are available on all file systems, in part due to the nature of file systems and limitations in the required software.") ;
legend_narrative_hbox ->pack_start( *Utils::mk_label( str_temp, true, true ), Gtk::PACK_SHRINK ) ;
Gtk::Label *label_narrative = Utils::mk_label(str_temp, true, true);
label_narrative->set_max_width_chars(45);
legend_narrative_hbox->pack_start(*label_narrative, Gtk::PACK_EXPAND_WIDGET);
legend_hbox ->pack_start( *legend_narrative_hbox, Gtk::PACK_EXPAND_WIDGET, 6 ) ;
//icon legend