[gnome-disk-utility] Don't show "standby timeout" setting for SSD drives



commit accfd1fa2ef95db4a29f5c5e1f4a04266cfc05c7
Author: David Zeuthen <zeuthen gmail com>
Date:   Tue Jun 26 15:54:47 2012 -0400

    Don't show "standby timeout" setting for SSD drives
    
    Some SSD drives (erroneously?) has support for the standby timeout
    timer (hdparm -S) even though it doesn't make much sense as is
    intended for spinning down drives.
    
    So disable it for now. If it turns out that this is actually used for
    something in SSDs we can bring it back...
    
    Signed-off-by: David Zeuthen <zeuthen gmail com>

 src/disks/gdudisksettingsdialog.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/disks/gdudisksettingsdialog.c b/src/disks/gdudisksettingsdialog.c
index 44a5d69..e399ffe 100644
--- a/src/disks/gdudisksettingsdialog.c
+++ b/src/disks/gdudisksettingsdialog.c
@@ -591,9 +591,14 @@ hide_forever (GtkWidget *widget)
 static void
 disable_unused_widgets (DialogData *data)
 {
+  gboolean is_ssd = FALSE;
+
   /* Disable widgets not relevant for a drive - see also gdu_disk_settings_dialog_should_show() */
 
-  if (!udisks_drive_ata_get_pm_supported (data->ata))
+  if (udisks_drive_get_rotation_rate (data->drive) == 0)
+    is_ssd = TRUE;
+
+  if (!udisks_drive_ata_get_pm_supported (data->ata) || is_ssd)
     hide_forever (data->standby_box);
 
   if (!udisks_drive_ata_get_apm_supported (data->ata))
@@ -609,6 +614,7 @@ gdu_disk_settings_dialog_should_show (UDisksObject *object)
   gboolean ret = FALSE;
   UDisksDrive *drive;
   UDisksDriveAta *ata;
+  gboolean is_ssd = FALSE;
 
   g_return_val_if_fail (UDISKS_IS_OBJECT (object), FALSE);
 
@@ -622,7 +628,10 @@ gdu_disk_settings_dialog_should_show (UDisksObject *object)
   if (ata == NULL)
     goto out;
 
-  if (udisks_drive_ata_get_pm_supported (ata) ||
+  if (udisks_drive_get_rotation_rate (drive) == 0)
+    is_ssd = TRUE;
+
+  if ((udisks_drive_ata_get_pm_supported (ata) && !is_ssd) ||
       udisks_drive_ata_get_apm_supported (ata) ||
       udisks_drive_ata_get_aam_supported (ata))
     {



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