Use PartitionVector class throughout the code (#759726)

Replace all occurrences of std::vector<Partition> with PartitionVector.

Bug 759726 - Implement Partition object polymorphism
This commit is contained in:
Mike Fleetwood 2015-05-23 20:22:37 +01:00 committed by Curtis Gedak
parent 81337141d7
commit fae909897e
34 changed files with 170 additions and 107 deletions

View File

@ -19,6 +19,7 @@
#define GPARTED_DEVICE_H
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -43,7 +44,7 @@ public:
bool operator!=( const Device & device ) const ;
void Reset() ;
std::vector<Partition> partitions ;
PartitionVector partitions;
Sector length;
Sector heads ;
Sector sectors ;

View File

@ -18,6 +18,8 @@
#define GPARTED_DIALOG_PARTITION_RESIZE_MOVE_H
#include "../include/Dialog_Base_Partition.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -26,12 +28,12 @@ class Dialog_Partition_Resize_Move : public Dialog_Base_Partition
{
public:
Dialog_Partition_Resize_Move( const FS & fs, const Partition & selected_partition,
const std::vector <Partition> & partitions );
const PartitionVector & partitions );
private:
void set_data( const Partition & selected_partition, const std::vector <Partition> & partitions );
void Resize_Move_Normal( const std::vector <Partition> & partitions ) ;
void Resize_Move_Extended( const std::vector <Partition> & partitions ) ;
void set_data( const Partition & selected_partition, const PartitionVector & partitions );
void Resize_Move_Normal( const PartitionVector & partitions );
void Resize_Move_Extended( const PartitionVector & partitions );
};
} //GParted

View File

@ -24,6 +24,7 @@
#include "../include/Device.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
#include <gtkmm/dialog.h>
#include <gtkmm/frame.h>
@ -51,7 +52,7 @@ private:
bool is_inconsistent(const Partition &part);
Device *device; //Parent device
std::vector<Partition> partitions; //Partitions readed from the buffer
PartitionVector partitions; //Partitions read from the buffer
std::vector<int> overlappedPartitions;//List of guessed partitions that
//overlap active partitions
Glib::ustring device_path;

View File

@ -18,6 +18,7 @@
#define GPARTED_DRAWINGAREAVISUALDISK_H
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
#include <gtkmm/drawingarea.h>
@ -29,8 +30,8 @@ class DrawingAreaVisualDisk : public Gtk::DrawingArea
public:
DrawingAreaVisualDisk();
~DrawingAreaVisualDisk();
void load_partitions( const std::vector<Partition> & partitions, Sector device_length );
void load_partitions( const PartitionVector & partitions, Sector device_length );
void set_selected( const Partition * partition_ptr );
void clear() ;
@ -43,11 +44,11 @@ private:
struct visual_partition ;
//private functions
int get_total_separator_px( const std::vector<Partition> & partitions ) ;
void set_static_data( const std::vector<Partition> & partitions,
std::vector<visual_partition> & visual_partitions,
Sector length ) ;
int get_total_separator_px( const PartitionVector & partitions );
void set_static_data( const PartitionVector & partitions,
std::vector<visual_partition> & visual_partitions,
Sector length );
int calc_length( std::vector<visual_partition> & visual_partitions, int length_px ) ;
void calc_position_and_height( std::vector<visual_partition> & visual_partitions, int start, int border ) ;
void calc_usage( std::vector<visual_partition> & visual_partitions ) ;

View File

@ -20,6 +20,8 @@
#include "../include/FileSystem.h"
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
#include <parted/parted.h>
#include <vector>
@ -90,15 +92,15 @@ private:
void read_label( Partition & partition ) ;
void read_uuid( Partition & partition ) ;
void insert_unallocated( const Glib::ustring & device_path,
std::vector<Partition> & partitions,
Sector start,
Sector end,
Byte_Value sector_size,
bool inside_extended ) ;
void set_mountpoints( std::vector<Partition> & partitions ) ;
PartitionVector & partitions,
Sector start,
Sector end,
Byte_Value sector_size,
bool inside_extended );
void set_mountpoints( PartitionVector & partitions );
bool set_mountpoints_helper( Partition & partitions, const Glib::ustring & path ) ;
bool is_busy( FILESYSTEM fstype, const Glib::ustring & path ) ;
void set_used_sectors( std::vector<Partition> & partitions, PedDisk* lp_disk ) ;
void set_used_sectors( PartitionVector & partitions, PedDisk* lp_disk );
void mounted_set_used_sectors( Partition & partition ) ;
#ifdef HAVE_LIBPARTED_FS_RESIZE
void LP_set_used_sectors( Partition & partition, PedDisk* lp_disk ) ;

View File

@ -20,6 +20,8 @@
#include "../include/Device.h"
#include "../include/OperationDetail.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -42,8 +44,8 @@ class Operation
public:
Operation() ;
virtual ~Operation() {}
virtual void apply_to_visual( std::vector<Partition> & partitions ) = 0 ;
virtual void apply_to_visual( PartitionVector & partitions ) = 0;
virtual void create_description() = 0 ;
virtual bool merge_operations( const Operation & candidate ) = 0;
@ -59,12 +61,13 @@ public:
OperationDetail operation_detail ;
protected:
int find_index_original( const std::vector<Partition> & partitions ) ;
int find_index_new( const std::vector<Partition> & partitions );
int find_index_extended( const std::vector<Partition> & partitions ) ;
void insert_unallocated( std::vector<Partition> & partitions, Sector start, Sector end, Byte_Value sector_size, bool inside_extended );
void substitute_new( std::vector<Partition> & partitions );
void insert_new( std::vector<Partition> & partitions );
int find_index_original( const PartitionVector & partitions );
int find_index_new( const PartitionVector & partitions );
int find_index_extended( const PartitionVector & partitions );
void insert_unallocated( PartitionVector & partitions,
Sector start, Sector end, Byte_Value sector_size, bool inside_extended );
void substitute_new( PartitionVector & partitions );
void insert_new( PartitionVector & partitions );
};
} //GParted

View File

@ -18,6 +18,8 @@
#define GPARTED_OPERATIONCHANGEUUID_H
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -30,7 +32,7 @@ public:
, const Partition & partition_new
) ;
void apply_to_visual( std::vector<Partition> & partitions ) ;
void apply_to_visual( PartitionVector & partitions );
private:
void create_description() ;

View File

@ -18,6 +18,8 @@
#define GPARTED_OPERATIONCHECK_H
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -26,8 +28,8 @@ class OperationCheck : public Operation
{
public:
OperationCheck( const Device & device, const Partition & partition ) ;
void apply_to_visual( std::vector<Partition> & partitions ) ;
void apply_to_visual( PartitionVector & partitions );
private:
void create_description() ;

View File

@ -18,6 +18,8 @@
#define GPARTED_OPERATIONCOPY_H
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -29,8 +31,8 @@ public:
const Partition & partition_orig,
const Partition & partition_new,
const Partition & partition_copied ) ;
void apply_to_visual( std::vector<Partition> & partitions ) ;
void apply_to_visual( PartitionVector & partitions );
Partition partition_copied ;

View File

@ -18,6 +18,8 @@
#define GPARTED_OPERATIONCREATE_H
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -28,8 +30,8 @@ public:
OperationCreate( const Device & device,
const Partition & partition_orig,
const Partition & partition_new ) ;
void apply_to_visual( std::vector<Partition> & partitions ) ;
void apply_to_visual( PartitionVector & partitions );
private:
void create_description() ;

View File

@ -18,6 +18,8 @@
#define GPARTED_OPERATIONDELETE_H
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -26,14 +28,14 @@ class OperationDelete : public Operation
{
public:
OperationDelete( const Device & device, const Partition & partition_orig ) ;
void apply_to_visual( std::vector<Partition> & partitions ) ;
void apply_to_visual( PartitionVector & partitions );
private:
void create_description() ;
bool merge_operations( const Operation & candidate );
void remove_original_and_adjacent_unallocated( std::vector<Partition> & partitions, int index_orig ) ;
} ;
void remove_original_and_adjacent_unallocated( PartitionVector & partitions, int index_orig );
};
} //GParted

View File

@ -18,6 +18,8 @@
#define GPARTED_OPERATIONFORMAT_H
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -28,8 +30,8 @@ public:
OperationFormat( const Device & device,
const Partition & partition_orig,
const Partition & partition_new ) ;
void apply_to_visual( std::vector<Partition> & partitions ) ;
void apply_to_visual( PartitionVector & partitions );
private:
void create_description() ;

View File

@ -18,6 +18,8 @@
#define GPARTED_OPERATIONLABELFILESYSTEM_H
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -29,7 +31,7 @@ public:
const Partition & partition_orig,
const Partition & partition_new );
void apply_to_visual( std::vector<Partition> & partitions );
void apply_to_visual( PartitionVector & partitions );
private:
void create_description() ;

View File

@ -18,6 +18,8 @@
#define GPARTED_OPERATIONNAMEPARTITION_H
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -29,7 +31,7 @@ public:
const Partition & partition_orig,
const Partition & partition_new );
void apply_to_visual( std::vector<Partition> & partitions );
void apply_to_visual( PartitionVector & partitions );
private:
void create_description();

View File

@ -18,6 +18,8 @@
#define GPARTED_OPERATIONRESIZEMOVE_H
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -28,18 +30,18 @@ public:
OperationResizeMove( const Device & device,
const Partition & partition_orig,
const Partition & partition_new ) ;
void apply_to_visual( std::vector<Partition> & partitions ) ;
void apply_to_visual( PartitionVector & partitions );
private:
void create_description() ;
bool merge_operations( const Operation & candidate );
void apply_normal_to_visual( std::vector<Partition> & partitions ) ;
void apply_extended_to_visual( std::vector<Partition> & partitions ) ;
void remove_adjacent_unallocated( std::vector<Partition> & partitions, int index_orig ) ;
} ;
void apply_normal_to_visual( PartitionVector & partitions );
void apply_extended_to_visual( PartitionVector & partitions );
void remove_adjacent_unallocated( PartitionVector & partitions, int index_orig );
};
} //GParted

View File

@ -140,8 +140,8 @@ public:
bool busy;
std::vector<Glib::ustring> messages ;
std::vector<Glib::ustring> flags ;
std::vector<Partition> logicals ;
PartitionVector logicals;
bool strict_start ; //Indicator if start sector must stay unchanged
Sector free_space_before ; //Free space preceding partition value

View File

@ -18,6 +18,7 @@
#define GPARTED_TREEVIEW_DETAIL_H
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>
@ -35,7 +36,7 @@ class TreeView_Detail : public Gtk::TreeView
{
public:
TreeView_Detail();
void load_partitions( const std::vector<Partition> & partitions ) ;
void load_partitions( const PartitionVector & partitions );
void set_selected( const Partition * partition_ptr );
void clear() ;
@ -45,7 +46,7 @@ public:
sigc::signal< void, unsigned int, unsigned int > signal_popup_menu ;
private:
void load_partitions( const std::vector<Partition> & partitions,
void load_partitions( const PartitionVector & partitions,
bool & mountpoints,
bool & labels,
bool & names,

View File

@ -21,6 +21,7 @@
#include "../include/Device.h"
#include "../include/DrawingAreaVisualDisk.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
#include "../include/TreeView_Detail.h"
#include "../include/GParted_Core.h"
#include "../include/HBoxOperations.h"
@ -191,7 +192,7 @@ private:
//private variables
unsigned int current_device ;
std::vector<Partition> display_partitions; // Copy of current device's partitions with any pending
PartitionVector display_partitions; // Copy of current device's partitions with any pending
// operations applied, as currently being shown in the GUI.
const Partition * selected_partition_ptr; // Pointer to the selected partition. (Alias to element
// in Win_GParted::display_partitions[] vector).

View File

@ -17,19 +17,21 @@
#include "../include/Dialog_Partition_Resize_Move.h"
#include "../include/GParted_Core.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( const FS & fs, const Partition & selected_partition,
const std::vector<Partition> & partitions )
const PartitionVector & partitions )
{
this ->fs = fs ;
set_data( selected_partition, partitions );
}
void Dialog_Partition_Resize_Move::set_data( const Partition & selected_partition,
const std::vector<Partition> & partitions )
const PartitionVector & partitions )
{
GRIP = true ; //prevents on spinbutton_changed from getting activated prematurely
@ -60,7 +62,7 @@ void Dialog_Partition_Resize_Move::set_data( const Partition & selected_partitio
this ->show_all_children() ;
}
void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partition> & partitions )
void Dialog_Partition_Resize_Move::Resize_Move_Normal( const PartitionVector & partitions )
{
//little bit of paranoia ;)
if ( ! new_partition.sector_usage_known() &&
@ -215,7 +217,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
) ;
}
void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Partition> & partitions )
void Dialog_Partition_Resize_Move::Resize_Move_Extended( const PartitionVector & partitions )
{
//calculate total size in MiB's of previous, current and next partition
//first find index of partition

View File

@ -17,6 +17,7 @@
#include "../include/Utils.h"
#include "../include/Dialog_Rescue_Data.h"
#include "../include/Partition.h"
#include <gtkmm/messagedialog.h>
#include <gtkmm/stock.h>

View File

@ -16,6 +16,8 @@
*/
#include "../include/DrawingAreaVisualDisk.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
#define MAIN_BORDER 5
#define BORDER 4
@ -46,8 +48,8 @@ DrawingAreaVisualDisk::DrawingAreaVisualDisk()
set_size_request( -1, HEIGHT ) ;
}
void DrawingAreaVisualDisk::load_partitions( const std::vector<Partition> & partitions, Sector device_length )
void DrawingAreaVisualDisk::load_partitions( const PartitionVector & partitions, Sector device_length )
{
clear() ;
@ -73,8 +75,8 @@ void DrawingAreaVisualDisk::clear()
queue_resize() ;
}
int DrawingAreaVisualDisk::get_total_separator_px( const std::vector<Partition> & partitions )
int DrawingAreaVisualDisk::get_total_separator_px( const PartitionVector & partitions )
{
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
@ -84,9 +86,9 @@ int DrawingAreaVisualDisk::get_total_separator_px( const std::vector<Partition>
return ( partitions .size() -1 ) * SEP ;
}
void DrawingAreaVisualDisk::set_static_data( const std::vector<Partition> & partitions,
std::vector<visual_partition> & visual_partitions,
Sector length )
void DrawingAreaVisualDisk::set_static_data( const PartitionVector & partitions,
std::vector<visual_partition> & visual_partitions,
Sector length )
{
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
{
@ -100,8 +102,8 @@ void DrawingAreaVisualDisk::set_static_data( const std::vector<Partition> & part
get_colormap() ->alloc_color( visual_partitions .back() .color );
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
set_static_data( partitions[ t ] .logicals,
visual_partitions .back() .logicals, partition_length ) ;
set_static_data( partitions[t].logicals,
visual_partitions.back().logicals, partition_length );
else
visual_partitions .back() .pango_layout = create_pango_layout(
partitions[ t ] .get_path() + "\n" + Utils::format_size( partition_length, partitions[ t ] .sector_size ) ) ;

View File

@ -22,6 +22,8 @@
#include "../include/LVM2_PV_Info.h"
#include "../include/Operation.h"
#include "../include/OperationCopy.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
#include "../include/Proc_Partitions_Info.h"
#include "../include/SWRaid_Info.h"
@ -1677,11 +1679,11 @@ void GParted_Core::read_uuid( Partition & partition )
}
void GParted_Core::insert_unallocated( const Glib::ustring & device_path,
std::vector<Partition> & partitions,
Sector start,
Sector end,
Byte_Value sector_size,
bool inside_extended )
PartitionVector & partitions,
Sector start,
Sector end,
Byte_Value sector_size,
bool inside_extended )
{
Partition partition_temp ;
partition_temp.Set_Unallocated( device_path, false, 0LL, 0LL, sector_size, inside_extended );
@ -1731,8 +1733,8 @@ void GParted_Core::insert_unallocated( const Glib::ustring & device_path,
partitions .push_back( partition_temp );
}
}
void GParted_Core::set_mountpoints( std::vector<Partition> & partitions )
void GParted_Core::set_mountpoints( PartitionVector & partitions )
{
#ifndef USE_LIBPARTED_DMRAID
DMRaid dmraid ; //Use cache of dmraid device information
@ -1865,7 +1867,7 @@ bool GParted_Core::is_busy( FILESYSTEM fstype, const Glib::ustring & path )
return busy ;
}
void GParted_Core::set_used_sectors( std::vector<Partition> & partitions, PedDisk* lp_disk )
void GParted_Core::set_used_sectors( PartitionVector & partitions, PedDisk* lp_disk )
{
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
{

View File

@ -14,7 +14,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "../include/Operation.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -22,8 +25,8 @@ namespace GParted
Operation::Operation()
{
}
int Operation::find_index_original( const std::vector<Partition> & partitions )
int Operation::find_index_original( const PartitionVector & partitions )
{
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
if ( partition_original .sector_start >= partitions[ t ] .sector_start &&
@ -35,7 +38,7 @@ int Operation::find_index_original( const std::vector<Partition> & partitions )
// Find the partition in the vector that exactly matches or fully encloses
// this->partition_new. Return vector index or -1 when no match found.
int Operation::find_index_new( const std::vector<Partition> & partitions )
int Operation::find_index_new( const PartitionVector & partitions )
{
for ( unsigned int i = 0 ; i < partitions.size() ; i ++ )
if ( partition_new.sector_start >= partitions[i].sector_start &&
@ -45,7 +48,7 @@ int Operation::find_index_new( const std::vector<Partition> & partitions )
return -1;
}
int Operation::find_index_extended( const std::vector<Partition> & partitions )
int Operation::find_index_extended( const PartitionVector & partitions )
{
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
@ -54,7 +57,8 @@ int Operation::find_index_extended( const std::vector<Partition> & partitions )
return -1 ;
}
void Operation::insert_unallocated( std::vector<Partition> & partitions, Sector start, Sector end, Byte_Value sector_size, bool inside_extended )
void Operation::insert_unallocated( PartitionVector & partitions,
Sector start, Sector end, Byte_Value sector_size, bool inside_extended )
{
Partition UNALLOCATED ;
UNALLOCATED.Set_Unallocated( device.get_path(), false, 0LL, 0LL, sector_size, inside_extended );
@ -108,7 +112,7 @@ void Operation::insert_unallocated( std::vector<Partition> & partitions, Sector
// Visual re-apply this operation, for operations which don't change the partition
// boundaries. Matches this operation's original partition in the vector and substitutes
// it with this operation's new partition.
void Operation::substitute_new( std::vector<Partition> & partitions )
void Operation::substitute_new( PartitionVector & partitions )
{
int index_extended;
int index;
@ -132,7 +136,7 @@ void Operation::substitute_new( std::vector<Partition> & partitions )
}
// Visually re-apply this operation, for operations which create new partitions.
void Operation::insert_new( std::vector<Partition> & partitions )
void Operation::insert_new( PartitionVector & partitions )
{
// Create operations are unique in that they apply to unallocated space. It only
// matters that the new partition being created fits in an unallocated space when

View File

@ -15,6 +15,8 @@
*/
#include "../include/OperationChangeUUID.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -31,7 +33,7 @@ OperationChangeUUID::OperationChangeUUID( const Device & device
this ->partition_new = partition_new ;
}
void OperationChangeUUID::apply_to_visual( std::vector<Partition> & partitions )
void OperationChangeUUID::apply_to_visual( PartitionVector & partitions )
{
substitute_new( partitions );
}

View File

@ -15,6 +15,8 @@
*/
#include "../include/OperationCheck.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -26,8 +28,8 @@ OperationCheck::OperationCheck( const Device & device, const Partition & partiti
this->device = device.get_copy_without_partitions();
partition_original = partition ;
}
void OperationCheck::apply_to_visual( std::vector<Partition> & partitions )
void OperationCheck::apply_to_visual( PartitionVector & partitions )
{
}

View File

@ -16,6 +16,8 @@
*/
#include "../include/OperationCopy.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -35,8 +37,8 @@ OperationCopy::OperationCopy( const Device & device,
this ->partition_new .add_path(
String::ucompose( _("copy of %1"), this ->partition_copied .get_path() ), true ) ;
}
void OperationCopy::apply_to_visual( std::vector<Partition> & partitions )
void OperationCopy::apply_to_visual( PartitionVector & partitions )
{
if ( partition_original.type == TYPE_UNALLOCATED )
// Paste into unallocated space creating new partition

View File

@ -16,6 +16,8 @@
*/
#include "../include/OperationCreate.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -30,8 +32,8 @@ OperationCreate::OperationCreate( const Device & device,
this ->partition_original = partition_orig ;
this ->partition_new = partition_new ;
}
void OperationCreate::apply_to_visual( std::vector<Partition> & partitions )
void OperationCreate::apply_to_visual( PartitionVector & partitions )
{
insert_new( partitions );
}

View File

@ -16,6 +16,8 @@
*/
#include "../include/OperationDelete.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -27,8 +29,8 @@ OperationDelete::OperationDelete( const Device & device, const Partition & parti
this->device = device.get_copy_without_partitions();
this ->partition_original = partition_orig ;
}
void OperationDelete::apply_to_visual( std::vector<Partition> & partitions )
void OperationDelete::apply_to_visual( PartitionVector & partitions )
{
int index_extended;
int index;
@ -96,7 +98,7 @@ bool OperationDelete::merge_operations( const Operation & candidate )
return false; // Can't merge with an already deleted partition
}
void OperationDelete::remove_original_and_adjacent_unallocated( std::vector<Partition> & partitions, int index_orig )
void OperationDelete::remove_original_and_adjacent_unallocated( PartitionVector & partitions, int index_orig )
{
//remove unallocated space following the original partition
if ( index_orig +1 < static_cast<int>( partitions .size() ) &&

View File

@ -15,6 +15,8 @@
*/
#include "../include/OperationFormat.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -29,8 +31,8 @@ OperationFormat::OperationFormat( const Device & device,
this ->partition_original = partition_orig ;
this ->partition_new = partition_new ;
}
void OperationFormat::apply_to_visual( std::vector<Partition> & partitions )
void OperationFormat::apply_to_visual( PartitionVector & partitions )
{
if ( partition_original.whole_device && partition_new.filesystem == FS_CLEARED )
{

View File

@ -15,6 +15,8 @@
*/
#include "../include/OperationLabelFileSystem.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -30,7 +32,7 @@ OperationLabelFileSystem::OperationLabelFileSystem( const Device & device,
this ->partition_new = partition_new ;
}
void OperationLabelFileSystem::apply_to_visual( std::vector<Partition> & partitions )
void OperationLabelFileSystem::apply_to_visual( PartitionVector & partitions )
{
substitute_new( partitions );
}

View File

@ -15,6 +15,8 @@
*/
#include "../include/OperationNamePartition.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -30,7 +32,7 @@ OperationNamePartition::OperationNamePartition( const Device & device,
this->partition_new = partition_new;
}
void OperationNamePartition::apply_to_visual( std::vector<Partition> & partitions )
void OperationNamePartition::apply_to_visual( PartitionVector & partitions )
{
substitute_new( partitions );
}

View File

@ -16,6 +16,8 @@
*/
#include "../include/OperationResizeMove.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -30,8 +32,8 @@ OperationResizeMove::OperationResizeMove( const Device & device,
this ->partition_original = partition_orig ;
this ->partition_new = partition_new ;
}
void OperationResizeMove::apply_to_visual( std::vector<Partition> & partitions )
void OperationResizeMove::apply_to_visual( PartitionVector & partitions )
{
if ( partition_original .type == GParted::TYPE_EXTENDED )
apply_extended_to_visual( partitions ) ;
@ -119,7 +121,7 @@ void OperationResizeMove::create_description()
Utils::format_size( partition_new .get_sector_length(), partition_new .sector_size ) ) ;
}
void OperationResizeMove::apply_normal_to_visual( std::vector<Partition> & partitions )
void OperationResizeMove::apply_normal_to_visual( PartitionVector & partitions )
{
int index_extended;
int index;
@ -159,7 +161,7 @@ void OperationResizeMove::apply_normal_to_visual( std::vector<Partition> & parti
}
}
void OperationResizeMove::apply_extended_to_visual( std::vector<Partition> & partitions )
void OperationResizeMove::apply_extended_to_visual( PartitionVector & partitions )
{
int index_extended;
@ -201,7 +203,7 @@ void OperationResizeMove::apply_extended_to_visual( std::vector<Partition> & par
}
}
void OperationResizeMove::remove_adjacent_unallocated( std::vector<Partition> & partitions, int index_orig )
void OperationResizeMove::remove_adjacent_unallocated( PartitionVector & partitions, int index_orig )
{
//remove unallocated space following the original partition
if ( index_orig +1 < static_cast<int>( partitions .size() ) &&

View File

@ -16,6 +16,8 @@
*/
#include "../include/TreeView_Detail.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
namespace GParted
{
@ -84,7 +86,7 @@ TreeView_Detail::TreeView_Detail()
}
}
void TreeView_Detail::load_partitions( const std::vector<Partition> & partitions )
void TreeView_Detail::load_partitions( const PartitionVector & partitions )
{
bool mountpoints = false, labels = false, names = false;
treestore_detail ->clear() ;
@ -111,7 +113,7 @@ void TreeView_Detail::clear()
treestore_detail ->clear() ;
}
void TreeView_Detail::load_partitions( const std::vector<Partition> & partitions,
void TreeView_Detail::load_partitions( const PartitionVector & partitions,
bool & mountpoints,
bool & labels,
bool & names,

View File

@ -36,6 +36,8 @@
#include "../include/OperationChangeUUID.h"
#include "../include/OperationLabelFileSystem.h"
#include "../include/OperationNamePartition.h"
#include "../include/Partition.h"
#include "../include/PartitionVector.h"
#include "../include/LVM2_PV_Info.h"
#include "../config.h"
@ -830,7 +832,7 @@ void Win_GParted::Refresh_Visual()
// (2) Takes a copy of the partitions for the device currently being shown in the
// GUI and visually applies pending operations.
//
// Data owner: std::vector<Partition> Win_GParted::display_partitions
// Data owner: PartitionVector Win_GParted::display_partitions
// Lifetime: Valid until the next call to Refresh_Visual().
// Function: Refresh_Visual()
//
@ -1708,7 +1710,7 @@ void Win_GParted::activate_resize()
g_assert( selected_partition_ptr != NULL ); // Bug: Partition callback without a selected partition
g_assert( valid_display_partition_ptr( selected_partition_ptr ) ); // Bug: Not pointing at a valid display partition object
std::vector<Partition> * display_partitions_ptr = &display_partitions;
PartitionVector * display_partitions_ptr = &display_partitions;
if ( selected_partition_ptr->type == TYPE_LOGICAL )
{
unsigned int ext = 0 ;