show warning in progressfeedback if a certain action is n/a. Of course we

* include/Dialog_Progress.h,
  include/Operation.h,
  src/Dialog_Progress.cc,
  src/GParted_Core.cc: show warning in progressfeedback if a certain
  action is n/a. Of course we only allow these actions if the results
  are non-lethal.
This commit is contained in:
Bart Hakvoort 2006-07-19 20:54:08 +00:00
parent 9e32399727
commit f7722d2bbf
5 changed files with 44 additions and 5 deletions

View File

@ -1,3 +1,12 @@
2006-07-19 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Dialog_Progress.h,
include/Operation.h,
src/Dialog_Progress.cc,
src/GParted_Core.cc: show warning in progressfeedback if a certain
action is n/a. Of course we only allow these actions if the results
are non-lethal.
2006-07-19 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-07-19 Bart Hakvoort <hakvoort@cvs.gnome.org>
* enabled move support for all the filesystems. Also made some small * enabled move support for all the filesystems. Also made some small

View File

@ -66,6 +66,7 @@ private:
Glib::RefPtr<Gdk::Pixbuf> icon_execute ; Glib::RefPtr<Gdk::Pixbuf> icon_execute ;
Glib::RefPtr<Gdk::Pixbuf> icon_succes ; Glib::RefPtr<Gdk::Pixbuf> icon_succes ;
Glib::RefPtr<Gdk::Pixbuf> icon_error ; Glib::RefPtr<Gdk::Pixbuf> icon_error ;
Glib::RefPtr<Gdk::Pixbuf> icon_n_a ;
Glib::RefPtr<Gtk::TreeStore> treestore_operations; Glib::RefPtr<Gtk::TreeStore> treestore_operations;

View File

@ -37,7 +37,8 @@ struct OperationDetails
NONE = -1, NONE = -1,
EXECUTE = 0, EXECUTE = 0,
SUCCES = 1, SUCCES = 1,
ERROR = 2 ERROR = 2,
N_A = 3
}; };
OperationDetails() OperationDetails()

View File

@ -61,6 +61,7 @@ Dialog_Progress::Dialog_Progress( const std::vector<Operation *> & operations )
icon_execute = render_icon( Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ; icon_execute = render_icon( Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
icon_succes = render_icon( Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ; icon_succes = render_icon( Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
icon_error = render_icon( Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ; icon_error = render_icon( Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
icon_n_a = render_icon( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
treestore_operations = Gtk::TreeStore::create( treeview_operations_columns ); treestore_operations = Gtk::TreeStore::create( treeview_operations_columns );
treeview_operations .set_model( treestore_operations ); treeview_operations .set_model( treestore_operations );
@ -140,7 +141,11 @@ void Dialog_Progress::update_operation_details( const Gtk::TreeRow & treerow,
treerow[ treeview_operations_columns .status_icon ] = icon_error ; treerow[ treeview_operations_columns .status_icon ] = icon_error ;
break ; break ;
case OperationDetails::N_A:
treerow[ treeview_operations_columns .status_icon ] = icon_n_a ;
break ;
default : default :
treerow[ treeview_operations_columns .hidden_status ] = OperationDetails::NONE ; treerow[ treeview_operations_columns .hidden_status ] = OperationDetails::NONE ;
break ; break ;

View File

@ -1593,13 +1593,23 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old,
} }
} }
//FIXME: perform checks in maximize_filesystem(), resize_filesystem() and check_repair() to see if
//the specified action is supported. if not, return true, but set status of operation to NOT_AVAILABLE
//(or maybe we should simply skip the entire suboperation?) maybe only maximize and check_repair are relevant..
bool GParted_Core::maximize_filesystem( const Partition & partition, bool GParted_Core::maximize_filesystem( const Partition & partition,
std::vector<OperationDetails> & operation_details ) std::vector<OperationDetails> & operation_details )
{ {
operation_details .push_back( OperationDetails( _("grow filesystem to fill the partition") ) ) ; operation_details .push_back( OperationDetails( _("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 ) ) ;
operation_details .back() .status = OperationDetails::N_A ;
return true ;
}
return resize_filesystem( partition, partition, operation_details, 0, true ) ; return resize_filesystem( partition, partition, operation_details, 0, true ) ;
} }
@ -1946,6 +1956,19 @@ bool GParted_Core::check_repair( const Partition & partition, std::vector<Operat
String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"),
partition .get_path() ) ) ) ; 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 ) ) ;
operation_details .back() .status = OperationDetails::N_A ;
return true ;
}
set_proper_filesystem( partition .filesystem ) ; set_proper_filesystem( partition .filesystem ) ;
if ( p_filesystem && p_filesystem ->Check_Repair( partition, operation_details .back() .sub_details ) ) if ( p_filesystem && p_filesystem ->Check_Repair( partition, operation_details .back() .sub_details ) )