2004-09-19 14:24:53 -06:00
|
|
|
/* Copyright (C) 2004 Bart
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OPERATION
|
|
|
|
#define OPERATION
|
|
|
|
|
|
|
|
#include "../include/Device.h"
|
2006-03-24 12:08:41 -07:00
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
|
|
|
enum OperationType {
|
2004-10-01 15:09:19 -06:00
|
|
|
DELETE = 0,
|
|
|
|
CREATE = 1,
|
|
|
|
RESIZE_MOVE = 2,
|
2006-01-02 08:18:29 -07:00
|
|
|
FORMAT = 3,
|
2004-10-01 15:09:19 -06:00
|
|
|
COPY = 4
|
2004-09-19 14:24:53 -06:00
|
|
|
};
|
|
|
|
|
2006-01-19 12:15:15 -07:00
|
|
|
struct OperationDetails
|
|
|
|
{
|
|
|
|
enum Status {
|
|
|
|
NONE = -1,
|
|
|
|
EXECUTE = 0,
|
|
|
|
SUCCES = 1,
|
|
|
|
ERROR = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
OperationDetails()
|
|
|
|
{
|
2006-02-07 08:17:44 -07:00
|
|
|
status = NONE ;
|
2006-01-19 12:15:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
OperationDetails( const Glib::ustring & description, Status status = EXECUTE )
|
|
|
|
{
|
|
|
|
this ->description = description ;
|
|
|
|
this ->status = status ;
|
|
|
|
}
|
|
|
|
|
|
|
|
Glib::ustring description ;
|
|
|
|
Status status ;
|
|
|
|
|
|
|
|
std::vector<OperationDetails> sub_details ;
|
|
|
|
};
|
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
class Operation
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2006-01-19 12:15:15 -07:00
|
|
|
Operation() ;
|
2006-03-24 12:08:41 -07:00
|
|
|
virtual ~Operation() {}
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2006-03-24 12:08:41 -07:00
|
|
|
virtual void apply_to_visual( std::vector<Partition> & partitions ) = 0 ;
|
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
//public variables
|
2004-12-27 05:08:01 -07:00
|
|
|
Device device ;
|
2006-03-24 12:08:41 -07:00
|
|
|
OperationType type ;
|
|
|
|
Partition partition_original ;
|
|
|
|
Partition partition_new ;
|
|
|
|
|
|
|
|
Glib::RefPtr<Gdk::Pixbuf> icon ;
|
|
|
|
Glib::ustring description ;
|
fixed issues with copying (see also #335004) cleanups + added FIXME added
* include/GParted_Core.h,
src/GParted_Core.cc,
src/Win_GParted.cc,
src/ext2.cc,
src/ext3.cc,
src/fat16.cc,
src/fat32.cc,
src/jfs.cc,
src/ntfs.cc,
src/reiserfs.cc: fixed issues with copying (see also #335004)
* include/Operation.h,
src/Operation.cc: cleanups + added FIXME
* include/Partition.h,
src/Partition.cc: added clear_mountpoints()
* src/DrawingAreaVisualDisk.cc: added FIXME
2006-03-19 08:30:20 -07:00
|
|
|
|
2006-01-19 12:15:15 -07:00
|
|
|
OperationDetails operation_details ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2006-03-24 12:08:41 -07:00
|
|
|
protected:
|
|
|
|
int find_index_original( 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, bool inside_extended );
|
2004-11-06 04:55:03 -07:00
|
|
|
|
2006-03-24 12:08:41 -07:00
|
|
|
virtual void create_description() = 0 ;
|
|
|
|
|
|
|
|
int index ;
|
|
|
|
int index_extended ;
|
2004-09-19 14:24:53 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
} //GParted
|
|
|
|
|
|
|
|
#endif //OPERATION
|