Organize partition information fields into logical sections (#690542)

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-29 13:55:47 -06:00 committed by Mike Fleetwood
parent 5f6656f267
commit 7fc8aa49fe
1 changed files with 145 additions and 145 deletions

View File

@ -18,8 +18,6 @@
#include "../include/Dialog_Partition_Info.h" #include "../include/Dialog_Partition_Info.h"
#include "../include/LVM2_PV_Info.h" #include "../include/LVM2_PV_Info.h"
#include <gtkmm/separator.h>
namespace GParted namespace GParted
{ {
@ -179,9 +177,15 @@ void Dialog_Partition_Info::init_drawingarea()
void Dialog_Partition_Info::Display_Info() void Dialog_Partition_Info::Display_Info()
{ {
int top = 0, bottom = 1 ;
Sector ptn_sectors = partition .get_sector_length() ; Sector ptn_sectors = partition .get_sector_length() ;
LVM2_PV_Info lvm2_pv_info ; LVM2_PV_Info lvm2_pv_info ;
Glib::ustring vgname = "" ; //Also used in partition status message
if ( partition .filesystem == FS_LVM2_PV )
vgname = lvm2_pv_info .get_vg_name( partition .get_path() ) ;
//initialize table top and bottom row number attach trackers
int top = 0, bottom = 1 ;
Gtk::Table* table(manage(new Gtk::Table())); Gtk::Table* table(manage(new Gtk::Table()));
@ -189,7 +193,8 @@ void Dialog_Partition_Info::Display_Info()
table ->set_col_spacings(10 ) ; table ->set_col_spacings(10 ) ;
this ->get_vbox() ->pack_start( *table, Gtk::PACK_SHRINK ) ; this ->get_vbox() ->pack_start( *table, Gtk::PACK_SHRINK ) ;
//filesystem //FILE SYSTEM DETAIL SECTION
//file system
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("File system:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("File system:") ) + "</b>" ),
0, 1, 0, 1,
top, bottom, top, bottom,
@ -199,101 +204,35 @@ void Dialog_Partition_Info::Display_Info()
top++, bottom++, top++, bottom++,
Gtk::FILL ) ; Gtk::FILL ) ;
//size //label
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Size:") ) + "</b>" ), if ( partition.type != GParted::TYPE_UNALLOCATED && partition.type != GParted::TYPE_EXTENDED )
{
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Label:") ) + "</b>"),
0, 1, 0, 1,
top, bottom, top, bottom,
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( partition .get_label(), true, false, true ),
1, 2, 1, 2,
top++, bottom++, top++, bottom++,
Gtk::FILL ) ; Gtk::FILL) ;
if ( partition .sector_usage_known() )
{
//calculate relative diskusage
int percent_used, percent_unused, percent_unallocated ;
partition .get_usage_triple( 100, percent_used, percent_unused, percent_unallocated ) ;
//Used
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Used:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_used(), partition .sector_size ), true, false, true ),
1, 2,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_used ) + "% )"),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
//unused
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Unused:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_unused(), partition .sector_size ), true, false, true ),
1, 2,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_unused ) + "% )"),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
//unallocated
Sector sectors_unallocated = partition .get_sectors_unallocated() ;
if ( sectors_unallocated > 0 )
{
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Unallocated:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( sectors_unallocated, partition .sector_size ), true, false, true ),
1, 2,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_unallocated ) + "% )"),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
}
} }
Glib::ustring vgname = "" ; //uuid
if ( partition .filesystem == FS_LVM2_PV ) if ( partition.type != GParted::TYPE_UNALLOCATED && partition.type != GParted::TYPE_EXTENDED )
vgname = lvm2_pv_info .get_vg_name( partition .get_path() ) ;
//flags
if ( partition.type != GParted::TYPE_UNALLOCATED )
{ {
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Flags:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("UUID:") ) + "</b>"),
0, 1, 0, 1,
top, bottom, top, bottom,
Gtk::FILL ) ; Gtk::FILL) ;
table ->attach( * Utils::mk_label( Glib::build_path( ", ", partition .flags ), true, false, true ), table ->attach( * Utils::mk_label( partition .uuid, true, false, true ),
1, 2, 1, 2,
top++, bottom++, top++, bottom++,
Gtk::FILL ) ; Gtk::FILL) ;
} }
//one blank line //status
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
if ( partition .type != GParted::TYPE_UNALLOCATED && partition .status != GParted::STAT_NEW ) if ( partition .type != GParted::TYPE_UNALLOCATED && partition .status != GParted::STAT_NEW )
{ {
//path
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Path:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Glib::build_path( "\n", partition .get_paths() ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
//status //status
Glib::ustring str_temp ; Glib::ustring str_temp ;
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Status:") ) + "</b>" ), table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Status:") ) + "</b>" ),
@ -389,30 +328,132 @@ void Dialog_Partition_Info::Display_Info()
table ->attach( * Utils::mk_label( str_temp, true, false, true ), 1, 2, top++, bottom++, Gtk::FILL ) ; table ->attach( * Utils::mk_label( str_temp, true, false, true ), 1, 2, top++, bottom++, Gtk::FILL ) ;
} }
//label //Optional Logical Volume Manager Physical Volume details
if ( partition.type != GParted::TYPE_UNALLOCATED && partition.type != GParted::TYPE_EXTENDED ) if ( partition .filesystem == FS_LVM2_PV )
{ {
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Label:") ) + "</b>"), //Volume Group
0, 1, table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Volume Group:") ) + "</b>"),
top, bottom, 0, 1, top, bottom, Gtk::FILL ) ;
Gtk::FILL) ; table ->attach( * Utils::mk_label( vgname, true, false, true ),
table ->attach( * Utils::mk_label( partition .get_label(), true, false, true ), 1, 2, top++, bottom++, Gtk::FILL ) ;
1, 2,
top++, bottom++, //Members
Gtk::FILL) ; table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Members:") ) + "</b>"),
0, 1, top, bottom, Gtk::FILL ) ;
std::vector<Glib::ustring> members ;
if ( ! vgname .empty() )
members = lvm2_pv_info .get_vg_members( vgname ) ;
if ( members .empty() )
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
else
{
table ->attach( * Utils::mk_label( members [0], true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
for ( unsigned int i = 1 ; i < members .size() ; i ++ )
{
table ->attach( * Utils::mk_label( "" ), 0, 1, top, bottom, Gtk::FILL) ;
table ->attach( * Utils::mk_label( members [i], true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
}
}
} }
//uuid //one blank line
if ( partition.type != GParted::TYPE_UNALLOCATED && partition.type != GParted::TYPE_EXTENDED ) table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
if ( partition .sector_usage_known() )
{ {
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("UUID:") ) + "</b>"), //calculate relative diskusage
int percent_used, percent_unused, percent_unallocated ;
partition .get_usage_triple( 100, percent_used, percent_unused, percent_unallocated ) ;
//Used
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Used:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_used(), partition .sector_size ), true, false, true ),
1, 2,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_used ) + "% )"),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
//unused
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Unused:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_unused(), partition .sector_size ), true, false, true ),
1, 2,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_unused ) + "% )"),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
//unallocated
Sector sectors_unallocated = partition .get_sectors_unallocated() ;
if ( sectors_unallocated > 0 )
{
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Unallocated:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( sectors_unallocated, partition .sector_size ), true, false, true ),
1, 2,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_unallocated ) + "% )"),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
}
}
//size
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Size:") ) + "</b>" ),
0, 1, 0, 1,
top, bottom, top, bottom,
Gtk::FILL) ; Gtk::FILL) ;
table ->attach( * Utils::mk_label( partition .uuid, true, false, true ), table ->attach( * Utils::mk_label( Utils::format_size( ptn_sectors, partition .sector_size ), true, false, true ),
1, 2, 1, 2,
top++, bottom++, top++, bottom++,
Gtk::FILL) ; Gtk::FILL ) ;
//one blank line
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
//PARTITION DETAIL SECTION
//path
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Path:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Glib::build_path( "\n", partition .get_paths() ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
if ( partition .type != GParted::TYPE_UNALLOCATED && partition .status != GParted::STAT_NEW )
{
//flags
if ( partition.type != GParted::TYPE_UNALLOCATED )
{
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Flags:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Glib::build_path( ", ", partition .flags ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
}
} }
//one blank line //one blank line
@ -447,47 +488,6 @@ void Dialog_Partition_Info::Display_Info()
1, 2, 1, 2,
top++, bottom++, top++, bottom++,
Gtk::FILL ) ; Gtk::FILL ) ;
if ( partition .filesystem == FS_LVM2_PV )
{
//one blank line
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
//horizontal separator
Gtk::HSeparator * hsep( manage( new Gtk::HSeparator() ) ) ;
table ->attach( * hsep, 0, 2, top++, bottom++, Gtk::FILL ) ;
//one blank line
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
//Volume Group
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Volume Group:") ) + "</b>"),
0, 1, top, bottom, Gtk::FILL ) ;
table ->attach( * Utils::mk_label( vgname, true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
//Members
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Members:") ) + "</b>"),
0, 1, top, bottom, Gtk::FILL ) ;
std::vector<Glib::ustring> members ;
if ( ! vgname .empty() )
members = lvm2_pv_info .get_vg_members( vgname ) ;
if ( members .empty() )
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
else
{
table ->attach( * Utils::mk_label( members [0], true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
for ( unsigned int i = 1 ; i < members .size() ; i ++ )
{
table ->attach( * Utils::mk_label( "" ), 0, 1, top, bottom, Gtk::FILL) ;
table ->attach( * Utils::mk_label( members [i], true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
}
}
}
} }
Dialog_Partition_Info::~Dialog_Partition_Info() Dialog_Partition_Info::~Dialog_Partition_Info()