[gparted] Display progress for mke2fs (#467925)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Display progress for mke2fs (#467925)
- Date: Fri, 18 Dec 2015 16:30:25 +0000 (UTC)
commit baea186138cc08cac1f13f28300ca0f4b09ae16d
Author: Phillip Susi <psusi ubuntu com>
Date: Sat Mar 2 10:24:54 2013 -0500
Display progress for mke2fs (#467925)
Bug 467925 - gparted: add progress bar during operation
include/ext2.h | 1 +
src/ext2.cc | 25 ++++++++++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/include/ext2.h b/include/ext2.h
index 96df48e..fddf48f 100644
--- a/include/ext2.h
+++ b/include/ext2.h
@@ -55,6 +55,7 @@ public:
private:
void resize_progress( OperationDetail *operationdetail );
+ void create_progress( OperationDetail *operationdetail );
};
} //GParted
diff --git a/src/ext2.cc b/src/ext2.cc
index bf653dd..6a11db5 100644
--- a/src/ext2.cc
+++ b/src/ext2.cc
@@ -220,9 +220,12 @@ bool ext2::write_uuid( const Partition & partition, OperationDetail & operationd
bool ext2::create( const Partition & new_partition, OperationDetail & operationdetail )
{
- return ! execute_command( mkfs_cmd + " -F -L \"" + new_partition.get_filesystem_label() + "\" " +
- new_partition.get_path(),
- operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
+ sigc::connection c = signal_progress.connect( sigc::mem_fun( *this, &ext2::create_progress ) );
+ bool ret = ! execute_command( mkfs_cmd + " -F -L \"" + new_partition.get_filesystem_label() + "\" " +
+ new_partition.get_path(),
+ operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
+ c.disconnect();
+ return ret;
}
bool ext2::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -304,4 +307,20 @@ void ext2::resize_progress( OperationDetail *operationdetail )
operationdetail->signal_update( *operationdetail );
}
+void ext2::create_progress( OperationDetail *operationdetail )
+{
+ Glib::ustring ss;
+ size_t p = output.find_last_of('\n');
+ // looks like "Writing inode tables: xx/yy"
+ if ( p == output.npos )
+ return;
+ ss = output.substr( p );
+ int x, y;
+ if ( sscanf( ss.c_str(), "\nWriting inode tables: %d/%d", &x, &y ) == 2 )
+ {
+ operationdetail->fraction = (double)x / y;
+ operationdetail->signal_update( *operationdetail );
+ }
+}
+
} //GParted
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]