added 'check' operation. The functionality was already there, but it was
* include/Makefile.am, include/Operation.h, include/Win_GParted.h, src/GParted_Core.cc, src/Makefile.am, src/Win_GParted.cc, include/OperationCheck.h (new), src/OperationCheck.cc (new): added 'check' operation. The functionality was already there, but it was not possible yet to activate it from the gui.
This commit is contained in:
parent
61c91a1869
commit
ef09ce0b97
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2006-11-26 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/Makefile.am,
|
||||
include/Operation.h,
|
||||
include/Win_GParted.h,
|
||||
src/GParted_Core.cc,
|
||||
src/Makefile.am,
|
||||
src/Win_GParted.cc,
|
||||
include/OperationCheck.h (new),
|
||||
src/OperationCheck.cc (new): added 'check' operation. The
|
||||
functionality was already there, but it was not possible yet to
|
||||
activate it from the gui.
|
||||
|
||||
2006-11-25 Chao-Hsiung Liao <j_h_liau@yahoo.com.tw>
|
||||
|
||||
* configure.in: Add "zh_HK" to ALL_LINGUAS.
|
||||
|
|
|
@ -19,6 +19,7 @@ EXTRA_DIST = \
|
|||
HBoxOperations.h \
|
||||
Operation.h \
|
||||
OperationCopy.h \
|
||||
OperationCheck.h \
|
||||
OperationCreate.h \
|
||||
OperationDelete.h \
|
||||
OperationDetail.h \
|
||||
|
|
|
@ -26,10 +26,11 @@ namespace GParted
|
|||
//FIXME: stop using GParted:: in front of our own enums.. it's not necessary and clutters the code
|
||||
enum OperationType {
|
||||
OPERATION_DELETE = 0,
|
||||
OPERATION_CREATE = 1,
|
||||
OPERATION_RESIZE_MOVE = 2,
|
||||
OPERATION_FORMAT = 3,
|
||||
OPERATION_COPY = 4
|
||||
OPERATION_CHECK = 1,
|
||||
OPERATION_CREATE = 2,
|
||||
OPERATION_RESIZE_MOVE = 3,
|
||||
OPERATION_FORMAT = 4,
|
||||
OPERATION_COPY = 5
|
||||
};
|
||||
|
||||
class Operation
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/* 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 OPERATIONCHECK
|
||||
#define OPERATIONCHECK
|
||||
|
||||
#include "../include/Operation.h"
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
class OperationCheck : public Operation
|
||||
{
|
||||
public:
|
||||
OperationCheck( const Device & device, const Partition & partition ) ;
|
||||
|
||||
void apply_to_visual( std::vector<Partition> & partitions ) ;
|
||||
|
||||
private:
|
||||
void create_description() ;
|
||||
} ;
|
||||
|
||||
} //GParted
|
||||
|
||||
#endif //OPERATIONCHECK
|
|
@ -97,6 +97,9 @@ private:
|
|||
void allow_manage_flags( bool state ) {
|
||||
toggle_item( state, MENU_FLAGS ) ; }
|
||||
|
||||
void allow_check( bool state ) {
|
||||
toggle_item( state, MENU_CHECK ) ; }
|
||||
|
||||
void allow_info( bool state ) {
|
||||
toggle_item( state, MENU_INFO ) ; }
|
||||
|
||||
|
@ -154,6 +157,7 @@ private:
|
|||
void activate_mount_partition( unsigned int index ) ;
|
||||
void activate_disklabel() ;
|
||||
void activate_manage_flags() ;
|
||||
void activate_check() ;
|
||||
|
||||
void activate_undo();
|
||||
void remove_operation( int index = -1, bool remove_all = false ) ;
|
||||
|
@ -218,6 +222,7 @@ private:
|
|||
MENU_TOGGLE_MOUNT_SWAP,
|
||||
MENU_MOUNT,
|
||||
MENU_FLAGS,
|
||||
MENU_CHECK,
|
||||
MENU_INFO,
|
||||
TOOLBAR_UNDO,
|
||||
TOOLBAR_APPLY ;
|
||||
|
|
|
@ -289,6 +289,10 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
|
|||
case OPERATION_DELETE:
|
||||
succes = Delete( operation ->partition_original, operation ->operation_detail ) ;
|
||||
break ;
|
||||
case OPERATION_CHECK:
|
||||
succes = check_repair_filesystem( operation ->partition_original, operation ->operation_detail ) &&
|
||||
maximize_filesystem( operation ->partition_original, operation ->operation_detail ) ;
|
||||
break ;
|
||||
case OPERATION_CREATE:
|
||||
succes = create( operation ->device,
|
||||
operation ->partition_new,
|
||||
|
@ -1569,10 +1573,10 @@ bool GParted_Core::copy( const Partition & partition_src,
|
|||
|
||||
operationdetail .get_last_child() .set_status( succes ? STATUS_SUCCES : STATUS_ERROR ) ;
|
||||
|
||||
return ( succes &&
|
||||
update_bootsector( partition_dst, operationdetail ) &&
|
||||
check_repair_filesystem( partition_dst, operationdetail ) &&
|
||||
maximize_filesystem( partition_dst, operationdetail ) ) ;
|
||||
return succes &&
|
||||
update_bootsector( partition_dst, operationdetail ) &&
|
||||
check_repair_filesystem( partition_dst, operationdetail ) &&
|
||||
maximize_filesystem( partition_dst, operationdetail ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ gparted_SOURCES = \
|
|||
HBoxOperations.cc \
|
||||
Operation.cc \
|
||||
OperationCopy.cc \
|
||||
OperationCheck.cc \
|
||||
OperationCreate.cc \
|
||||
OperationDelete.cc \
|
||||
OperationDetail.cc \
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/* 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/OperationCheck.h"
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
OperationCheck::OperationCheck( const Device & device, const Partition & partition )
|
||||
{
|
||||
type = OPERATION_CHECK ;
|
||||
|
||||
this ->device = device ;
|
||||
partition_original = partition ;
|
||||
}
|
||||
|
||||
void OperationCheck::apply_to_visual( std::vector<Partition> & partitions )
|
||||
{
|
||||
}
|
||||
|
||||
void OperationCheck::create_description()
|
||||
{
|
||||
/*TO TRANSLATORS: looks like Check and repair filesystem (ext3) on /dev/hda4 */
|
||||
description = String::ucompose( _("Check and repair filesystem (%1) on %2"),
|
||||
Utils::get_filesystem_string( partition_original .filesystem ),
|
||||
partition_original .get_path() ) ;
|
||||
}
|
||||
|
||||
} //GParted
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
#include "../include/Dialog_Partition_Info.h"
|
||||
#include "../include/DialogManageFlags.h"
|
||||
#include "../include/OperationCopy.h"
|
||||
#include "../include/OperationCheck.h"
|
||||
#include "../include/OperationCreate.h"
|
||||
#include "../include/OperationDelete.h"
|
||||
#include "../include/OperationFormat.h"
|
||||
|
@ -334,6 +335,11 @@ void Win_GParted::init_partition_menu()
|
|||
sigc::mem_fun( *this, &Win_GParted::activate_manage_flags ) ) );
|
||||
MENU_FLAGS = index++ ;
|
||||
|
||||
menu_partition .items() .push_back(
|
||||
Gtk::Menu_Helpers::MenuElem( _("C_heck"),
|
||||
sigc::mem_fun( *this, &Win_GParted::activate_check ) ) );
|
||||
MENU_CHECK = index++ ;
|
||||
|
||||
menu_partition .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ) ;
|
||||
index++ ;
|
||||
|
||||
|
@ -606,8 +612,10 @@ void Win_GParted::Add_Operation( Operation * operation, int index )
|
|||
if ( operation )
|
||||
{
|
||||
Glib::ustring error ;
|
||||
//FIXME: this is becoming a mess.. maybe it's better to check if partition_new > 0
|
||||
if ( operation ->type == OPERATION_DELETE ||
|
||||
operation ->type == OPERATION_FORMAT ||
|
||||
operation ->type == OPERATION_CHECK ||
|
||||
gparted_core .snap_to_cylinder( operation ->device, operation ->partition_new, error ) )
|
||||
{
|
||||
operation ->create_description() ;
|
||||
|
@ -728,7 +736,7 @@ void Win_GParted::set_valid_operations()
|
|||
{
|
||||
allow_new( false ); allow_delete( false ); allow_resize( false ); allow_copy( false );
|
||||
allow_paste( false ); allow_format( false ); allow_toggle_swap_mount_state( false ) ;
|
||||
allow_manage_flags( false ) ; allow_info( false ) ;
|
||||
allow_manage_flags( false ) ; allow_check( false ) ; allow_info( false ) ;
|
||||
|
||||
dynamic_cast<Gtk::Label*>( menu_partition .items()[ MENU_TOGGLE_MOUNT_SWAP ] .get_child() )
|
||||
->set_label( _("_Unmount") ) ;
|
||||
|
@ -851,6 +859,10 @@ void Win_GParted::set_valid_operations()
|
|||
selected_partition .status == GParted::STAT_REAL &&
|
||||
copied_partition != selected_partition )
|
||||
allow_paste( true ) ;
|
||||
|
||||
//see if we can somehow check/repair this filesystem....
|
||||
if ( fs .check && selected_partition .status == GParted::STAT_REAL )
|
||||
allow_check( true ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1748,10 +1760,19 @@ void Win_GParted::activate_manage_flags()
|
|||
if ( dialog .any_change )
|
||||
menu_gparted_refresh_devices() ;
|
||||
}
|
||||
|
||||
void Win_GParted::activate_check()
|
||||
{
|
||||
Operation *operation = new OperationCheck( devices[ current_device ], selected_partition ) ;
|
||||
|
||||
operation ->icon = render_icon( Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU );
|
||||
|
||||
Add_Operation( operation ) ;
|
||||
}
|
||||
|
||||
void Win_GParted::activate_undo()
|
||||
{
|
||||
//when undoing an creation it's safe to decrease the newcount by one
|
||||
//when undoing a creation it's safe to decrease the newcount by one
|
||||
if ( operations .back() ->type == OPERATION_CREATE )
|
||||
new_count-- ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue