[gparted] Simplify code in Display_Info() by making use of Glib::build_path()



commit ee6dcf5a964f820e8049bc6809018294e3b196bf
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Thu Dec 31 17:29:02 2015 +0000

    Simplify code in Display_Info() by making use of Glib::build_path()
    
    Simplify code in Dialog_Partition_Info::Dialog_Info() which was open
    coding concatenating together a vector of strings with a new line
    between each.  Replace with Glib::build_path(), as used elsewhere in
    this method and other code.

 src/Dialog_Partition_Info.cc |   28 +++++-----------------------
 1 files changed, 5 insertions(+), 23 deletions(-)
---
diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc
index a0a5c56..6d84b27 100644
--- a/src/Dialog_Partition_Info.cc
+++ b/src/Dialog_Partition_Info.cc
@@ -451,17 +451,8 @@ void Dialog_Partition_Info::Display_Info()
                                break ;
                }
 
-               Glib::ustring members_str = "" ;
-               if ( ! members .empty() )
-               {
-                       for ( unsigned int i = 0 ; i < members .size() ; i ++ )
-                       {
-                               if ( i > 0 )
-                                       members_str += "\n" ;
-                               members_str += members[i] ;
-                       }
-               }
-               table ->attach( * Utils::mk_label( members_str, true, false, true, 0.0 /* ALIGN_TOP */ ), 2, 
3, top++, bottom++, Gtk::FILL ) ;
+               table->attach( *Utils::mk_label( Glib::build_path( "\n", members ), true, false, true ),
+                              2, 3, top++, bottom++, Gtk::FILL );
        }
 
        if ( filesystem->filesystem == FS_LVM2_PV )
@@ -470,18 +461,9 @@ void Dialog_Partition_Info::Display_Info()
                table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Logical Volumes:") ) + "</b>", 
true, false, false, 0.0 /* ALIGN_TOP */ ),
                                1, 2, top, bottom, Gtk::FILL );
 
-               std::vector<Glib::ustring> lvs;
-               lvs = LVM2_PV_Info::get_vg_lvs( vgname );
-
-               Glib::ustring lvs_str = "";
-               for ( unsigned int i = 0 ; i < lvs .size() ; i ++ )
-               {
-                       if ( i > 0 )
-                               lvs_str += "\n";
-                       lvs_str += lvs[i];
-               }
-
-               table ->attach( * Utils::mk_label( lvs_str, true, false, true, 0.0 /* ALIGN_TOP */ ), 2, 3, 
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 ),
+                              2, 3, top++, bottom++, Gtk::FILL );
        }
 
        //Right field & value pair area


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