Implement label operation on encrypted file systems (#774818)

Again, just need to change the code when composing, describing and
implementing the operation to query and set the Partition object
directly containing the file system, instead of the enclosing encryption
mapping to make it work.

Bug 774818 - Implement LUKS read-write actions NOT requiring a
             passphrase
This commit is contained in:
Mike Fleetwood 2016-09-08 14:13:31 +01:00 committed by Curtis Gedak
parent 8e41a5f712
commit ff4ac89ba2
3 changed files with 9 additions and 7 deletions

View File

@ -660,7 +660,8 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
case OPERATION_LABEL_FILESYSTEM:
success = calibrate_partition( operation->get_partition_new(), operation->operation_detail )
&& label_filesystem( operation->get_partition_new(), operation->operation_detail );
&& label_filesystem( operation->get_partition_new().get_filesystem_partition(),
operation->operation_detail );
break;
case OPERATION_NAME_PARTITION:

View File

@ -49,7 +49,7 @@ void OperationLabelFileSystem::create_description()
{
g_assert( partition_new != NULL ); // Bug: Not initialised by constructor or reset later
if( partition_new->get_filesystem_label().empty() )
if( partition_new->get_filesystem_partition().get_filesystem_label().empty() )
{
/* TO TRANSLATORS: looks like Clear file system Label on /dev/hda3 */
description = String::ucompose( _("Clear file system label on %1"),
@ -59,7 +59,7 @@ void OperationLabelFileSystem::create_description()
{
/* TO TRANSLATORS: looks like Set file system label "My Label" on /dev/hda3 */
description = String::ucompose( _("Set file system label \"%1\" on %2"),
partition_new->get_filesystem_label(),
partition_new->get_filesystem_partition().get_filesystem_label(),
partition_new->get_path() );
}
}

View File

@ -1238,7 +1238,7 @@ void Win_GParted::set_valid_operations()
allow_copy( true ) ;
//only allow labelling of real partitions that support labelling
if ( selected_partition_ptr->status == STAT_REAL && fs.write_label )
if ( selected_partition_ptr->status == STAT_REAL && fs_cap.write_label )
allow_label_filesystem( true );
//only allow changing UUID of real partitions that support it
@ -2675,17 +2675,18 @@ void Win_GParted::activate_label_filesystem()
g_assert( selected_partition_ptr != NULL ); // Bug: Partition callback without a selected partition
g_assert( valid_display_partition_ptr( selected_partition_ptr ) ); // Bug: Not pointing at a valid display partition object
Dialog_FileSystem_Label dialog( *selected_partition_ptr );
const Partition & filesystem_ptn = selected_partition_ptr->get_filesystem_partition();
Dialog_FileSystem_Label dialog( filesystem_ptn );
dialog .set_transient_for( *this );
if ( dialog .run() == Gtk::RESPONSE_OK
&& dialog.get_new_label() != selected_partition_ptr->get_filesystem_label() )
&& dialog.get_new_label() != filesystem_ptn.get_filesystem_label() )
{
dialog .hide() ;
// Make a duplicate of the selected partition (used in UNDO)
Partition * part_temp = selected_partition_ptr->clone();
part_temp->set_filesystem_label( dialog.get_new_label() );
part_temp->get_filesystem_partition().set_filesystem_label( dialog.get_new_label() );
Operation * operation = new OperationLabelFileSystem( devices[current_device],
*selected_partition_ptr, *part_temp );