[gparted] Select unallocated whole disk devices again (#788308)



commit fa5ed1fb90d1dd23e9a23b6719a0d567ef8d85f0
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Aug 20 13:20:41 2016 +0100

    Select unallocated whole disk devices again (#788308)
    
    After the change from whole_device flag to TYPE_UNPARTITIONED,
    unallocated whole disk devices are no longer automatically selected
    because the partition type is no longer TYPE_UNALLOCATED.  Fix by
    checking for file system type FS_UNALLOCATED when identifying the
    largest unallocated space.
    
    Bug 788308 - Remove whole_device partition flag

 src/Win_GParted.cc |   59 ++++++++++++++++++++++------------------------------
 1 files changed, 25 insertions(+), 34 deletions(-)
---
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 8e8e047..305c2af 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -941,46 +941,37 @@ void Win_GParted::Refresh_Visual()
                        copied_partition = display_partitions[t].clone();
                }
 
-               switch ( display_partitions[t].type )
+               if ( display_partitions[t].filesystem == FS_UNALLOCATED )
                {
-                       case TYPE_EXTENDED:
-                               for ( unsigned int u = 0 ; u < display_partitions[t].logicals.size() ; u ++ )
-                               {
-                                       if ( copied_partition != NULL &&
-                                            display_partitions[t].logicals[u].get_path() == 
copied_partition->get_path() )
-                                       {
-                                               delete copied_partition;
-                                               copied_partition = display_partitions[t].logicals[u].clone();
-                                       }
+                       current_size = display_partitions[t].get_sector_length();
+                       if ( current_size > largest_unalloc_size )
+                       {
+                               largest_unalloc_size = current_size;
+                               selected_partition_ptr = & display_partitions[t];
+                       }
+               }
 
-                                       switch ( display_partitions[t].logicals[u].type )
-                                       {
-                                               case TYPE_UNALLOCATED:
-                                                       current_size = 
display_partitions[t].logicals[u].get_sector_length();
-                                                       if ( current_size > largest_unalloc_size )
-                                                       {
-                                                               largest_unalloc_size = current_size ;
-                                                               selected_partition_ptr = & 
display_partitions[t].logicals[u];
-                                                       }
-                                                       break;
-
-                                               default:
-                                                       break;
-                                       }
+               if ( display_partitions[t].type == TYPE_EXTENDED )
+               {
+                       for ( unsigned int u = 0 ; u < display_partitions[t].logicals.size() ; u ++ )
+                       {
+                               if ( copied_partition != NULL &&
+                                    display_partitions[t].logicals[u].get_path() == 
copied_partition->get_path() )
+                               {
+                                       delete copied_partition;
+                                       copied_partition = display_partitions[t].logicals[u].clone();
                                }
-                               break;
 
-                       case TYPE_UNALLOCATED:
-                               current_size = display_partitions[t].get_sector_length();
-                               if ( current_size > largest_unalloc_size )
+                               if ( display_partitions[t].logicals[u].filesystem == FS_UNALLOCATED )
                                {
-                                       largest_unalloc_size = current_size ;
-                                       selected_partition_ptr = & display_partitions[t];
+                                       current_size = display_partitions[t].logicals[u].get_sector_length();
+                                       if ( current_size > largest_unalloc_size )
+                                       {
+                                               largest_unalloc_size = current_size;
+                                               selected_partition_ptr = & display_partitions[t].logicals[u];
+                                       }
                                }
-                               break;
-
-                       default                         :
-                               break;
+                       }
                }
        }
 


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