gparted r1001 - in trunk: . include src



Author: gedakc
Date: Mon Dec  8 18:23:30 2008
New Revision: 1001
URL: http://svn.gnome.org/viewvc/gparted?rev=1001&view=rev

Log:
Reduced FS_Info cache disk reads

Modified:
   trunk/ChangeLog
   trunk/include/FS_Info.h
   trunk/src/FS_Info.cc
   trunk/src/GParted_Core.cc

Modified: trunk/include/FS_Info.h
==============================================================================
--- trunk/include/FS_Info.h	(original)
+++ trunk/include/FS_Info.h	Mon Dec  8 18:23:30 2008
@@ -27,13 +27,14 @@
 {
 public:
 	FS_Info() ;
+	FS_Info( bool do_refresh ) ;
 	~FS_Info() ;
 	Glib::ustring get_label( const Glib::ustring & path, bool & found ) ;
 	Glib::ustring get_uuid( const Glib::ustring & path ) ;
 private:
 	void load_fs_info_cache() ;
 	Glib::ustring get_device_entry( const Glib::ustring & path ) ;
-	Glib::ustring fs_info_cache ;
+	static Glib::ustring fs_info_cache ;
 };
 
 }//GParted

Modified: trunk/src/FS_Info.cc
==============================================================================
--- trunk/src/FS_Info.cc	(original)
+++ trunk/src/FS_Info.cc	Mon Dec  8 18:23:30 2008
@@ -19,10 +19,21 @@
 
 namespace GParted
 {
-	
+
+//initialize static data element
+Glib::ustring FS_Info::fs_info_cache = "";
+
 FS_Info::FS_Info()
 {
-	load_fs_info_cache() ;
+	//Ensure that cache has been loaded at least once
+	if ( fs_info_cache == "" )
+		load_fs_info_cache() ;
+}
+
+FS_Info:: FS_Info( bool do_refresh )
+{
+	if ( do_refresh )
+		load_fs_info_cache() ;
 }
 
 FS_Info::~FS_Info()

Modified: trunk/src/GParted_Core.cc
==============================================================================
--- trunk/src/GParted_Core.cc	(original)
+++ trunk/src/GParted_Core.cc	Mon Dec  8 18:23:30 2008
@@ -143,6 +143,7 @@
 {
 	devices .clear() ;
 	Device temp_device ;
+	FS_Info fs_info( true ) ;  //Refresh cache of file system information
 	
 	init_maps() ;
 	
@@ -633,7 +634,7 @@
 {
 	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
+	FS_Info fs_info ;  //Use cache of file system information
 	
 	//clear partitions
 	device .partitions .clear() ;



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