gparted r960 - in trunk: . include src



Author: gedakc
Date: Tue Nov 11 17:19:46 2008
New Revision: 960
URL: http://svn.gnome.org/viewvc/gparted?rev=960&view=rev

Log:
Created class to read file system UUIDs

Added:
   trunk/include/FS_Info.h
   trunk/src/FS_Info.cc
Modified:
   trunk/AUTHORS
   trunk/ChangeLog
   trunk/include/Makefile.am
   trunk/src/Makefile.am

Modified: trunk/AUTHORS
==============================================================================
--- trunk/AUTHORS	(original)
+++ trunk/AUTHORS	Tue Nov 11 17:19:46 2008
@@ -12,13 +12,15 @@
 We need to keep track of copyright (see the Maintainer HOWTO on www.gnu.org).
 
 Curtis Gedak		<gedakc users sourceforge net>
-	* Wrote Utils::fat_compliant_label() method
-	* Wrote Utils::cleanup_cursor() function
+	* Created FS_Info.h, FS_Info.cc
 	* Rewrote read_label functionality for hfs
 	* Wrote create, read_label, and check_repair functionality for hfs+
 	* Wrote read_label functionality for fat16 and fat32 filesystems  
-	* Wrote Utils::regexp_label() function
-	* Wrote write partition label functionality
+	* Wrote following Utils:: methods:
+		regexp_label(), fat_compliant_label(),
+		create_mtoolsrc_file(), delete_mtoolsrc_file,
+		trim(), cleanup_cursor(), get_lang()
+	* Wrote partition write_label functionality
 	* Created Dialog_Partion_Label.h, Dialog_Partition_Label.cc
 	* Created OperationLabelPartition.h, OperationLabelPartition.cc
 	* Maintained from official 0.3.5 release onward 

Added: trunk/include/FS_Info.h
==============================================================================
--- (empty file)
+++ trunk/include/FS_Info.h	Tue Nov 11 17:19:46 2008
@@ -0,0 +1,39 @@
+/* Copyright (C) 2008 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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef FS_INFO_H_
+#define FS_INFO_H_
+
+#include "../include/Utils.h"
+
+namespace GParted
+{
+
+class FS_Info
+{
+public:
+	FS_Info() ;
+	~FS_Info() ;
+	Glib::ustring get_uuid( const Glib::ustring & path ) ;
+private:
+	void load_fs_info_cache() ;
+	Glib::ustring fs_info_cache ;
+};
+
+}//GParted
+
+#endif /*FS_INFO_H_*/

Modified: trunk/include/Makefile.am
==============================================================================
--- trunk/include/Makefile.am	(original)
+++ trunk/include/Makefile.am	Tue Nov 11 17:19:46 2008
@@ -16,6 +16,7 @@
 	FileSystem.h  			\
         Frame_Resizer_Base.h		\
 	Frame_Resizer_Extended.h	\
+	FS_Info.h				\
 	GParted_Core.h    		\
 	HBoxOperations.h    		\
 	Operation.h 			\

Added: trunk/src/FS_Info.cc
==============================================================================
--- (empty file)
+++ trunk/src/FS_Info.cc	Tue Nov 11 17:19:46 2008
@@ -0,0 +1,55 @@
+/* Copyright (C) 2008 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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+ 
+#include "../include/FS_Info.h"
+
+namespace GParted
+{
+	
+FS_Info::FS_Info()
+{
+	load_fs_info_cache() ;
+}
+
+FS_Info::~FS_Info()
+{
+}
+
+void FS_Info::load_fs_info_cache()
+{
+	Glib::ustring output, error ;
+	if ( ! Glib::find_program_in_path( "blkid" ) .empty() )
+	{
+		if ( ! Utils::execute_command( "blkid -c /dev/null", output, error, true ) )
+			fs_info_cache = output ;
+		else
+			fs_info_cache = "" ;
+	}
+}
+
+Glib::ustring FS_Info::get_uuid( const Glib::ustring & path )
+{
+	//Retrieve the line containing the device path
+	Glib::ustring regexp = "^" + path + ":([^\n]*)$" ;
+	Glib::ustring temp = Utils::regexp_label( fs_info_cache, regexp ) ;
+
+	//Retrieve the UUID
+	Glib::ustring uuid = Utils::regexp_label( temp, "UUID=\"([^\"]*)\"" ) ;
+	return uuid ;
+}
+
+}//GParted

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Tue Nov 11 17:19:46 2008
@@ -25,6 +25,7 @@
 	FileSystem.cc			\
 	Frame_Resizer_Base.cc		\
 	Frame_Resizer_Extended.cc	\
+	FS_Info.cc				\
 	GParted_Core.cc			\
 	HBoxOperations.cc		\
 	Operation.cc			\



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