[gnome-disk-utility] Show vendor recommended AAM level and use it as a default
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Show vendor recommended AAM level and use it as a default
- Date: Tue, 3 Jul 2012 11:07:16 +0000 (UTC)
commit f945f01635da50ff5934953822e01d2776fb6113
Author: David Zeuthen <zeuthen gmail com>
Date: Tue Jul 3 07:06:51 2012 -0400
Show vendor recommended AAM level and use it as a default
Signed-off-by: David Zeuthen <zeuthen gmail com>
data/ui/disk-settings-dialog.ui | 43 ++++++++++++++++++++++++++++++++++--
src/disks/gdudisksettingsdialog.c | 13 +++++++++-
2 files changed, 51 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/disk-settings-dialog.ui b/data/ui/disk-settings-dialog.ui
index 9b8f866..12829d8 100644
--- a/data/ui/disk-settings-dialog.ui
+++ b/data/ui/disk-settings-dialog.ui
@@ -403,6 +403,43 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
+ <object class="GtkBox" id="box4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="aam-vendor-recommended-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Vendor Recommended</property>
+ <style><class name="dim-label"/></style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="aam-vendor-recommended-value-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -436,7 +473,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -450,7 +487,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
@@ -486,11 +523,11 @@
<widgets>
<widget name="standby-label"/>
<widget name="apm-label"/>
+ <widget name="aam-vendor-recommended-label"/>
<widget name="aam-label"/>
</widgets>
</object>
<object class="GtkAdjustment" id="standby-adjustment">
- <property name="lower">0</property>
<property name="upper">255</property>
<property name="value">60</property>
<property name="step_increment">1</property>
diff --git a/src/disks/gdudisksettingsdialog.c b/src/disks/gdudisksettingsdialog.c
index 3b186d8..2ef9f7f 100644
--- a/src/disks/gdudisksettingsdialog.c
+++ b/src/disks/gdudisksettingsdialog.c
@@ -70,6 +70,7 @@ typedef struct
GtkWidget *aam_box;
GtkWidget *aam_switch;
GtkWidget *aam_widgets_box;
+ GtkWidget *aam_vendor_recommended_value_label;
GtkWidget *aam_value_label;
GtkWidget *aam_scale;
GtkAdjustment *aam_adjustment;
@@ -103,6 +104,7 @@ static const struct {
{G_STRUCT_OFFSET (DialogData, aam_switch), "aam-switch"},
{G_STRUCT_OFFSET (DialogData, aam_widgets_box), "aam-widgets-box"},
{G_STRUCT_OFFSET (DialogData, aam_value_label), "aam-value-label"},
+ {G_STRUCT_OFFSET (DialogData, aam_vendor_recommended_value_label), "aam-vendor-recommended-value-label"},
{G_STRUCT_OFFSET (DialogData, aam_scale), "aam-scale"},
{G_STRUCT_OFFSET (DialogData, aam_adjustment), "aam-adjustment"},
@@ -350,6 +352,10 @@ update_aam_label (DialogData *data)
}
gtk_label_set_text (GTK_LABEL (data->aam_value_label), s);
g_free (s);
+
+ s = g_strdup_printf ("%d", udisks_drive_ata_get_aam_vendor_recommended_value (data->ata));
+ gtk_label_set_text (GTK_LABEL (data->aam_vendor_recommended_value_label), s);
+ g_free (s);
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -509,11 +515,14 @@ gdu_disk_settings_dialog_show (GduWindow *window,
gtk_switch_set_active (GTK_SWITCH (data->apm_switch), TRUE);
}
- /* AAM (default to 128) */
+ /* AAM (default to vendor recommended value, if available, otherwise default to 254) */
if (aam_value == -1)
{
+ gint default_value = udisks_drive_ata_get_aam_vendor_recommended_value (data->ata);
+ if (default_value < 128 || default_value > 254)
+ default_value = 254;
gtk_switch_set_active (GTK_SWITCH (data->aam_switch), FALSE);
- gtk_adjustment_set_value (data->aam_adjustment, 128);
+ gtk_adjustment_set_value (data->aam_adjustment, default_value);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]