[gparted] Add sector size to device display pane
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Add sector size to device display pane
- Date: Sat, 20 Feb 2010 22:13:27 +0000 (UTC)
commit 19d8f0dfc830e09f2861ecffd756cc3c2b7e9ccc
Author: Curtis Gedak <gedakc gmail com>
Date: Sat Feb 20 15:12:26 2010 -0700
Add sector size to device display pane
Also add sector_size to Device class. This is the start of an
enhancement to add support for devices with sector sizes other
than 512 bytes (#607165).
include/Device.h | 4 +++-
src/Device.cc | 3 ++-
src/GParted_Core.cc | 1 +
src/Win_GParted.cc | 11 ++++++++++-
4 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/include/Device.h b/include/Device.h
index 434f096..6a732b7 100644
--- a/include/Device.h
+++ b/include/Device.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2004 Bart
+/* Copyright (C) 2004 Bart
+ * Copyright (C) 2010 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
@@ -47,6 +48,7 @@ public:
Sector cylsize ;
Glib::ustring model;
Glib::ustring disktype;
+ int sector_size ;
int max_prims ;
int highest_busy ;
bool readonly ;
diff --git a/src/Device.cc b/src/Device.cc
index 3241d6f..76026f6 100644
--- a/src/Device.cc
+++ b/src/Device.cc
@@ -1,4 +1,5 @@
/* Copyright (C) 2004 Bart
+ * Copyright (C) 2010 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
@@ -32,7 +33,7 @@ void Device::Reset()
length = cylsize = 0 ;
heads = sectors = cylinders = 0 ;
model = disktype = "" ;
- max_prims = highest_busy = 0 ;
+ sector_size = max_prims = highest_busy = 0 ;
readonly = false ;
}
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 1242ef0..b6f064c 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -297,6 +297,7 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
temp_device .add_paths( get_alternate_paths( temp_device .get_path() ) ) ;
temp_device .model = lp_device ->model ;
+ temp_device .sector_size = lp_device ->sector_size ;
temp_device .heads = lp_device ->bios_geom .heads ;
temp_device .sectors = lp_device ->bios_geom .sectors ;
temp_device .cylinders = lp_device ->bios_geom .cylinders ;
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index f8cb6f5..25976c5 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -510,7 +510,15 @@ void Win_GParted::init_device_info()
Gtk::FILL );
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
-
+
+ //sector size
+ table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Sector size:") ) + "</b>" ),
+ 0, 1,
+ top, bottom,
+ Gtk::FILL );
+ device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
+ table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
+
vbox_info .pack_start( *table, Gtk::PACK_SHRINK );
}
@@ -640,6 +648,7 @@ void Win_GParted::Fill_Label_Device_Info( bool clear )
device_info[ t++ ] ->set_text( Utils::num_to_str( devices[ current_device ] .sectors ) );
device_info[ t++ ] ->set_text( Utils::num_to_str( devices[ current_device ] .cylinders ) );
device_info[ t++ ] ->set_text( Utils::num_to_str( devices[ current_device ] .length ) );
+ device_info[ t++ ] ->set_text( Utils::num_to_str( devices[ current_device ] .sector_size ) );
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]