[gparted] Go back to symbolic label widget alignment constants



commit 45fd146fd0f7616518caaf77918c1735ad5af5ad
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Mon Feb 18 17:03:11 2019 +0000

    Go back to symbolic label widget alignment constants
    
    Now that GParted requires Gtk3 there is no need to use floating point
    numbers for compatibility with Gtk <= 2.22.  Replace with symbolic
    alignment constants.
    
    Relevant commit history:
    
    *   6efa6234012b5fa112af4db08e0b89238d53981a
        Add optional yalign argument to Utils::mk_label() method
    
    *   be2689ad25c104e3cb97e7d5d1f7627dbb137b19
        Stop using deprecated widget alignment enumerators (#652044)

 include/Utils.h              |  2 +-
 src/Dialog_Partition_Info.cc | 16 +++++++++-------
 src/Utils.cc                 |  9 ++-------
 src/Win_GParted.cc           | 10 +++++-----
 4 files changed, 17 insertions(+), 20 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index 380d7807..630c63f1 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -126,7 +126,7 @@ public:
                                    , bool use_markup = true
                                    , bool wrap = false
                                    , bool selectable = false
-                                   , float yalign = 0.5 /* ALIGN_CENTER */
+                                   , Gtk::Align yalign = Gtk::ALIGN_CENTER
                                    ) ;
        static Glib::ustring num_to_str( Sector number ) ;
        static Glib::ustring get_color( FSType filesystem );
diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc
index a143458e..215fedad 100644
--- a/src/Dialog_Partition_Info.cc
+++ b/src/Dialog_Partition_Info.cc
@@ -314,9 +314,9 @@ void Dialog_Partition_Info::Display_Info()
        {
                //status
                Glib::ustring str_temp ;
-               table->attach( *Utils::mk_label( "<b>" + Glib::ustring( _("Status:") ) + "</b>",
-                                                true, false, false, 0.0 /* ALIGN_TOP */ ),
-                              1, 2, top, bottom, Gtk::FILL );
+               table->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Status:")) + "</b>",
+                                              true, false, false, Gtk::ALIGN_START),
+                             1, 2, top, bottom, Gtk::FILL);
                if ( ! filesystem_accessible )
                {
                        /* TO TRANSLATORS:   Not accessible (Encrypted)
@@ -433,8 +433,9 @@ void Dialog_Partition_Info::Display_Info()
             filesystem_ptn.filesystem == FS_BTRFS      )
        {
                //Members
-               table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Members:") ) + "</b>", true, 
false, false, 0.0 /* ALIGN_TOP */ ),
-                               1, 2, top, bottom, Gtk::FILL ) ;
+               table->attach(* Utils::mk_label("<b>" + Glib::ustring(_("Members:")) + "</b>",
+                                               true, false, false, Gtk::ALIGN_START),
+                              1, 2, top, bottom, Gtk::FILL);
 
                std::vector<Glib::ustring> members ;
                switch ( filesystem_ptn.filesystem )
@@ -457,8 +458,9 @@ void Dialog_Partition_Info::Display_Info()
        if ( filesystem_ptn.filesystem == FS_LVM2_PV )
        {
                //Logical Volumes
-               table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Logical Volumes:") ) + "</b>", 
true, false, false, 0.0 /* ALIGN_TOP */ ),
-                               1, 2, top, bottom, Gtk::FILL );
+               table->attach(* Utils::mk_label("<b>" + Glib::ustring(_("Logical Volumes:")) + "</b>",
+                                               true, false, false, Gtk::ALIGN_START),
+                             1, 2, top, bottom, Gtk::FILL);
 
                std::vector<Glib::ustring> lvs = LVM2_PV_Info::get_vg_lvs( vgname );
                table->attach( *Utils::mk_label( Glib::build_path( "\n", lvs ), true, false, true ),
diff --git a/src/Utils.cc b/src/Utils.cc
index 509bd7f6..7b38f191 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -57,15 +57,10 @@ Gtk::Label * Utils::mk_label( const Glib::ustring & text
                             , bool use_markup
                             , bool wrap
                             , bool selectable
-                            , float yalign
+                            , Gtk::Align yalign
                             )
 {
-       //xalign 0.0 == Gtk::ALIGN_LEFT  (gtkmm <= 2.22)
-       //           == Gtk::ALIGN_START (gtkmm >= 2.24)
-       //yalign 0.5 == Gtk::ALIGN_CENTER
-       //       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 ) ) ;
+       Gtk::Label * label = manage(new Gtk::Label(text, Gtk::ALIGN_START, yalign));
 
        label ->set_use_markup( use_markup ) ;
        label ->set_line_wrap( wrap ) ;
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 5f0db81b..97dd8c39 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -3508,9 +3508,9 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
                        1, 2, top++, bottom++, Gtk::FILL ) ;
 
        //Members
-       table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( members_label ) + "</b>",
-                                          true, false, false, 0.0 /* ALIGN_TOP */ ),
-                       0, 1, top, bottom, Gtk::FILL ) ;
+       table->attach(* Utils::mk_label("<b>" + Glib::ustring(members_label) + "</b>",
+                                       true, false, false, Gtk::ALIGN_START),
+                     0, 1, top, bottom, Gtk::FILL);
 
        Glib::ustring members_str = "" ;
        if ( ! members .empty() )
@@ -3522,8 +3522,8 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
                        members_str += members[i] ;
                }
        }
-       table ->attach( * Utils::mk_label( members_str, true, false, true, 0.0 /* ALIGN_TOP */ ),
-                       1, 2, top++, bottom++, Gtk::FILL ) ;
+       table->attach(* Utils::mk_label(members_str, true, false, true, Gtk::ALIGN_START),
+                     1, 2, top++, bottom++, Gtk::FILL);
 
        dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
        dialog .add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );


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