renamed some enums

* renamed some enums
This commit is contained in:
Bart Hakvoort 2006-07-29 15:20:32 +00:00
parent faad1b6be4
commit e033136a6f
14 changed files with 51 additions and 48 deletions

View File

@ -1,3 +1,7 @@
2006-07-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
* renamed some enums
2006-07-29 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-07-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: fixed a couple of small errors in the * src/GParted_Core.cc: fixed a couple of small errors in the

View File

@ -23,14 +23,13 @@
namespace GParted 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 //FIXME: stop using GParted:: in front of our own enums.. it's not necessary and clutters the code
enum OperationType { enum OperationType {
DELETE = 0, OPERATION_DELETE = 0,
CREATE = 1, OPERATION_CREATE = 1,
RESIZE_MOVE = 2, OPERATION_RESIZE_MOVE = 2,
FORMAT = 3, OPERATION_FORMAT = 3,
COPY = 4 OPERATION_COPY = 4
}; };
class Operation class Operation

View File

@ -15,8 +15,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef OPERATION_COPY #ifndef OPERATIONCOPY
#define OPERATION_COPY #define OPERATIONCOPY
#include "../include/Operation.h" #include "../include/Operation.h"
@ -43,4 +43,4 @@ private:
} //GParted } //GParted
#endif //OPERATION_COPY #endif //OPERATIONCOPY

View File

@ -15,8 +15,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef OPERATION_CREATE #ifndef OPERATIONCREATE
#define OPERATION_CREATE #define OPERATIONCREATE
#include "../include/Operation.h" #include "../include/Operation.h"
@ -38,4 +38,4 @@ private:
} //GParted } //GParted
#endif //OPERATION_CREATE #endif //OPERATIONCREATE

View File

@ -15,8 +15,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef OPERATION_DELETE #ifndef OPERATIONDELETE
#define OPERATION_DELETE #define OPERATIONDELETE
#include "../include/Operation.h" #include "../include/Operation.h"
@ -37,4 +37,4 @@ private:
} //GParted } //GParted
#endif //OPERATION_DELETE #endif //OPERATIONDELETE

View File

@ -15,8 +15,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef OPERATION_FORMAT #ifndef OPERATIONFORMAT
#define OPERATION_FORMAT #define OPERATIONFORMAT
#include "../include/Operation.h" #include "../include/Operation.h"
@ -38,4 +38,4 @@ private:
} //GParted } //GParted
#endif //OPERATION_FORMAT #endif //OPERATIONFORMAT

View File

@ -15,8 +15,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef OPERATION_RESIZEMOVE #ifndef OPERATIONRESIZEMOVE
#define OPERATION_RESIZEMOVE #define OPERATIONRESIZEMOVE
#include "../include/Operation.h" #include "../include/Operation.h"
@ -43,4 +43,4 @@ private:
} //GParted } //GParted
#endif //OPERATION_RESIZEMOVE #endif //OPERATIONRESIZEMOVE

View File

@ -285,20 +285,20 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
{ {
switch ( operation ->type ) switch ( operation ->type )
{ {
case DELETE: case OPERATION_DELETE:
return Delete( operation ->partition_original, operation ->operation_detail .sub_details ) ; return Delete( operation ->partition_original, operation ->operation_detail .sub_details ) ;
case CREATE: case OPERATION_CREATE:
return create( operation ->device, return create( operation ->device,
operation ->partition_new, operation ->partition_new,
operation ->operation_detail .sub_details ) ; operation ->operation_detail .sub_details ) ;
case RESIZE_MOVE: case OPERATION_RESIZE_MOVE:
return resize_move( operation ->device, return resize_move( operation ->device,
operation ->partition_original, operation ->partition_original,
operation ->partition_new, operation ->partition_new,
operation ->operation_detail .sub_details ) ; operation ->operation_detail .sub_details ) ;
case FORMAT: case OPERATION_FORMAT:
return format( operation ->partition_new, operation ->operation_detail .sub_details ) ; return format( operation ->partition_new, operation ->operation_detail .sub_details ) ;
case COPY: case OPERATION_COPY:
operation ->partition_new .add_path( operation ->partition_original .get_path(), true ) ; operation ->partition_new .add_path( operation ->partition_original .get_path(), true ) ;
return copy( static_cast<OperationCopy*>( operation ) ->partition_copied, return copy( static_cast<OperationCopy*>( operation ) ->partition_copied,
operation ->partition_new, operation ->partition_new,

View File

@ -26,7 +26,7 @@ OperationCopy::OperationCopy( const Device & device,
const Partition & partition_copied, const Partition & partition_copied,
Sector block_size ) Sector block_size )
{ {
type = GParted::COPY ; type = OPERATION_COPY ;
this ->device = device ; this ->device = device ;
this ->partition_original = partition_orig ; this ->partition_original = partition_orig ;

View File

@ -24,7 +24,7 @@ OperationCreate::OperationCreate( const Device & device,
const Partition & partition_orig, const Partition & partition_orig,
const Partition & partition_new ) const Partition & partition_new )
{ {
type = GParted::CREATE ; type = OPERATION_CREATE ;
this ->device = device ; this ->device = device ;
this ->partition_original = partition_orig ; this ->partition_original = partition_orig ;

View File

@ -22,7 +22,7 @@ namespace GParted
OperationDelete::OperationDelete( const Device & device, const Partition & partition_orig ) OperationDelete::OperationDelete( const Device & device, const Partition & partition_orig )
{ {
type = GParted::DELETE ; type = OPERATION_DELETE ;
this ->device = device ; this ->device = device ;
this ->partition_original = partition_orig ; this ->partition_original = partition_orig ;

View File

@ -24,7 +24,7 @@ OperationFormat::OperationFormat( const Device & device,
const Partition & partition_orig, const Partition & partition_orig,
const Partition & partition_new ) const Partition & partition_new )
{ {
type = GParted::FORMAT ; type = OPERATION_FORMAT ;
this ->device = device ; this ->device = device ;
this ->partition_original = partition_orig ; this ->partition_original = partition_orig ;

View File

@ -24,7 +24,7 @@ OperationResizeMove::OperationResizeMove( const Device & device,
const Partition & partition_orig, const Partition & partition_orig,
const Partition & partition_new ) const Partition & partition_new )
{ {
type = GParted::RESIZE_MOVE ; type = OPERATION_RESIZE_MOVE ;
this ->device = device ; this ->device = device ;
this ->partition_original = partition_orig ; this ->partition_original = partition_orig ;
this ->partition_new = partition_new ; this ->partition_new = partition_new ;

View File

@ -586,29 +586,29 @@ void Win_GParted::Add_Operation( OperationType operationtype,
Operation * operation ; Operation * operation ;
switch ( operationtype ) switch ( operationtype )
{ {
case GParted::DELETE : case OPERATION_DELETE :
operation = new OperationDelete( devices[ current_device ], selected_partition ) ; operation = new OperationDelete( devices[ current_device ], selected_partition ) ;
operation ->icon = render_icon( Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU ) ; operation ->icon = render_icon( Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU ) ;
break; break;
case GParted::CREATE : case OPERATION_CREATE :
operation = new OperationCreate( devices[ current_device ], operation = new OperationCreate( devices[ current_device ],
selected_partition, selected_partition,
new_partition ) ; new_partition ) ;
operation ->icon = render_icon( Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU ); operation ->icon = render_icon( Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU );
break; break;
case GParted::RESIZE_MOVE: case OPERATION_RESIZE_MOVE:
operation = new OperationResizeMove( devices[ current_device ], operation = new OperationResizeMove( devices[ current_device ],
selected_partition, selected_partition,
new_partition ); new_partition );
operation ->icon = render_icon( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU ); operation ->icon = render_icon( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU );
break; break;
case GParted::FORMAT : case OPERATION_FORMAT :
operation = new OperationFormat( devices[ current_device ], operation = new OperationFormat( devices[ current_device ],
selected_partition, selected_partition,
new_partition ); new_partition );
operation ->icon = render_icon( Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU ); operation ->icon = render_icon( Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU );
break; break;
case GParted::COPY : case OPERATION_COPY :
operation = new OperationCopy( devices[ current_device ], operation = new OperationCopy( devices[ current_device ],
selected_partition, selected_partition,
new_partition, new_partition,
@ -621,8 +621,8 @@ void Win_GParted::Add_Operation( OperationType operationtype,
if ( operation ) if ( operation )
{ {
Glib::ustring error ; Glib::ustring error ;
if ( operation ->type == GParted::DELETE || if ( operation ->type == OPERATION_DELETE ||
operation ->type == GParted::FORMAT || operation ->type == OPERATION_FORMAT ||
gparted_core .snap_to_cylinder( operation ->device, operation ->partition_new, error ) ) gparted_core .snap_to_cylinder( operation ->device, operation ->partition_new, error ) )
{ {
operation ->create_description() ; operation ->create_description() ;
@ -1264,14 +1264,14 @@ void Win_GParted::activate_resize()
selected_partition .sector_start, selected_partition .sector_start,
selected_partition .sector_end, selected_partition .sector_end,
selected_partition .inside_extended ) ; selected_partition .inside_extended ) ;
Add_Operation( GParted::CREATE, dialog .Get_New_Partition() ); Add_Operation( OPERATION_CREATE, dialog .Get_New_Partition() );
break; break;
} }
} }
} }
else//normal move/resize on existing partition else//normal move/resize on existing partition
Add_Operation( GParted::RESIZE_MOVE, dialog .Get_New_Partition() ); Add_Operation( OPERATION_RESIZE_MOVE, dialog .Get_New_Partition() );
} }
} }
@ -1298,7 +1298,7 @@ void Win_GParted::activate_paste()
if ( dialog .run() == Gtk::RESPONSE_OK ) if ( dialog .run() == Gtk::RESPONSE_OK )
{ {
dialog .hide() ; dialog .hide() ;
Add_Operation( GParted::COPY, dialog .Get_New_Partition(), dialog .get_block_size() ); Add_Operation( OPERATION_COPY, dialog .Get_New_Partition(), dialog .get_block_size() );
} }
} }
} }
@ -1315,7 +1315,7 @@ void Win_GParted::activate_paste()
//i guess this means we have to present a window with the choice (maybe the copydialog, with everything //i guess this means we have to present a window with the choice (maybe the copydialog, with everything
//except the blocksize disabled? //except the blocksize disabled?
//bleh, this will be fixed as soon as the algorith to determine the optimal blocksize is in place //bleh, this will be fixed as soon as the algorith to determine the optimal blocksize is in place
Add_Operation( GParted::COPY, partition_new, 32 ) ; Add_Operation( OPERATION_COPY, partition_new, 32 ) ;
} }
} }
@ -1343,7 +1343,7 @@ void Win_GParted::activate_new()
dialog .hide() ; dialog .hide() ;
new_count++ ; new_count++ ;
Add_Operation( GParted::CREATE, dialog .Get_New_Partition() ); Add_Operation( OPERATION_CREATE, dialog .Get_New_Partition() );
} }
} }
} }
@ -1432,7 +1432,7 @@ void Win_GParted::activate_delete()
close_operationslist() ; close_operationslist() ;
} }
else //deletion of a real partition...(now selected_partition is just a dummy) else //deletion of a real partition...(now selected_partition is just a dummy)
Add_Operation( GParted::DELETE, selected_partition ); Add_Operation( OPERATION_DELETE, selected_partition );
} }
void Win_GParted::activate_info() void Win_GParted::activate_info()
@ -1502,14 +1502,14 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
//(NOTE: in this case we set status to STAT_NEW) //(NOTE: in this case we set status to STAT_NEW)
part_temp .status = STAT_NEW ; part_temp .status = STAT_NEW ;
Add_Operation( GParted::CREATE, part_temp, -1, t ); Add_Operation( OPERATION_CREATE, part_temp, -1, t );
break; break;
} }
} }
} }
else//normal formatting of an existing partition else//normal formatting of an existing partition
Add_Operation( GParted::FORMAT, part_temp ) ; Add_Operation( OPERATION_FORMAT, part_temp ) ;
} }
void Win_GParted::thread_unmount_partition( bool * succes, Glib::ustring * error ) void Win_GParted::thread_unmount_partition( bool * succes, Glib::ustring * error )
@ -1735,7 +1735,7 @@ void Win_GParted::activate_manage_flags()
void Win_GParted::activate_undo() void Win_GParted::activate_undo()
{ {
//when undoing an creation it's safe to decrease the newcount by one //when undoing an creation it's safe to decrease the newcount by one
if ( operations .back() ->type == GParted::CREATE ) if ( operations .back() ->type == OPERATION_CREATE )
new_count-- ; new_count-- ;
remove_operation() ; remove_operation() ;