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



commit c091c9f4588f32228b73dbb7dc1d22ed8b94f098
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Tue Jan 22 20:52:48 2019 +0100

    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

 src/DialogFeatures.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/DialogFeatures.cc b/src/DialogFeatures.cc
index a9574f93..c4c21381 100644
--- a/src/DialogFeatures.cc
+++ b/src/DialogFeatures.cc
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]