[gparted] Display encrypted file system colour correctly in the disk graphic (#760080)



commit a58e85d1935f5596d38e89a6d2ffd49ca5f34dbe
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Thu Dec 31 13:21:17 2015 +0000

    Display encrypted file system colour correctly in the disk graphic (#760080)
    
    In the main window disk graphic, when there is an open dm-crypt mapping,
    display the colour of the encrypted file system.
    
    Bug 760080 - Implement read-only LUKS support

 src/DrawingAreaVisualDisk.cc |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/DrawingAreaVisualDisk.cc b/src/DrawingAreaVisualDisk.cc
index 839af7d..3c98ab1 100644
--- a/src/DrawingAreaVisualDisk.cc
+++ b/src/DrawingAreaVisualDisk.cc
@@ -17,6 +17,7 @@
 
 #include "../include/DrawingAreaVisualDisk.h"
 #include "../include/Partition.h"
+#include "../include/PartitionLUKS.h"
 #include "../include/PartitionVector.h"
 #include "../include/Utils.h"
 
@@ -99,7 +100,13 @@ void DrawingAreaVisualDisk::set_static_data( const PartitionVector & partitions,
                Sector partition_length = partitions[ t ] .get_sector_length() ;
                visual_partitions .back() .fraction = partition_length / static_cast<double>( length ) ;
 
-               visual_partitions.back().color.set( Utils::get_color( partitions[t].filesystem ) );
+               Glib::ustring color_str = Utils::get_color( partitions[t].filesystem );
+               if ( partitions[t].filesystem == FS_LUKS && partitions[t].busy )
+               {
+                       const Partition & encrypted = dynamic_cast<const PartitionLUKS *>( &partitions[t] 
)->get_encrypted();
+                       color_str = Utils::get_color( encrypted.filesystem );
+               }
+               visual_partitions.back().color.set( color_str );
                get_colormap() ->alloc_color( visual_partitions .back() .color );
 
                if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]