[gparted] Display ext2/3/4 unicode volume labels properly (#662537)



commit cf8293cf78efe2e2e8b9b74279083c1f986d236e
Author: Curtis Gedak <gedakc gmail com>
Date:   Tue Nov 1 13:01:02 2011 -0600

    Display ext2/3/4 unicode volume labels properly (#662537)
    
    Note that this enhancement changes GParted to first try the native
    tools to determine the volume label for all file systems.  If the
    volume label is not found then the fall back method is to use blkid.
    
    There is a small degradation in device refresh times as a result of
    this change.
    
    Closes Bug #662537 - Ext4 unicode labels not shown correctly

 src/GParted_Core.cc |   13 +++++++------
 src/ext2.cc         |    4 ++--
 src/ext3.cc         |    4 ++--
 src/ext4.cc         |    4 ++--
 4 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index a2e7557..4469a38 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -995,14 +995,15 @@ void GParted_Core::set_device_partitions( Device & device )
 				break;
 		}
 
-		//Avoid reading additional file system information if there is no path
+		//Retrieve file system label
 		if ( partition_temp .get_path() != "" )
 		{
-			bool label_found = false ;
-			partition_temp .label = fs_info .get_label( partition_temp .get_path(), label_found ) ;
-			if ( ! label_found )
-				read_label( partition_temp ) ;
-
+			read_label( partition_temp ) ;
+			if ( partition_temp .label .empty() )
+			{
+				bool label_found = false ;
+				partition_temp .label = fs_info .get_label( partition_temp .get_path(), label_found ) ;
+			}
 			partition_temp .uuid = fs_info .get_uuid( partition_temp .get_path() ) ;
 		}
 
diff --git a/src/ext2.cc b/src/ext2.cc
index 806c731..d2eff7f 100644
--- a/src/ext2.cc
+++ b/src/ext2.cc
@@ -1,5 +1,5 @@
 /* Copyright (C) 2004 Bart
- * Copyright (C) 2008, 2009, 2010 Curtis Gedak
+ * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak
  *
  *  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
@@ -88,7 +88,7 @@ void ext2::read_label( Partition & partition )
 {
 	if ( ! Utils::execute_command( "e2label " + partition .get_path(), output, error, true ) )
 	{
-		partition .label = Utils::regexp_label( output, "^(.*)" ) ;
+		partition .label = Utils::trim( output ) ;
 	}
 	else
 	{
diff --git a/src/ext3.cc b/src/ext3.cc
index 23788a1..d9e6cd5 100644
--- a/src/ext3.cc
+++ b/src/ext3.cc
@@ -1,5 +1,5 @@
 /* Copyright (C) 2004 Bart
- * Copyright (C) 2008, 2009, 2010 Curtis Gedak
+ * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak
  *
  *  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
@@ -89,7 +89,7 @@ void ext3::read_label( Partition & partition )
 {
 	if ( ! Utils::execute_command( "e2label " + partition .get_path(), output, error, true ) )
 	{
-		partition .label = Utils::regexp_label( output, "^(.*)" ) ;
+		partition .label = Utils::trim( output ) ;
 	}
 	else
 	{
diff --git a/src/ext4.cc b/src/ext4.cc
index b837c52..4f5546e 100644
--- a/src/ext4.cc
+++ b/src/ext4.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009, 2010 Curtis Gedak
+/* Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak
  *
  *  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
@@ -92,7 +92,7 @@ void ext4::read_label( Partition & partition )
 {
 	if ( ! Utils::execute_command( "e2label " + partition .get_path(), output, error, true ) )
 	{
-		partition .label = Utils::regexp_label( output, "^(.*)" ) ;
+		partition .label = Utils::trim( output ) ;
 	}
 	else
 	{



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