Organize partition information into two field & value columns (#690542)

Organize the partition information field & value areas into two columns
to minimize the amount of vertical space required.

This is part of a series of changes to enable viewing all partition
information details on a minimum 800x600 display.

Part of Bug 690542 - Partition Information Dialog Warning not readable
This commit is contained in:
Curtis Gedak 2014-03-30 15:17:36 -06:00 committed by Mike Fleetwood
parent 92c771bc7c
commit 898bc35198
1 changed files with 61 additions and 50 deletions

View File

@ -180,13 +180,13 @@ void Dialog_Partition_Info::Display_Info()
//The information in this area is in table format. //The information in this area is in table format.
// //
//For example: //For example:
//<-- Column Numbers --> //<------------------ Column Numbers --------------------->
//0 1 2 3 //0 1 2 3 4 5
//+---+---------+------+ //+-+------------+-------------+-------------+------------+
//Section //Section
// Field: Value // Field Left: Value Left Field Right: Value Right
//+---+---------+------+ //+-+------------+-------------+-------------+------------+
//0 1 2 3 //0 1 2 3 4 5
Sector ptn_sectors = partition .get_sector_length() ; Sector ptn_sectors = partition .get_sector_length() ;
@ -196,7 +196,8 @@ void Dialog_Partition_Info::Display_Info()
vgname = lvm2_pv_info .get_vg_name( partition .get_path() ) ; vgname = lvm2_pv_info .get_vg_name( partition .get_path() ) ;
//initialize table top and bottom row number attach trackers //initialize table top and bottom row number attach trackers
int top = 0, bottom = 1 ; int top = 0 , bottom = 1 ; //Left field & value pairs
int topright = 0, bottomright = 1 ; //Right field & value pairs
Gtk::Table* table(manage(new Gtk::Table())); Gtk::Table* table(manage(new Gtk::Table()));
@ -207,10 +208,15 @@ void Dialog_Partition_Info::Display_Info()
//FILE SYSTEM DETAIL SECTION //FILE SYSTEM DETAIL SECTION
//file system headline //file system headline
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("File System") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("File System") ) + "</b>" ),
0, 3, 0, 5,
top++, bottom++, top++, bottom++,
Gtk::FILL ) ; Gtk::FILL ) ;
//use current left row tracker position as anchor for right
topright = top ;
bottomright = bottom ;
//Left field & value pair area
//file system //file system
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("File system:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("File system:") ) + "</b>" ),
1, 2, 1, 2,
@ -377,9 +383,7 @@ void Dialog_Partition_Info::Display_Info()
} }
} }
//one blank line //Right field & value pair area
table ->attach( * Utils::mk_label( "" ), 0, 3, top++, bottom++, Gtk::FILL ) ;
if ( partition .sector_usage_known() ) if ( partition .sector_usage_known() )
{ {
//calculate relative diskusage //calculate relative diskusage
@ -388,30 +392,30 @@ void Dialog_Partition_Info::Display_Info()
//Used //Used
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Used:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Used:") ) + "</b>" ),
1, 2, 3, 4,
top, bottom, topright, bottomright,
Gtk::FILL ) ; Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_used(), partition .sector_size ), true, false, true ), table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_used(), partition .sector_size ), true, false, true ),
2, 3, 4, 5,
top, bottom, topright, bottomright,
Gtk::FILL ) ; Gtk::FILL ) ;
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_used ) + "% )"), table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_used ) + "% )"),
2, 3, 4, 5,
top++, bottom++, topright++, bottomright++,
Gtk::FILL ) ; Gtk::FILL ) ;
//unused //unused
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Unused:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Unused:") ) + "</b>" ),
1, 2, 3, 4,
top, bottom, topright, bottomright,
Gtk::FILL ) ; Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_unused(), partition .sector_size ), true, false, true ), table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_unused(), partition .sector_size ), true, false, true ),
2, 3, 4, 5,
top, bottom, topright, bottomright,
Gtk::FILL ) ; Gtk::FILL ) ;
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_unused ) + "% )"), table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_unused ) + "% )"),
2, 3, 4, 5,
top++, bottom++, topright++, bottomright++,
Gtk::FILL ) ; Gtk::FILL ) ;
//unallocated //unallocated
@ -419,40 +423,49 @@ void Dialog_Partition_Info::Display_Info()
if ( sectors_unallocated > 0 ) if ( sectors_unallocated > 0 )
{ {
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Unallocated:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Unallocated:") ) + "</b>" ),
1, 2, 3, 4,
top, bottom, topright, bottomright,
Gtk::FILL ) ; Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( sectors_unallocated, partition .sector_size ), true, false, true ), table ->attach( * Utils::mk_label( Utils::format_size( sectors_unallocated, partition .sector_size ), true, false, true ),
2, 3, 4, 5,
top, bottom, topright, bottomright,
Gtk::FILL ) ; Gtk::FILL ) ;
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_unallocated ) + "% )"), table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_unallocated ) + "% )"),
2, 3, 4, 5,
top++, bottom++, topright++, bottomright++,
Gtk::FILL ) ; Gtk::FILL ) ;
} }
} }
//size //size
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Size:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Size:") ) + "</b>" ),
1, 2, 3, 4,
top, bottom, topright, bottomright,
Gtk::FILL) ; Gtk::FILL) ;
table ->attach( * Utils::mk_label( Utils::format_size( ptn_sectors, partition .sector_size ), true, false, true ), table ->attach( * Utils::mk_label( Utils::format_size( ptn_sectors, partition .sector_size ), true, false, true ),
2, 3, 4, 5,
top++, bottom++, topright++, bottomright++,
Gtk::FILL ) ; Gtk::FILL ) ;
//ensure left row tracker set to largest side (left/right)
top = std::max( top, topright );
bottom = std::max( bottom, bottomright );
//one blank line //one blank line
table ->attach( * Utils::mk_label( "" ), 0, 3, top++, bottom++, Gtk::FILL ) ; table ->attach( * Utils::mk_label( "" ), 0, 5, top++, bottom++, Gtk::FILL ) ;
//PARTITION DETAIL SECTION //PARTITION DETAIL SECTION
//partition headline //partition headline
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Partition") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Partition") ) + "</b>" ),
0, 3, 0, 5,
top++, bottom++, top++, bottom++,
Gtk::FILL ) ; Gtk::FILL ) ;
//use current left row tracker position as anchor for right
topright = top ;
bottomright = bottom ;
//Left field & value pair area
//path //path
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Path:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Path:") ) + "</b>" ),
1, 2, 1, 2,
@ -479,37 +492,35 @@ void Dialog_Partition_Info::Display_Info()
} }
} }
//one blank line //Right field & value pair area
table ->attach( * Utils::mk_label( "" ), 0, 3, top++, bottom++, Gtk::FILL ) ;
//first sector //first sector
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("First sector:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("First sector:") ) + "</b>" ),
1, 2, 3, 4,
top, bottom, topright, bottomright,
Gtk::FILL ) ; Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::num_to_str( partition .sector_start ), true, false, true ), table ->attach( * Utils::mk_label( Utils::num_to_str( partition .sector_start ), true, false, true ),
2, 3, 4, 5,
top++, bottom++, topright++, bottomright++,
Gtk::FILL ) ; Gtk::FILL ) ;
//last sector //last sector
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Last sector:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Last sector:") ) + "</b>" ),
1, 2, 3, 4,
top, bottom, topright, bottomright,
Gtk::FILL ) ; Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::num_to_str( partition.sector_end ), true, false, true ), table ->attach( * Utils::mk_label( Utils::num_to_str( partition.sector_end ), true, false, true ),
2, 3, 4, 5,
top++, bottom++, topright++, bottomright++,
Gtk::FILL ) ; Gtk::FILL ) ;
//total sectors //total sectors
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Total sectors:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Total sectors:") ) + "</b>" ),
1, 2, 3, 4,
top, bottom, topright, bottomright,
Gtk::FILL ) ; Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::num_to_str( ptn_sectors ), true, false, true ), table ->attach( * Utils::mk_label( Utils::num_to_str( ptn_sectors ), true, false, true ),
2, 3, 4, 5,
top++, bottom++, topright++, bottomright++,
Gtk::FILL ) ; Gtk::FILL ) ;
} }