Reorder and rename params to TreeView_Detail::load_partitions()

Reorder the parameters into the same order in which they occur in the
row, i.e. Name first, then Mount Point and finally Label.  Rename local
variables in load_partitions(1 param) and parameters of
load_partitions(5 params) prefixing with "show_" to make it clearer the
variables track if that column will be displayed or not.
This commit is contained in:
Mike Fleetwood 2016-12-01 14:05:57 +00:00 committed by Curtis Gedak
parent 9e932ec7d0
commit 43f2a4bd08
2 changed files with 16 additions and 13 deletions

View file

@ -47,9 +47,9 @@ public:
private:
void load_partitions( const PartitionVector & partitions,
bool & mountpoints,
bool & labels,
bool & names,
bool & show_names,
bool & show_mountpoints,
bool & show_labels,
const Gtk::TreeRow & parent_row = Gtk::TreeRow() );
bool set_selected( Gtk::TreeModel::Children rows,
const Partition * partition_ptr, bool inside_extended = false );

View file

@ -82,14 +82,17 @@ TreeView_Detail::TreeView_Detail()
void TreeView_Detail::load_partitions( const PartitionVector & partitions )
{
bool mountpoints = false, labels = false, names = false;
bool show_names = false;
bool show_mountpoints = false;
bool show_labels = false;
treestore_detail ->clear() ;
load_partitions( partitions, mountpoints, labels, names );
load_partitions( partitions, show_names, show_mountpoints, show_labels );
get_column( 1 )->set_visible( names );
get_column( 3 )->set_visible( mountpoints );
get_column( 4 )->set_visible( labels );
get_column( 1 )->set_visible( show_names );
get_column( 3 )->set_visible( show_mountpoints );
get_column( 4 )->set_visible( show_labels );
columns_autosize();
expand_all() ;
@ -108,19 +111,19 @@ void TreeView_Detail::clear()
}
void TreeView_Detail::load_partitions( const PartitionVector & partitions,
bool & mountpoints,
bool & labels,
bool & names,
bool & show_names,
bool & show_mountpoints,
bool & show_labels,
const Gtk::TreeRow & parent_row )
{
Gtk::TreeRow row ;
for ( unsigned int i = 0 ; i < partitions .size() ; i++ )
{
row = parent_row ? *( treestore_detail ->append( parent_row .children() ) ) : *( treestore_detail ->append() ) ;
create_row( row, partitions[i], names, mountpoints, labels );
create_row( row, partitions[i], show_names, show_mountpoints, show_labels );
if ( partitions[ i ] .type == GParted::TYPE_EXTENDED )
load_partitions( partitions[i].logicals, mountpoints, labels, names, row );
load_partitions( partitions[i].logicals, show_names, show_mountpoints, show_labels, row );
}
}