fixed Pango markup problems in operationdetails restructured

* fixed Pango markup problems in operationdetails
* restructured OperationDetail
* renamed some enums for improved readability of the source
This commit is contained in:
Bart Hakvoort 2006-07-29 08:27:28 +00:00
parent 35e8921aa4
commit d52b0286c9
38 changed files with 537 additions and 446 deletions

View File

@ -1,3 +1,9 @@
2006-07-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
* fixed Pango markup problems in operationdetails
* restructured OperationDetail
* renamed some enums for improved readability of the source
2006-07-23 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/FileSystem.h,

View File

@ -43,14 +43,14 @@ public:
sigc::signal< bool, Operation * > signal_apply_operation ;
private:
void update_operation_details( const Gtk::TreeRow & treerow, const OperationDetails & operation_details ) ;
void update_operation_details( const Gtk::TreeRow & treerow, const OperationDetail & operation_detail ) ;
void on_signal_show() ;
void on_expander_changed() ;
void on_cell_data_description( Gtk::CellRenderer * renderer, const Gtk::TreeModel::iterator & iter) ;
static void *static_pthread_apply_operation( void * p_dialog_progress ) ;
void on_cancel() ;
void on_save() ;
void echo_operation_details( const OperationDetails & operation_details, std::ofstream & out ) ;
void echo_operation_details( const OperationDetail & operation_detail, std::ofstream & out ) ;
void on_response( int response_id ) ;
bool on_delete_event( GdkEventAny * event ) ;
@ -75,7 +75,7 @@ private:
Gtk::TreeModelColumn<Glib::ustring> operation_description;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > operation_icon;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > status_icon;
Gtk::TreeModelColumn<OperationDetails::Status> hidden_status ;
Gtk::TreeModelColumn<OperationDetailStatus> hidden_status ;
treeview_operations_Columns()
{

View File

@ -35,17 +35,17 @@ public:
virtual FS get_filesystem_support() = 0 ;
virtual void Set_Used_Sectors( Partition & partition ) = 0 ;
virtual bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) = 0 ;
virtual bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) = 0 ;
virtual bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) = 0 ;
virtual bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) = 0 ;
virtual bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) = 0 ;
std::vector<OperationDetail> & operation_details ) = 0 ;
virtual bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) = 0 ;
protected:
int execute_command( const Glib::ustring & command, std::vector<OperationDetails> & operation_details ) ;
int execute_command( const Glib::ustring & command, std::vector<OperationDetail> & operation_details ) ;
//those are used in several places..
Glib::ustring output, error ;

View File

@ -74,60 +74,60 @@ private:
//operationstuff...
bool create( const Device & device,
Partition & new_partition,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool create_partition( Partition & new_partition,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
Sector min_size = 0 ) ;
bool create_filesystem( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
bool create_filesystem( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
bool format( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
bool format( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
bool Delete( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
bool Delete( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
bool resize_move( const Device & device,
const Partition & partition_old,
Partition & partition_new,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool move( const Device & device,
const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool move_filesystem( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool move_filesystem_using_gparted( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool resize_move_filesystem_using_libparted( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool resize( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_detail ) ;
std::vector<OperationDetail> & operation_detail ) ;
bool resize_move_partition( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool resize_filesystem( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool maximize_filesystem( const Partition & partition,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool copy( const Partition & partition_src,
Partition & partition_dest,
Sector min_size,
Sector block_size,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool copy_filesystem( const Partition & partition_src,
const Partition & partition_dest,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
Sector block_size ) ;
bool check_repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
bool check_repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
bool set_partition_type( const Partition & partition,
std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool copy_block( PedDevice * lp_device_src,
PedDevice * lp_device_dst,
@ -137,7 +137,7 @@ private:
Glib::ustring & error_message ) ;
bool calculate_exact_geom( const Partition & partition_old,
Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
Sector min_size = -1 ) ;
void set_proper_filesystem( const FILESYSTEM & filesystem ) ;
bool wait_for_node( const Glib::ustring & node ) ;

View File

@ -20,6 +20,7 @@ EXTRA_DIST = \
OperationCopy.h \
OperationCreate.h \
OperationDelete.h \
OperationDetail.cc \
OperationFormat.h \
OperationResizeMove.h \
Partition.h \

View File

@ -19,10 +19,12 @@
#define OPERATION
#include "../include/Device.h"
#include "../include/OperationDetail.h"
namespace GParted
{
//FIXME: enumvalues should get more descriptive names e.g. TYPE_DELETE...
//FIXME: stop using GParted:: in front of our own enums.. it's not necessary and clutters the code
enum OperationType {
DELETE = 0,
CREATE = 1,
@ -31,38 +33,6 @@ enum OperationType {
COPY = 4
};
struct OperationDetails
{
enum Status {
NONE = -1,
EXECUTE = 0,
SUCCES = 1,
ERROR = 2,
N_A = 3
};
OperationDetails()
{
status = NONE ;
fraction = -1 ;
}
OperationDetails( const Glib::ustring & description, Status status = EXECUTE )
{
this ->description = description ;
this ->status = status ;
fraction = -1 ;
}
Glib::ustring description ;
Status status ;
double fraction ;
Glib::ustring progress_text ;
std::vector<OperationDetails> sub_details ;
};
class Operation
{
@ -82,7 +52,7 @@ public:
Glib::RefPtr<Gdk::Pixbuf> icon ;
Glib::ustring description ;
OperationDetails operation_details ;
OperationDetail operation_detail ;
protected:
int find_index_original( const std::vector<Partition> & partitions ) ;

68
include/OperationDetail.h Normal file
View File

@ -0,0 +1,68 @@
/* Copyright (C) 2004 Bart 'plors' Hakvoort
*
* 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 OPERATIONDETAIL
#define OPERATIONDETAIL
#include <glibmm/ustring.h>
#include <glibmm/markup.h>
#include <vector>
namespace GParted
{
enum OperationDetailStatus {
STATUS_NONE = 0,
STATUS_EXECUTE = 1,
STATUS_SUCCES = 2,
STATUS_ERROR = 3,
STATUS_N_A = 4
};
enum Font {
FONT_NORMAL = 0,
FONT_BOLD = 1,
FONT_ITALIC = 2,
FONT_BOLD_ITALIC = 3
} ;
class OperationDetail
{
public:
OperationDetail() ;
OperationDetail( const Glib::ustring & description,
OperationDetailStatus status = STATUS_EXECUTE,
Font font = FONT_NORMAL ) ;
void set_description( const Glib::ustring & description, Font font = FONT_NORMAL ) ;
Glib::ustring get_description() const ;
OperationDetailStatus status ;
double fraction ;
Glib::ustring progress_text ;
std::vector<OperationDetail> sub_details ;
private:
Glib::ustring description ;
};
} //GParted
#endif //OPERATIONDETAIL

View File

@ -27,16 +27,16 @@ namespace GParted
class ext2 : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -27,16 +27,16 @@ namespace GParted
class ext3 : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};

View File

@ -27,16 +27,16 @@ namespace GParted
class fat16 : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -27,16 +27,16 @@ namespace GParted
class fat32 : public FileSystem
{
public:
FS get_filesystem_support( );
FS get_filesystem_support();
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -27,16 +27,16 @@ namespace GParted
class hfs : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -27,16 +27,16 @@ namespace GParted
class hfsplus : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -27,16 +27,16 @@ namespace GParted
class jfs : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -27,16 +27,16 @@ namespace GParted
class linux_swap : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -27,16 +27,16 @@ namespace GParted
class ntfs : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -27,16 +27,16 @@ namespace GParted
class reiser4 : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -27,16 +27,16 @@ namespace GParted
class reiserfs : public FileSystem
{
public:
FS get_filesystem_support( ) ;
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -29,14 +29,14 @@ class ufs : public FileSystem
public:
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -29,14 +29,14 @@ class xfs : public FileSystem
public:
FS get_filesystem_support() ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details ) ;
bool Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details ) ;
bool Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) ;
std::vector<OperationDetail> & operation_details ) ;
bool Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details ) ;
};
} //GParted

View File

@ -75,13 +75,13 @@ Dialog_Progress::Dialog_Progress( const std::vector<Operation *> & operations )
//fill 'er up
for ( unsigned int t = 0 ; t < operations .size() ; t++ )
{
this ->operations[ t ] ->operation_details .description = "<b>" + operations[ t ] ->description + "</b>" ;
this ->operations[ t ] ->operation_detail .set_description( operations[ t ] ->description, FONT_BOLD ) ;
treerow = *( treestore_operations ->append() );
treerow[ treeview_operations_columns .operation_icon ] = operations[ t ] ->icon ;
treerow[ treeview_operations_columns .operation_description ] =
this ->operations[ t ] ->operation_details .description ;
treerow[ treeview_operations_columns .hidden_status ] = OperationDetails::NONE ;
this ->operations[ t ] ->operation_detail .get_description() ;
treerow[ treeview_operations_columns .hidden_status ] = STATUS_NONE ;
}
treeview_operations .get_column( 1 ) ->set_expand( true ) ;
@ -109,45 +109,46 @@ Dialog_Progress::Dialog_Progress( const std::vector<Operation *> & operations )
}
void Dialog_Progress::update_operation_details( const Gtk::TreeRow & treerow,
const OperationDetails & operation_details )
const OperationDetail & operation_detail )
{
//append new rows (if any)
for ( unsigned int t = treerow .children() .size() ; t < operation_details .sub_details .size() ; t++ )
for ( unsigned int t = treerow .children() .size() ; t < operation_detail .sub_details .size() ; t++ )
{
Gtk::TreeRow treerow_child = *( treestore_operations ->append( treerow .children() ) ) ;
//FIXME, consider adding a textwidget to the tree for storing the text. simply storing text directly in the tree
//doesn't work with HUGE amounts of text.
treerow_child[ treeview_operations_columns .operation_description ] =
operation_detail .sub_details[ t ] .get_description() ;
treerow_child[ treeview_operations_columns .operation_description ] =
operation_details .sub_details[ t ] .description ;
treerow_child[ treeview_operations_columns .hidden_status ] = OperationDetails::NONE ;
treerow_child[ treeview_operations_columns .hidden_status ] = STATUS_NONE ;
}
//check status and update if necessary
if ( operation_details .status != treerow[ treeview_operations_columns .hidden_status ] )
if ( operation_detail .status != treerow[ treeview_operations_columns .hidden_status ] )
{
treerow[ treeview_operations_columns .hidden_status ] = operation_details .status ;
treerow[ treeview_operations_columns .hidden_status ] = operation_detail .status ;
switch ( operation_details .status )
switch ( operation_detail .status )
{
case OperationDetails::EXECUTE:
case STATUS_EXECUTE:
treerow[ treeview_operations_columns .status_icon ] = icon_execute ;
break ;
case OperationDetails::SUCCES:
case STATUS_SUCCES:
treerow[ treeview_operations_columns .status_icon ] = icon_succes ;
break ;
case OperationDetails::ERROR:
case STATUS_ERROR:
treerow[ treeview_operations_columns .status_icon ] = icon_error ;
break ;
case OperationDetails::N_A:
case STATUS_N_A:
treerow[ treeview_operations_columns .status_icon ] = icon_n_a ;
break ;
default :
treerow[ treeview_operations_columns .hidden_status ] = OperationDetails::NONE ;
treerow[ treeview_operations_columns .hidden_status ] = STATUS_NONE ;
break ;
}
}
@ -156,22 +157,22 @@ void Dialog_Progress::update_operation_details( const Gtk::TreeRow & treerow,
//FIXME: it feels quite inefficient to do this for every row, maybe we should add a new status which indicates
//this row may be changed and should be checked...(otoh, if/when we start displaying the output of the command
//in realtime almost every row is going to need this and such a status might become useless...)
if ( operation_details .description != treerow[ treeview_operations_columns .operation_description ] )
treerow[ treeview_operations_columns .operation_description ] = operation_details .description ;
if ( operation_detail .get_description() != treerow[ treeview_operations_columns .operation_description ] )
treerow[ treeview_operations_columns .operation_description ] = operation_detail .get_description() ;
if ( operation_details .fraction >= 0 )
if ( operation_detail .fraction >= 0 )
{
pulse = false ;
progressbar_current .set_fraction( operation_details .fraction ) ;
progressbar_current .set_text( operation_details .progress_text ) ;
progressbar_current .set_fraction( operation_detail .fraction ) ;
progressbar_current .set_text( operation_detail .progress_text ) ;
}
else
pulse = true ;
//and update the children.. (since sometimes freshly added treerows are not appended yet to the children() list
//we also check if t < treerow .children() .size())
for ( unsigned int t = 0 ; t < operation_details .sub_details .size() && t < treerow .children() .size() ; t++ )
update_operation_details( treerow .children()[ t ], operation_details .sub_details[ t ] ) ;
for ( unsigned int t = 0 ; t < operation_detail .sub_details .size() && t < treerow .children() .size() ; t++ )
update_operation_details( treerow .children()[ t ], operation_detail .sub_details[ t ] ) ;
}
void Dialog_Progress::on_signal_show()
@ -186,8 +187,8 @@ void Dialog_Progress::on_signal_show()
treerow = treestore_operations ->children()[ t ] ;
//set status to 'execute'
operations[ t ] ->operation_details .status = OperationDetails::EXECUTE ;
update_operation_details( treerow, operations[ t ] ->operation_details ) ;
operations[ t ] ->operation_detail .status = STATUS_EXECUTE ;
update_operation_details( treerow, operations[ t ] ->operation_detail ) ;
//set focus...
treeview_operations .set_cursor( static_cast<Gtk::TreePath>( treerow ) ) ;
@ -201,11 +202,11 @@ void Dialog_Progress::on_signal_show()
{
if ( ms >= 200 )
{
update_operation_details( treerow, operations[ t ] ->operation_details ) ;
if ( operations[ t ] ->operation_details .sub_details .size() > 0 )
update_operation_details( treerow, operations[ t ] ->operation_detail ) ;
if ( operations[ t ] ->operation_detail .sub_details .size() > 0 )
label_current_sub .set_markup(
"<i>" +
operations[ t ] ->operation_details .sub_details .back() .description +
operations[ t ] ->operation_detail .sub_details .back() .get_description() +
"</i>\n" ) ;
ms = 0 ;
}
@ -220,9 +221,8 @@ void Dialog_Progress::on_signal_show()
}
//set status (succes/error) for this operation
operations[ t ] ->operation_details .status =
succes ? OperationDetails::SUCCES : OperationDetails::ERROR ;
update_operation_details( treerow, operations[ t ] ->operation_details ) ;
operations[ t ] ->operation_detail .status = succes ? STATUS_SUCCES : STATUS_ERROR ;
update_operation_details( treerow, operations[ t ] ->operation_detail ) ;
}
//add save button
@ -283,7 +283,7 @@ void Dialog_Progress::on_expander_changed()
}
void Dialog_Progress::on_cell_data_description( Gtk::CellRenderer * renderer, const Gtk::TreeModel::iterator & iter )
{//FIXME: markup tags in the text should be escaped (e.g. <device> will interfere with the real tags)
{
dynamic_cast<Gtk::CellRendererText *>( renderer ) ->property_markup() =
static_cast<Gtk::TreeRow>( *iter )[ treeview_operations_columns .operation_description ] ;
}
@ -340,7 +340,7 @@ void Dialog_Progress::on_save()
out << "GParted " << VERSION << "<BR><BR>" << std::endl ;
for ( unsigned int t = 0 ; t < operations .size() ; t++ )
{
echo_operation_details( operations[ t ] ->operation_details, out ) ;
echo_operation_details( operations[ t ] ->operation_detail, out ) ;
out << "<BR>========================================<BR><BR>" << std::endl ;
}
@ -349,12 +349,12 @@ void Dialog_Progress::on_save()
}
}
void Dialog_Progress::echo_operation_details( const OperationDetails & operation_details, std::ofstream & out )
void Dialog_Progress::echo_operation_details( const OperationDetail & operation_detail, std::ofstream & out )
{
//replace '\n' with '<br>'
Glib::ustring temp = operation_details .description ;
Glib::ustring temp = operation_detail .get_description() ;
for ( unsigned int index = temp .find( "\n" ) ; index < temp .length() ; index = temp .find( "\n" ) )
temp .replace( index, 1, "<BR>" ) ;
temp .replace( index, 1, "<BR />" ) ;
//and export everything to some kind of html...
out << "<TABLE border=0>" << std::endl ;
@ -363,18 +363,18 @@ void Dialog_Progress::echo_operation_details( const OperationDetails & operation
out << temp ;
//show status...
if ( operation_details .status != OperationDetails::NONE )
if ( operation_detail .status != STATUS_NONE )
{
out << "&nbsp;&nbsp;&nbsp;&nbsp;" ;
switch ( operation_details .status )
switch ( operation_detail .status )
{
case OperationDetails::EXECUTE:
case STATUS_EXECUTE:
out << "( EXECUTING )" ;
break ;
case OperationDetails::SUCCES:
case STATUS_SUCCES:
out << "( SUCCES )" ;
break ;
case OperationDetails::ERROR:
case STATUS_ERROR:
out << "( ERROR )" ;
break ;
@ -387,14 +387,14 @@ void Dialog_Progress::echo_operation_details( const OperationDetails & operation
out << "</TD>" << std::endl ;
out << "</TR>" << std::endl ;
if ( operation_details .sub_details. size() )
if ( operation_detail .sub_details. size() )
{
out << "<TR>" << std::endl ;
out << "<TD>&nbsp;&nbsp;&nbsp;&nbsp;</TD>" << std::endl ;
out << "<TD>" << std::endl ;
for ( unsigned int t = 0 ; t < operation_details .sub_details .size() ; t++ )
echo_operation_details( operation_details .sub_details[ t ], out ) ;
for ( unsigned int t = 0 ; t < operation_detail .sub_details .size() ; t++ )
echo_operation_details( operation_detail .sub_details[ t ], out ) ;
out << "</TD>" << std::endl ;
out << "</TR>" << std::endl ;

View File

@ -25,19 +25,17 @@ FileSystem::FileSystem()
{
}
int FileSystem::execute_command( const Glib::ustring & command, std::vector<OperationDetails> & operation_details )
int FileSystem::execute_command( const Glib::ustring & command, std::vector<OperationDetail> & operation_details )
{
operation_details .push_back( OperationDetails( "<b><i>" + command + "</i></b>", OperationDetails::NONE ) ) ;
operation_details .push_back( OperationDetail( command, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
int exit_status = Utils::execute_command( command, output, error ) ;
if ( ! output .empty() )
operation_details .back() .sub_details .push_back(
OperationDetails( "<i>" + output + "</i>", OperationDetails::NONE ) ) ;
operation_details .back() .sub_details .push_back( OperationDetail( output, STATUS_NONE, FONT_ITALIC ) ) ;
if ( ! error .empty() )
operation_details .back() .sub_details .push_back(
OperationDetails( "<i>" + error + "</i>", OperationDetails::NONE ) ) ;
operation_details .back() .sub_details .push_back( OperationDetail( error, STATUS_NONE, FONT_ITALIC ) ) ;
return exit_status ;
}

View File

@ -286,25 +286,25 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
switch ( operation ->type )
{
case DELETE:
return Delete( operation ->partition_original, operation ->operation_details .sub_details ) ;
return Delete( operation ->partition_original, operation ->operation_detail .sub_details ) ;
case CREATE:
return create( operation ->device,
operation ->partition_new,
operation ->operation_details .sub_details ) ;
operation ->operation_detail .sub_details ) ;
case RESIZE_MOVE:
return resize_move( operation ->device,
operation ->partition_original,
operation ->partition_new,
operation ->operation_details .sub_details ) ;
operation ->operation_detail .sub_details ) ;
case FORMAT:
return format( operation ->partition_new, operation ->operation_details .sub_details ) ;
return format( operation ->partition_new, operation ->operation_detail .sub_details ) ;
case COPY:
operation ->partition_new .add_path( operation ->partition_original .get_path(), true ) ;
return copy( static_cast<OperationCopy*>( operation ) ->partition_copied,
operation ->partition_new,
static_cast<OperationCopy*>( operation ) ->partition_copied .get_length(),
static_cast<OperationCopy*>( operation ) ->block_size,
operation ->operation_details .sub_details ) ;
operation ->operation_detail .sub_details ) ;
}
return false ;
@ -881,7 +881,7 @@ void GParted_Core::set_flags( Partition & partition )
bool GParted_Core::create( const Device & device,
Partition & new_partition,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
if ( new_partition .type == GParted::TYPE_EXTENDED )
@ -901,10 +901,10 @@ bool GParted_Core::create( const Device & device,
}
bool GParted_Core::create_partition( Partition & new_partition,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
Sector min_size )
{
operation_details .push_back( OperationDetails( _("create empty partition") ) ) ;
operation_details .push_back( OperationDetail( _("create empty partition") ) ) ;
new_partition .partition_number = 0 ;
ped_error .clear() ;
@ -972,16 +972,15 @@ bool GParted_Core::create_partition( Partition & new_partition,
new_partition .sector_start = lp_partition ->geom .start ;
new_partition .sector_end = lp_partition ->geom .end ;
operation_details .back() .sub_details .push_back( OperationDetails(
"<i>" +
operation_details .back() .sub_details .push_back( OperationDetail(
String::ucompose( _("path: %1"), new_partition .get_path() ) + "\n" +
String::ucompose( _("start: %1"), new_partition .sector_start ) + "\n" +
String::ucompose( _("end: %1"), new_partition .sector_end ) + "\n" +
String::ucompose( _("size: %1 (%2)"),
new_partition .get_length(),
Utils::format_size( new_partition .get_length() ) ) +
"</i>",
OperationDetails::NONE ) ) ;
Utils::format_size( new_partition .get_length() ) ),
STATUS_NONE,
FONT_ITALIC ) ) ;
}
ped_constraint_destroy( constraint );
@ -1002,7 +1001,7 @@ bool GParted_Core::create_partition( Partition & new_partition,
)
)
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
return true ;
}
@ -1010,17 +1009,17 @@ bool GParted_Core::create_partition( Partition & new_partition,
{
if ( ! ped_error .empty() )
operation_details .back() .sub_details .push_back(
OperationDetails( "<i>" + ped_error + "</i>", OperationDetails::NONE ) ) ;
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
return false ;
}
}
bool GParted_Core::create_filesystem( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool GParted_Core::create_filesystem( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
operation_details .push_back( OperationDetails( String::ucompose(
operation_details .push_back( OperationDetail( String::ucompose(
_("create new %1 filesystem"),
Utils::get_filesystem_string( partition .filesystem ) ) ) ) ;
@ -1028,17 +1027,17 @@ bool GParted_Core::create_filesystem( const Partition & partition, std::vector<O
if ( p_filesystem && p_filesystem ->Create( partition, operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
return true ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
return false ;
}
}
bool GParted_Core::format( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool GParted_Core::format( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
//remove all filesystem signatures...
erase_filesystem_signatures( partition ) ;
@ -1047,7 +1046,7 @@ bool GParted_Core::format( const Partition & partition, std::vector<OperationDet
create_filesystem( partition, operation_details ) ;
}
bool GParted_Core::Delete( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool GParted_Core::Delete( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
bool return_value = false ;
@ -1072,7 +1071,7 @@ bool GParted_Core::Delete( const Partition & partition, std::vector<OperationDet
bool GParted_Core::resize_move( const Device & device,
const Partition & partition_old,
Partition & partition_new,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
if ( calculate_exact_geom( partition_old, partition_new, operation_details ) )
{
@ -1116,7 +1115,7 @@ bool GParted_Core::resize_move( const Device & device,
bool GParted_Core::move( const Device & device,
const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return check_repair( partition_old, operation_details ) &&
move_filesystem( partition_old, partition_new, operation_details ) &&
@ -1129,23 +1128,21 @@ bool GParted_Core::move( const Device & device,
bool GParted_Core::move_filesystem( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
if ( partition_new .sector_start < partition_old .sector_start )
operation_details .push_back( OperationDetails( _("move filesystem to the left") ) ) ;
operation_details .push_back( OperationDetail( _("move filesystem to the left") ) ) ;
else if ( partition_new .sector_start > partition_old .sector_start )
operation_details .push_back( OperationDetails( _("move filesystem to the right") ) ) ;
operation_details .push_back( OperationDetail( _("move filesystem to the right") ) ) ;
else
{
operation_details .push_back( OperationDetails( _("move filesystem") ) ) ;
operation_details .push_back( OperationDetail( _("move filesystem") ) ) ;
operation_details .back() .sub_details .push_back(
OperationDetails(
Glib::ustring( "<i>" ) +
_("new and old filesystem have the same positition. skipping this operation") +
Glib::ustring( "</i>" ),
OperationDetails::NONE ) ) ;
OperationDetail( _("new and old filesystem have the same positition. skipping this operation"),
STATUS_NONE,
FONT_ITALIC ) ) ;
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
return true ;
}
@ -1168,20 +1165,19 @@ bool GParted_Core::move_filesystem( const Partition & partition_old,
break ;
}
operation_details .back() .status = succes ? OperationDetails::SUCCES : OperationDetails::ERROR ;
operation_details .back() .status = succes ? STATUS_SUCCES : STATUS_ERROR ;
return succes ;
}
bool GParted_Core::move_filesystem_using_gparted( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
operation_details .push_back(
OperationDetails( _("using internal algorithm"), OperationDetails::NONE ) ) ;
operation_details .push_back( OperationDetail( _("using internal algorithm"), STATUS_NONE ) ) ;
bool succes = true ; //FIXME: default to true is too dangerous, just image opening the device fails and this function
//return true. then the partition will be moved and the result would be a disaster.
bool succes = true ; //FIXME: default to true is too dangerous, just imagine opening the device fails and this function
//returns true. then the partition will be moved and the result would be a disaster.
if ( open_device_and_disk( partition_old .device_path ) )
{
//do the move..
@ -1193,8 +1189,7 @@ bool GParted_Core::move_filesystem_using_gparted( const Partition & partition_ol
ped_device_sync( lp_device ) ;
//add an empty sub which we will constantly update in the loop
operation_details .push_back(
OperationDetails( "", OperationDetails::NONE ) ) ;
operation_details .push_back( OperationDetail( "", STATUS_NONE ) ) ;
if ( partition_new .sector_start < partition_old .sector_start ) //move to the left
{
@ -1219,8 +1214,9 @@ bool GParted_Core::move_filesystem_using_gparted( const Partition & partition_ol
Utils::format_size( t +1 ),
Utils::format_size( partition_old .get_length() ) ) ;
operation_details .back() .description =
"<i>" + operation_details .back() .progress_text + "</i>" ;
operation_details .back() .set_description(
operation_details .back() .progress_text,
FONT_ITALIC ) ;
operation_details .back() .fraction =
t / static_cast<double>( partition_old .get_length() ) ;
@ -1265,8 +1261,9 @@ bool GParted_Core::move_filesystem_using_gparted( const Partition & partition_ol
Utils::format_size( t +1 ),
Utils::format_size( partition_old .get_length() ) ) ;
operation_details .back() .description =
"<i>" + operation_details .back() .progress_text + "</i>" ;
operation_details .back() .set_description(
operation_details .back() .progress_text,
FONT_ITALIC ) ;
operation_details .back() .fraction =
t / static_cast<double>( partition_old .get_length() ) ;
@ -1289,12 +1286,11 @@ bool GParted_Core::move_filesystem_using_gparted( const Partition & partition_ol
//final description
//FIXME: this description doesn't have to be correct, in case of an error we should display how
//much data really has been moved...
operation_details .back() .description =
"<i>" +
operation_details .back() .set_description(
String::ucompose( _("%1 of %2 moved"),
Utils::format_size( partition_old .get_length() ),
Utils::format_size( partition_old .get_length() ) ) +
"</i>" ;
Utils::format_size( partition_old .get_length() ) ),
FONT_ITALIC ) ;
//reset fraction to -1 to make room for a new one (or a pulsebar)
operation_details .back() .fraction = -1 ;
@ -1303,11 +1299,11 @@ bool GParted_Core::move_filesystem_using_gparted( const Partition & partition_ol
{
if ( ! error_message .empty() )
operation_details .push_back(
OperationDetails( error_message, OperationDetails::NONE ) ) ;
OperationDetail( error_message, STATUS_NONE, FONT_ITALIC ) ) ;
if ( ! ped_error .empty() )
operation_details .push_back(
OperationDetails( "<i>" + ped_error + "</i>", OperationDetails::NONE ) ) ;
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
}
}
@ -1319,9 +1315,9 @@ bool GParted_Core::move_filesystem_using_gparted( const Partition & partition_ol
bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
operation_details .push_back( OperationDetails( _("using libparted"), OperationDetails::NONE ) ) ;
operation_details .push_back( OperationDetail( _("using libparted"), STATUS_NONE ) ) ;
bool return_value = false ;
if ( open_device_and_disk( partition_old .device_path ) )
@ -1352,14 +1348,14 @@ bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & par
}
if ( ! return_value && ! ped_error .empty() )
operation_details .push_back( OperationDetails( "<i>" + ped_error + "</i>", OperationDetails::NONE ) ) ;
operation_details .push_back( OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
return return_value ;
}
bool GParted_Core::resize( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
bool succes = false ;
if ( check_repair( partition_new, operation_details ) )
@ -1391,7 +1387,7 @@ bool GParted_Core::resize( const Partition & partition_old,
bool GParted_Core::resize_move_partition( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
//i'm not too happy with this, but i think it is the correct way from a i18n POV
enum Action
@ -1457,27 +1453,24 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
Utils::format_size( partition_old .get_length() ),
Utils::format_size( partition_new .get_length() ) ) ;
operation_details .push_back( OperationDetails( description ) ) ;
operation_details .push_back( OperationDetail( description ) ) ;
if ( action == NONE )
operation_details .back() .sub_details .push_back(
OperationDetails(
Glib::ustring( "<i>" ) +
_("new and old partition have the same size and positition. continuing anyway") +
Glib::ustring( "</i>" ),
OperationDetails::NONE ) ) ;
OperationDetail( _("new and old partition have the same size and positition. continuing anyway"),
STATUS_NONE,
FONT_ITALIC ) ) ;
operation_details .back() .sub_details .push_back(
OperationDetails(
"<i>" +
OperationDetail(
String::ucompose( _("old start: %1"), partition_old .sector_start ) + "\n" +
String::ucompose( _("old end: %1"), partition_old .sector_end ) + "\n" +
String::ucompose( _("old size: %1 (%2)"),
partition_old .get_length(),
Utils::format_size( partition_old .get_length() ) ) +
"</i>",
OperationDetails::NONE ) ) ;
Utils::format_size( partition_old .get_length() ) ),
STATUS_NONE,
FONT_ITALIC ) ) ;
//finally the actual resize/move
bool return_value = false ;
@ -1521,29 +1514,28 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
if ( return_value )
{
operation_details .back() .sub_details .push_back(
OperationDetails(
"<i>" +
OperationDetail(
String::ucompose( _("new start: %1"), lp_partition ->geom .start ) + "\n" +
String::ucompose( _("new end: %1"), lp_partition ->geom .end ) + "\n" +
String::ucompose( _("new size: %1 (%2)"),
lp_partition ->geom .length,
Utils::format_size( lp_partition ->geom .length ) ) +
"</i>",
OperationDetails::NONE ) ) ;
Utils::format_size( lp_partition ->geom .length ) ),
STATUS_NONE,
FONT_ITALIC ) ) ;
}
else if ( ! ped_error .empty() )
operation_details .back() .sub_details .push_back(
OperationDetails( "<i>" + ped_error + "</i>", OperationDetails::NONE ) ) ;
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
if ( partition_old .type == GParted::TYPE_EXTENDED )
{
operation_details .back() .status = return_value ? OperationDetails::SUCCES : OperationDetails::ERROR ;
operation_details .back() .status = return_value ? STATUS_SUCCES : STATUS_ERROR ;
return return_value ;
}
else
{
return_value &= wait_for_node( partition_new .get_path() ) ;
operation_details .back() .status = return_value ? OperationDetails::SUCCES : OperationDetails::ERROR ;
operation_details .back() .status = return_value ? STATUS_SUCCES : STATUS_ERROR ;
return return_value ;
}
@ -1551,7 +1543,7 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
bool GParted_Core::resize_filesystem( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
//by default 'grow' to accomodate expand_filesystem()
@ -1561,20 +1553,19 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old,
{
if ( partition_new .get_length() < partition_old .get_length() )
{
operation_details .push_back( OperationDetails( _("shrink filesystem") ) ) ;
operation_details .push_back( OperationDetail( _("shrink filesystem") ) ) ;
action = get_fs( partition_old .filesystem ) .shrink ;
}
else if ( partition_new .get_length() > partition_old .get_length() )
operation_details .push_back( OperationDetails( _("grow filesystem") ) ) ;
operation_details .push_back( OperationDetail( _("grow filesystem") ) ) ;
else
{
operation_details .push_back( OperationDetails( _("resize filesystem") ) ) ;
operation_details .push_back( OperationDetail( _("resize filesystem") ) ) ;
operation_details .back() .sub_details .push_back(
OperationDetails(
Glib::ustring( "<i>" ) +
_("new and old filesystem have the same size and positition. continuing anyway") +
Glib::ustring( "</i>" ),
OperationDetails::NONE ) ) ;
OperationDetail(
_("new and old filesystem have the same size and positition. continuing anyway"),
STATUS_NONE,
FONT_ITALIC ) ) ;
}
}
@ -1599,25 +1590,23 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old,
break ;
}
operation_details .back() .status = succes ? OperationDetails::SUCCES : OperationDetails::ERROR ;
operation_details .back() .status = succes ? STATUS_SUCCES : STATUS_ERROR ;
return succes ;
}
bool GParted_Core::maximize_filesystem( const Partition & partition,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
operation_details .push_back( OperationDetails( _("grow filesystem to fill the partition") ) ) ;
operation_details .push_back( OperationDetail( _("grow filesystem to fill the partition") ) ) ;
if ( get_fs( partition .filesystem ) .grow == GParted::FS::NONE )
{
operation_details .back() .sub_details .push_back(
OperationDetails(
Glib::ustring( "<i>" ) +
_("growing is not available for this filesystem") +
Glib::ustring( "</i>" ),
OperationDetails::NONE ) ) ;
OperationDetail( _("growing is not available for this filesystem"),
STATUS_NONE,
FONT_ITALIC ) ) ;
operation_details .back() .status = OperationDetails::N_A ;
operation_details .back() .status = STATUS_N_A ;
return true ;
}
@ -1628,7 +1617,7 @@ bool GParted_Core::copy( const Partition & partition_src,
Partition & partition_dest,
Sector min_size,
Sector block_size,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
if ( check_repair( partition_src, operation_details ) )
{
@ -1638,7 +1627,7 @@ bool GParted_Core::copy( const Partition & partition_src,
if ( succes && set_partition_type( partition_dest, operation_details ) )
{
operation_details .push_back( OperationDetails(
operation_details .push_back( OperationDetail(
String::ucompose( _("copy filesystem of %1 to %2"),
partition_src .get_path(),
partition_dest .get_path() ) ) ) ;
@ -1670,7 +1659,7 @@ bool GParted_Core::copy( const Partition & partition_src,
break ;
}
operation_details .back() .status = succes ? OperationDetails::SUCCES : OperationDetails::ERROR ;
operation_details .back() .status = succes ? STATUS_SUCCES : STATUS_ERROR ;
return ( succes &&
check_repair( partition_dest, operation_details ) &&
@ -1684,14 +1673,15 @@ bool GParted_Core::copy( const Partition & partition_src,
bool GParted_Core::copy_filesystem( const Partition & partition_src,
const Partition & partition_dest,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
Sector block_size )
{
operation_details .back() .sub_details .push_back( OperationDetails(
"<i>" + String::ucompose( _("Use a blocksize of %1 (%2 sectors)"),
Utils::format_size( block_size ),
block_size ) + "</i>",
OperationDetails::NONE ) ) ;
operation_details .back() .sub_details .push_back( OperationDetail(
String::ucompose( _("Use a blocksize of %1 (%2 sectors)"),
Utils::format_size( block_size ),
block_size ),
STATUS_NONE,
FONT_ITALIC ) ) ;
bool succes = false ;
PedDevice *lp_device_src, *lp_device_dest ;
@ -1709,8 +1699,7 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
ped_device_sync( lp_device_dest ) ;
//add an empty sub which we will constantly update in the loop
operation_details .back() .sub_details .push_back(
OperationDetails( "", OperationDetails::NONE ) ) ;
operation_details .back() .sub_details .push_back( OperationDetail( "", STATUS_NONE ) ) ;
Glib::ustring error_message ;
Sector t = 0 ;
@ -1733,8 +1722,9 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
Utils::format_size( t +1 ),
Utils::format_size( partition_src .get_length() ) ) ;
operation_details .back() .sub_details .back() .description =
"<i>" + operation_details .back() .sub_details .back() .progress_text + "</i>" ;
operation_details .back() .sub_details .back() .set_description(
operation_details .back() .sub_details .back() .progress_text,
FONT_ITALIC ) ;
operation_details .back() .sub_details .back() .fraction =
t / static_cast<double>( partition_src .get_length() ) ;
@ -1752,12 +1742,12 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
t += last_sectors ;
//final description
operation_details .back() .sub_details .back() .description =
"<i>" +
operation_details .back() .sub_details .back() .set_description(
String::ucompose( _("%1 of %2 copied"),
Utils::format_size( t +1 ),
Utils::format_size( partition_src .get_length() ) ) +
"</i>" ;
Utils::format_size( partition_src .get_length() ) ),
FONT_ITALIC ) ;
//reset fraction to -1 to make room for a new one (or a pulsebar)
operation_details .back() .sub_details .back() .fraction = -1 ;
@ -1769,11 +1759,11 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
{
if ( ! error_message .empty() )
operation_details .back() .sub_details .push_back(
OperationDetails( error_message, OperationDetails::NONE ) ) ;
OperationDetail( error_message, STATUS_NONE, FONT_ITALIC ) ) ;
if ( ! ped_error .empty() )
operation_details .back() .sub_details .push_back(
OperationDetails( "<i>" + ped_error + "</i>", OperationDetails::NONE ) ) ;
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
}
//close the devices..
@ -1790,29 +1780,25 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
}
else
operation_details .back() .sub_details .push_back(
OperationDetails( _("An error occurred while opening the devices"), OperationDetails::NONE ) ) ;
OperationDetail( _("An error occurred while opening the devices"), STATUS_NONE ) ) ;
operation_details .back() .status = succes ? OperationDetails::SUCCES : OperationDetails::ERROR ;
operation_details .back() .status = succes ? STATUS_SUCCES : STATUS_ERROR ;
return succes ;
}
bool GParted_Core::check_repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool GParted_Core::check_repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
operation_details .push_back( OperationDetails(
operation_details .push_back( OperationDetail(
String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"),
partition .get_path() ) ) ) ;
if ( get_fs( partition .filesystem ) .check == GParted::FS::NONE )
{
operation_details .back() .sub_details .push_back(
OperationDetails(
Glib::ustring( "<i>" ) +
_("checking is not available for this filesystem") +
Glib::ustring( "</i>" ),
OperationDetails::NONE ) ) ;
OperationDetail( _("checking is not available for this filesystem"), STATUS_NONE, FONT_ITALIC ) ) ;
operation_details .back() .status = OperationDetails::N_A ;
operation_details .back() .status = STATUS_N_A ;
return true ;
}
@ -1820,20 +1806,20 @@ bool GParted_Core::check_repair( const Partition & partition, std::vector<Operat
if ( p_filesystem && p_filesystem ->Check_Repair( partition, operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
return true ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
return false ;
}
}
bool GParted_Core::set_partition_type( const Partition & partition,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
operation_details .push_back( OperationDetails( _("set partitiontype") ) ) ;
operation_details .push_back( OperationDetail( _("set partitiontype") ) ) ;
bool return_value = false ;
@ -1859,7 +1845,7 @@ bool GParted_Core::set_partition_type( const Partition & partition,
close_device_and_disk() ;
}
operation_details .back() .status = return_value ? OperationDetails::SUCCES : OperationDetails::ERROR ;
operation_details .back() .status = return_value ? STATUS_SUCCES : STATUS_ERROR ;
return return_value ;
}
@ -1874,16 +1860,14 @@ bool GParted_Core::copy_block( PedDevice * lp_device_src,
if ( ! ped_device_read( lp_device_src, buf, offset_src, blocksize ) )
{
error_message =
"<i>" + String::ucompose( _("Error while reading block at sector %1"), offset_src ) + "</i>" ;
error_message = String::ucompose( _("Error while reading block at sector %1"), offset_src ) ;
return false ;
}
if ( ! ped_device_write( lp_device_dst, buf, offset_dst, blocksize ) )
{
error_message =
"<i>" + String::ucompose( _("Error while writing block at sector %1"), offset_dst ) + "</i>" ;
error_message = String::ucompose( _("Error while writing block at sector %1"), offset_dst ) ;
return false ;
}
@ -1893,26 +1877,25 @@ bool GParted_Core::copy_block( PedDevice * lp_device_src,
bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
Sector min_size )
{
operation_details .push_back( OperationDetails(
operation_details .push_back( OperationDetail(
String::ucompose( _("calculate new size and position of %1"), partition_new .get_path() ) ) ) ;
if ( min_size >= 0 )
operation_details .back() .sub_details .push_back(
OperationDetails( String::ucompose( _("minimum size: %1"), min_size ), OperationDetails::NONE ) ) ;
OperationDetail( String::ucompose( _("minimum size: %1"), min_size ), STATUS_NONE ) ) ;
operation_details .back() .sub_details .push_back(
OperationDetails(
"<i>" +
OperationDetail(
String::ucompose( _("requested start: %1"), partition_new .sector_start ) + "\n" +
String::ucompose( _("requested end: %1"), partition_new .sector_end ) + "\n" +
String::ucompose( _("requested size: %1 (%2)"),
partition_new .get_length(),
Utils::format_size( partition_new .get_length() ) ) +
"</i>",
OperationDetails::NONE ) ) ;
Utils::format_size( partition_new .get_length() ) ),
STATUS_NONE,
FONT_ITALIC ) ) ;
ped_error .clear() ;
bool succes = false ;
@ -1961,21 +1944,20 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
if ( succes )
{
operation_details .back() .sub_details .push_back(
OperationDetails(
"<i>" +
OperationDetail(
String::ucompose( _("new start: %1"), partition_new .sector_start ) + "\n" +
String::ucompose( _("new end: %1"), partition_new .sector_end ) + "\n" +
String::ucompose( _("new size: %1 (%2)"),
partition_new .get_length(),
Utils::format_size( partition_new .get_length() ) ) +
"</i>",
OperationDetails::NONE ) ) ;
Utils::format_size( partition_new .get_length() ) ),
STATUS_NONE,
FONT_ITALIC ) ) ;
}
else if ( ! ped_error .empty() )
operation_details .back() .sub_details .push_back(
OperationDetails( "<i>" + ped_error + "</i>", OperationDetails::NONE ) ) ;
OperationDetail( ped_error, STATUS_NONE, FONT_ITALIC ) ) ;
operation_details .back() .status = succes ? OperationDetails::SUCCES : OperationDetails::ERROR ;
operation_details .back() .status = succes ? STATUS_SUCCES : STATUS_ERROR ;
return succes ;
}
@ -2054,6 +2036,9 @@ bool GParted_Core::erase_filesystem_signatures( const Partition & partition )
//FIXME open_device( _and_disk) and the close functions should take an PedDevice * and PedDisk * as argument
//basicly we should get rid of these global lp_device and lp_disk
//also, it would be cool to create another open_device_and_disk() which also accepts an operation_details....
//we don't have to show the opening as an operation in itself, but we could use it to report errors which might
//occur while opening the device or disk.
bool GParted_Core::open_device( const Glib::ustring & device_path )
{
lp_device = ped_device_get( device_path .c_str() );

View File

@ -29,6 +29,7 @@ gparted_SOURCES = \
OperationCopy.cc \
OperationCreate.cc \
OperationDelete.cc \
OperationDetail.cc \
OperationFormat.cc \
OperationResizeMove.cc \
Partition.cc \

62
src/OperationDetail.cc Normal file
View File

@ -0,0 +1,62 @@
/* Copyright (C) 2004 Bart 'plors' Hakvoort
*
* 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.
*/
#include "../include/OperationDetail.h"
namespace GParted
{
OperationDetail::OperationDetail()
{
status = STATUS_NONE ;
fraction = -1 ;
}
OperationDetail::OperationDetail( const Glib::ustring & description, OperationDetailStatus status, Font font )
{
set_description( description, font ) ;
this ->status = status ;
fraction = -1 ;
}
void OperationDetail::set_description( const Glib::ustring & description, Font font )
{
switch ( font )
{
case FONT_NORMAL:
this ->description = Glib::Markup::escape_text( description ) ;
break ;
case FONT_BOLD:
this ->description = "<b>" + Glib::Markup::escape_text( description ) + "</b>" ;
break ;
case FONT_ITALIC:
this ->description = "<i>" + Glib::Markup::escape_text( description ) + "</i>" ;
break ;
case FONT_BOLD_ITALIC:
this ->description = "<b><i>" + Glib::Markup::escape_text( description ) + "</i></b>" ;
break ;
}
}
Glib::ustring OperationDetail::get_description() const
{
return description ;
}
} //GParted

View File

@ -72,13 +72,13 @@ void ext2::Set_Used_Sectors( Partition & partition )
partition .error = error ;
}
bool ext2::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool ext2::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkfs.ext2 " + new_partition .get_path(), operation_details ) ;
}
bool ext2::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
Glib::ustring str_temp = "resize2fs " + partition_new .get_path() ;
@ -92,12 +92,12 @@ bool ext2::Resize( const Partition & partition_new,
bool ext2::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool ext2::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool ext2::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
exit_status = execute_command( "e2fsck -f -y -v " + partition .get_path(), operation_details ) ;

View File

@ -73,13 +73,13 @@ void ext3::Set_Used_Sectors( Partition & partition )
partition .error = error ;
}
bool ext3::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool ext3::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkfs.ext3 " + new_partition .get_path(), operation_details ) ;
}
bool ext3::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
Glib::ustring str_temp = "resize2fs " + partition_new .get_path() ;
@ -93,12 +93,12 @@ bool ext3::Resize( const Partition & partition_new,
bool ext3::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool ext3::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool ext3::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
exit_status = execute_command( "e2fsck -f -y -v " + partition .get_path(), operation_details ) ;

View File

@ -73,13 +73,13 @@ void fat16::Set_Used_Sectors( Partition & partition )
partition .error = error ;
}
bool fat16::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool fat16::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkdosfs -F16 -v " + new_partition .get_path(), operation_details ) ;
}
bool fat16::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
return true ;
@ -87,12 +87,12 @@ bool fat16::Resize( const Partition & partition_new,
bool fat16::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool fat16::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool fat16::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details ) ;

View File

@ -72,13 +72,13 @@ void fat32::Set_Used_Sectors( Partition & partition )
partition .error = error ;
}
bool fat32::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool fat32::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkdosfs -F32 -v " + new_partition .get_path(), operation_details ) ;
}
bool fat32::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
return true ;
@ -86,12 +86,12 @@ bool fat32::Resize( const Partition & partition_new,
bool fat32::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool fat32::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool fat32::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details ) ;

View File

@ -45,13 +45,13 @@ void hfs::Set_Used_Sectors( Partition & partition )
{
}
bool hfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool hfs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "hformat " + new_partition .get_path(), operation_details ) ;
}
bool hfs::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
return true ;
@ -59,12 +59,12 @@ bool hfs::Resize( const Partition & partition_new,
bool hfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool hfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool hfs::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
return true ;
}

View File

@ -21,7 +21,7 @@
namespace GParted
{
FS hfsplus::get_filesystem_support( )
FS hfsplus::get_filesystem_support()
{
FS fs ;
@ -40,13 +40,13 @@ void hfsplus::Set_Used_Sectors( Partition & partition )
{
}
bool hfsplus::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool hfsplus::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool hfsplus::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
return true ;
@ -54,12 +54,12 @@ bool hfsplus::Resize( const Partition & partition_new,
bool hfsplus::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool hfsplus::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool hfsplus::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
return true ;
}

View File

@ -93,13 +93,13 @@ void jfs::Set_Used_Sectors( Partition & partition )
partition .error = error ;
}
bool jfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool jfs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkfs.jfs -q " + new_partition .get_path(), operation_details ) ;
}
bool jfs::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
bool return_value = false ;
@ -108,78 +108,78 @@ bool jfs::Resize( const Partition & partition_new,
//create mountpoint...
operation_details .push_back(
OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), TEMP_MP ) ) ) ;
OperationDetail( String::ucompose( _("create temporary mountpoint (%1)"), TEMP_MP ) ) ) ;
if ( ! mkdir( TEMP_MP .c_str(), 0 ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
//mount partition
operation_details .push_back(
OperationDetails( String::ucompose( _("mount %1 on %2"), partition_new .get_path(), TEMP_MP ) ) ) ;
OperationDetail( String::ucompose( _("mount %1 on %2"), partition_new .get_path(), TEMP_MP ) ) ) ;
if ( ! execute_command( "mount -v -t jfs " + partition_new .get_path() + " " + TEMP_MP,
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
//remount the partition to resize the filesystem
operation_details .push_back(
OperationDetails( String::ucompose( _("remount %1 on %2 with the 'resize' flag enabled"),
OperationDetail( String::ucompose( _("remount %1 on %2 with the 'resize' flag enabled"),
partition_new .get_path(), TEMP_MP ) ) ) ;
if ( ! execute_command(
"mount -v -t jfs -o remount,resize " + partition_new .get_path() + " " + TEMP_MP,
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
return_value = true ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
}
//and unmount it...
operation_details .push_back(
OperationDetails( String::ucompose( _("unmount %1"), partition_new .get_path() ) ) ) ;
OperationDetail( String::ucompose( _("unmount %1"), partition_new .get_path() ) ) ) ;
if ( ! execute_command( "umount -v " + partition_new .get_path(),
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
return_value = false ;
}
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
}
//remove the mountpoint..
operation_details .push_back(
OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), TEMP_MP ) ) ) ;
OperationDetail( String::ucompose( _("remove temporary mountpoint (%1)"), TEMP_MP ) ) ) ;
if ( ! rmdir( TEMP_MP .c_str() ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
operation_details .back() .sub_details .push_back(
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
return_value = false ;
}
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
operation_details .back() .sub_details .push_back(
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
}
return return_value ;
@ -187,12 +187,12 @@ bool jfs::Resize( const Partition & partition_new,
bool jfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool jfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool jfs::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
exit_status = execute_command( "jfs_fsck -f " + partition .get_path(), operation_details ) ;

View File

@ -43,13 +43,13 @@ void linux_swap::Set_Used_Sectors( Partition & partition )
{
}
bool linux_swap::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool linux_swap::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkswap " + new_partition .get_path(), operation_details ) ;
}
bool linux_swap::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
return Create( partition_new, operation_details ) ;
@ -57,12 +57,12 @@ bool linux_swap::Resize( const Partition & partition_new,
bool linux_swap::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool linux_swap::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool linux_swap::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
return true ;
}

View File

@ -70,13 +70,13 @@ void ntfs::Set_Used_Sectors( Partition & partition )
partition .error = error ;
}
bool ntfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool ntfs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkntfs -Q -vv " + new_partition .get_path(), operation_details ) ;
}
bool ntfs::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
bool return_value = false ;
@ -90,28 +90,28 @@ bool ntfs::Resize( const Partition & partition_new,
}
//simulation..
operation_details .push_back( OperationDetails( _("run simulation") ) ) ;
operation_details .push_back( OperationDetail( _("run simulation") ) ) ;
if ( ! execute_command( str_temp + " --no-action", operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
//real resize
operation_details .push_back( OperationDetails( _("real resize") ) ) ;
operation_details .push_back( OperationDetail( _("real resize") ) ) ;
if ( ! execute_command( str_temp, operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
return_value = true ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
}
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
}
return return_value ;
@ -119,12 +119,12 @@ bool ntfs::Resize( const Partition & partition_new,
bool ntfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path, operation_details ) ;
}
bool ntfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool ntfs::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "ntfsresize -P -i -f -v " + partition .get_path(), operation_details ) ;
}

View File

@ -71,13 +71,13 @@ void reiser4::Set_Used_Sectors( Partition & partition )
partition .error = error ;
}
bool reiser4::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool reiser4::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkfs.reiser4 --yes " + new_partition .get_path(), operation_details ) ;
}
bool reiser4::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
return true ;
@ -85,12 +85,12 @@ bool reiser4::Resize( const Partition & partition_new,
bool reiser4::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool reiser4::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool reiser4::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "fsck.reiser4 --yes --fix " + partition .get_path(), operation_details ) ;
}

View File

@ -76,13 +76,13 @@ void reiserfs::Set_Used_Sectors( Partition & partition )
partition .error = error ;
}
bool reiserfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool reiserfs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkreiserfs -f " + new_partition .get_path(), operation_details ) ;
}
bool reiserfs::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
Glib::ustring str_temp = "echo y | resize_reiserfs " + partition_new .get_path() ;
@ -101,12 +101,12 @@ bool reiserfs::Resize( const Partition & partition_new,
bool reiserfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool reiserfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool reiserfs::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
exit_status = execute_command( "reiserfsck --y --fix-fixable " + partition .get_path(), operation_details ) ;

View File

@ -37,13 +37,13 @@ void ufs::Set_Used_Sectors( Partition & partition )
{
}
bool ufs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool ufs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool ufs::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
return true ;
@ -51,12 +51,12 @@ bool ufs::Resize( const Partition & partition_new,
bool ufs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
return true ;
}
bool ufs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool ufs::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
return true ;
}

View File

@ -95,13 +95,13 @@ void xfs::Set_Used_Sectors( Partition & partition )
partition .error = error ;
}
bool xfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
bool xfs::Create( const Partition & new_partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "mkfs.xfs -f " + new_partition .get_path(), operation_details ) ;
}
bool xfs::Resize( const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
std::vector<OperationDetail> & operation_details,
bool fill_partition )
{
bool return_value = false ;
@ -110,75 +110,75 @@ bool xfs::Resize( const Partition & partition_new,
//create mountpoint...
operation_details .push_back(
OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), TEMP_MP ) ) ) ;
OperationDetail( String::ucompose( _("create temporary mountpoint (%1)"), TEMP_MP ) ) ) ;
if ( ! mkdir( TEMP_MP .c_str(), 0 ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
//mount partition
operation_details .push_back(
OperationDetails( String::ucompose( _("mount %1 on %2"), partition_new .get_path(), TEMP_MP ) ) ) ;
OperationDetail( String::ucompose( _("mount %1 on %2"), partition_new .get_path(), TEMP_MP ) ) ) ;
if ( ! execute_command( "mount -v -t xfs " + partition_new .get_path() + " " + TEMP_MP,
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
//grow the mounted filesystem..
operation_details .push_back( OperationDetails( _("grow mounted filesystem") ) ) ;
operation_details .push_back( OperationDetail( _("grow mounted filesystem") ) ) ;
if ( ! execute_command ( "xfs_growfs " + TEMP_MP,
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
return_value = true ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
}
//and unmount it...
operation_details .push_back(
OperationDetails( String::ucompose( _("unmount %1"), partition_new .get_path() ) ) ) ;
OperationDetail( String::ucompose( _("unmount %1"), partition_new .get_path() ) ) ) ;
if ( ! execute_command( "umount -v " + partition_new .get_path(),
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
return_value = false ;
}
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
}
//remove the mountpoint..
operation_details .push_back(
OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), TEMP_MP ) ) ) ;
OperationDetail( String::ucompose( _("remove temporary mountpoint (%1)"), TEMP_MP ) ) ) ;
if ( ! rmdir( TEMP_MP .c_str() ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
operation_details .back() .sub_details .push_back(
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
return_value = false ;
}
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
operation_details .back() .sub_details .push_back(
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
}
return return_value ;
@ -186,7 +186,7 @@ bool xfs::Resize( const Partition & partition_new,
bool xfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
std::vector<OperationDetail> & operation_details )
{
bool return_value = false ;
Glib::ustring error ;
@ -199,143 +199,143 @@ bool xfs::Copy( const Glib::ustring & src_part_path,
{
//create source mountpoint...
operation_details .push_back(
OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), SRC ) ) ) ;
OperationDetail( String::ucompose( _("create temporary mountpoint (%1)"), SRC ) ) ) ;
if ( ! mkdir( SRC .c_str(), 0 ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
//create destination mountpoint...
operation_details .push_back(
OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), DST ) ) ) ;
OperationDetail( String::ucompose( _("create temporary mountpoint (%1)"), DST ) ) ) ;
if ( ! mkdir( DST .c_str(), 0 ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
//mount source partition
operation_details .push_back(
OperationDetails( String::ucompose( _("mount %1 on %2"), src_part_path, SRC ) ) ) ;
OperationDetail( String::ucompose( _("mount %1 on %2"), src_part_path, SRC ) ) ) ;
if ( ! execute_command( "mount -v -t xfs -o noatime,ro " + src_part_path + " " + SRC,
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
//mount destination partition
operation_details .push_back(
OperationDetails( String::ucompose( _("mount %1 on %2"), dest_part_path, DST ) ) ) ;
OperationDetail( String::ucompose( _("mount %1 on %2"), dest_part_path, DST ) ) ) ;
if ( ! execute_command( "mount -v -t xfs " + dest_part_path + " " + DST,
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
//copy filesystem..
operation_details .push_back( OperationDetails( _("copy filesystem") ) ) ;
operation_details .push_back( OperationDetail( _("copy filesystem") ) ) ;
if ( ! execute_command(
"xfsdump -J - " + SRC + " | xfsrestore -J - " + DST,
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
return_value = true ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
}
//unmount destination partition
operation_details .push_back(
OperationDetails( String::ucompose( _("unmount %1"),
OperationDetail( String::ucompose( _("unmount %1"),
dest_part_path ) ) ) ;
if ( ! execute_command( "umount -v " + dest_part_path,
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
return_value = false ;
}
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
}
//unmount source partition
operation_details .push_back(
OperationDetails( String::ucompose( _("unmount %1"), src_part_path ) ) ) ;
OperationDetail( String::ucompose( _("unmount %1"), src_part_path ) ) ) ;
if ( ! execute_command( "umount -v " + src_part_path,
operation_details .back() .sub_details ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
return_value = false ;
}
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
}
//remove destination mountpoint..
operation_details .push_back(
OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), DST ) ) ) ;
OperationDetail( String::ucompose( _("remove temporary mountpoint (%1)"), DST ) ) ) ;
if ( ! rmdir( DST .c_str() ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
operation_details .back() .sub_details .push_back(
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
return_value = false ;
}
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
operation_details .back() .sub_details .push_back(
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
}
//remove source mountpoint..
operation_details .push_back(
OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), SRC ) ) ) ;
OperationDetail( String::ucompose( _("remove temporary mountpoint (%1)"), SRC ) ) ) ;
if ( ! rmdir( SRC .c_str() ) )
{
operation_details .back() .status = OperationDetails::SUCCES ;
operation_details .back() .status = STATUS_SUCCES ;
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
operation_details .back() .sub_details .push_back(
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
return_value = false ;
}
}
else
{
operation_details .back() .status = OperationDetails::ERROR ;
operation_details .back() .status = STATUS_ERROR ;
operation_details .back() .sub_details .push_back(
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
}
}
return return_value ;
}
bool xfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
bool xfs::Check_Repair( const Partition & partition, std::vector<OperationDetail> & operation_details )
{
return ! execute_command( "xfs_repair -v " + partition .get_path(), operation_details ) ;
}