From ed9b5afe369303fa66cceda99f23f752a4a9fcfe Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Tue, 11 Nov 2008 17:21:22 +0000 Subject: [PATCH] Added read UUID read display svn path=/trunk/; revision=961 --- ChangeLog | 6 ++++++ include/Partition.h | 3 ++- src/Dialog_Partition_Info.cc | 17 +++++++++++++++-- src/GParted_Core.cc | 9 ++++++++- src/Partition.cc | 3 ++- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a583bda1..e0e2d340 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-11-11 Curtis Gedak + * src/Dialog_Partition_Info.cc, + src/GParted_Core.cc: Added read UUID read display. + + * include/Partition.h, + src/Partition.h: Added UUID. + * include/FS_Info.h, include/Makefile.am, src/FS_Info.cc, diff --git a/include/Partition.h b/include/Partition.h index 86dcfd45..7f9f2d1d 100644 --- a/include/Partition.h +++ b/include/Partition.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Bart +/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort * * 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 @@ -99,6 +99,7 @@ public: PartitionStatus status; //STAT_REAL, STAT_NEW, etc.. FILESYSTEM filesystem ; Glib::ustring label ; + Glib::ustring uuid ; Sector sector_start; Sector sector_end; Sector sectors_used; diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc index 2274459e..94123f9e 100644 --- a/src/Dialog_Partition_Info.cc +++ b/src/Dialog_Partition_Info.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Bart +/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort * * 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 @@ -271,7 +271,20 @@ void Dialog_Partition_Info::Display_Info() top++, bottom++, Gtk::FILL) ; } - + + //uuid + if ( partition.type != GParted::TYPE_UNALLOCATED && partition.type != GParted::TYPE_EXTENDED ) + { + table ->attach( * Utils::mk_label( "" + Glib::ustring( _("UUID:") ) + ""), + 0, 1, + top, bottom, + Gtk::FILL) ; + table ->attach( * Utils::mk_label( partition .uuid ), + 1, 2, + top++, bottom++, + Gtk::FILL) ; + } + //one blank line table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ; diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index db216289..90c6695e 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -17,6 +17,7 @@ #include "../include/Win_GParted.h" #include "../include/GParted_Core.h" +#include "../include/FS_Info.h" #include "../include/OperationCopy.h" #include "../include/OperationCreate.h" #include "../include/OperationDelete.h" @@ -676,6 +677,7 @@ void GParted_Core::set_device_partitions( Device & device ) { int EXT_INDEX = -1 ; char * lp_path ;//we have to free the result of ped_partition_get_path().. + FS_Info fs_info ; //Build cache of file system information //clear partitions device .partitions .clear() ; @@ -733,7 +735,12 @@ void GParted_Core::set_device_partitions( Device & device ) break; } - read_label( partition_temp ) ; + //Avoid reading additional file system information if there is no path + //FIXME: Why is there an empty path for the first primary partition, and an empty path for each logical partition? + if ( partition_temp .get_path() != "" ) { + read_label( partition_temp ) ; + partition_temp .uuid = fs_info .get_uuid( partition_temp .get_path() ) ; + } partition_temp .messages .insert( partition_temp .messages .end(), libparted_messages. begin(), diff --git a/src/Partition.cc b/src/Partition.cc index e76ab7c9..fac41e98 100644 --- a/src/Partition.cc +++ b/src/Partition.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Bart +/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort * * 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 @@ -40,6 +40,7 @@ void Partition::Reset() type = GParted::TYPE_UNALLOCATED ; filesystem = GParted::FS_UNALLOCATED ; label .clear() ; + uuid .clear() ; partition_number = sector_start = sector_end = sectors_used = sectors_unused = -1; color .set( "black" ) ; inside_extended = busy = strict = false ;