[gparted] Add optional yalign argument to Utils::mk_label() method



commit 6efa6234012b5fa112af4db08e0b89238d53981a
Author: Curtis Gedak <gedakc gmail com>
Date:   Sat Apr 26 14:21:55 2014 -0600

    Add optional yalign argument to Utils::mk_label() method
    
    As part of the work on bug 652044 - uses deprecated APIs, selectable
    vertical alignment was defaulted to ALIGN_CENTER for all labels.  The
    relevant commits can be viewed in comment 26 of said bug report.
    https://bugzilla.gnome.org/show_bug.cgi?id=652044#c26
    
    For multi-line labels a vertical ALIGN_CENTER value is not
    consistently aesthetically pleasing.  This becomes obvious when a
    single-line heading label is paired with a multi-line value label.
    To improve the aesthetics, a vertical alignment of ALIGN_TOP is
    preferred.
    
    Hence re-add the ability to optionally specify a vertical alignment for
    labels.  If a yalign value is not specified a default vertical alignment
    of ALIGN_CENTER is used.

 include/Utils.h |    1 +
 src/Utils.cc    |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index 1433361..8e7cf35 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -162,6 +162,7 @@ public:
                                    , bool use_markup = true
                                    , bool wrap = false
                                    , bool selectable = false
+                                   , float yalign = 0.5 /* ALIGN_CENTER */
                                    ) ;
        static Glib::ustring num_to_str( Sector number ) ;
        static Glib::ustring get_color( FILESYSTEM filesystem ) ;
diff --git a/src/Utils.cc b/src/Utils.cc
index 50e053d..8204b2e 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -46,12 +46,15 @@ Gtk::Label * Utils::mk_label( const Glib::ustring & text
                             , bool use_markup
                             , bool wrap
                             , bool selectable
+                            , float yalign
                             )
 {
        //xalign 0.0 == Gtk::ALIGN_LEFT  (gtkmm <= 2.22)
        //           == Gtk::ALIGN_START (gtkmm >= 2.24)
        //yalign 0.5 == Gtk::ALIGN_CENTER
-       Gtk::Label * label = manage( new Gtk::Label( text, 0.0, 0.5 ) ) ;
+       //       0.0 == Gtk::ALIGN_TOP   (gtkmm <= 2.22)
+       //              Gtk::ALIGN_START (gtkmm >= 2.24)
+       Gtk::Label * label = manage( new Gtk::Label( text, 0.0, yalign ) ) ;
 
        label ->set_use_markup( use_markup ) ;
        label ->set_line_wrap( wrap ) ;


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