[gnome-disk-utility/udisks2-port] Show disk name in red if its SMART status indicates that it's failing
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/udisks2-port] Show disk name in red if its SMART status indicates that it's failing
- Date: Sun, 4 Sep 2011 14:58:25 +0000 (UTC)
commit 16086f471e06a4d52d8c67c6899b1e674f05fdf1
Author: David Zeuthen <davidz redhat com>
Date: Sun Sep 4 10:57:17 2011 -0400
Show disk name in red if its SMART status indicates that it's failing
Signed-off-by: David Zeuthen <davidz redhat com>
src/palimpsest/gdudevicetreemodel.c | 34 +++++++++++++++++++++++++++-------
src/palimpsest/gdudevicetreemodel.h | 1 +
2 files changed, 28 insertions(+), 7 deletions(-)
---
diff --git a/src/palimpsest/gdudevicetreemodel.c b/src/palimpsest/gdudevicetreemodel.c
index 73433b7..b073e21 100644
--- a/src/palimpsest/gdudevicetreemodel.c
+++ b/src/palimpsest/gdudevicetreemodel.c
@@ -331,7 +331,8 @@ gdu_device_tree_model_constructed (GObject *object)
types[3] = G_TYPE_ICON;
types[4] = G_TYPE_STRING;
types[5] = G_TYPE_DBUS_OBJECT;
- G_STATIC_ASSERT (6 == GDU_DEVICE_TREE_MODEL_N_COLUMNS);
+ types[6] = G_TYPE_BOOLEAN;
+ G_STATIC_ASSERT (7 == GDU_DEVICE_TREE_MODEL_N_COLUMNS);
gtk_tree_store_set_column_types (GTK_TREE_STORE (model),
GDU_DEVICE_TREE_MODEL_N_COLUMNS,
types);
@@ -504,6 +505,7 @@ update_drive (GduDeviceTreeModel *model,
UDisksObject *object)
{
UDisksDrive *drive = NULL;
+ UDisksDriveAta *ata = NULL;
GIcon *drive_icon = NULL;
GIcon *media_icon = NULL;
gchar *name = NULL;
@@ -511,6 +513,7 @@ update_drive (GduDeviceTreeModel *model,
gchar *media_description = NULL;
gchar *s = NULL;
gchar *sort_key = NULL;
+ gboolean warning = FALSE;
GtkTreeIter iter;
if (!find_iter_for_object (model,
@@ -523,20 +526,37 @@ update_drive (GduDeviceTreeModel *model,
}
drive = udisks_object_peek_drive (object);
-
- udisks_util_get_drive_info (drive, &name, &description, &drive_icon, &media_description, &media_icon);
- s = g_strdup_printf ("%s\n"
- "<small><span foreground=\"#555555\">%s</span></small>",
- description,
- name);
+ ata = udisks_object_peek_drive_ata (object);
sort_key = g_strdup_printf ("00_drives_1_%s", udisks_drive_get_sort_key (drive));
+ if (ata != NULL && udisks_drive_ata_get_smart_failing (ata))
+ {
+ warning = TRUE;
+ }
+
+ udisks_util_get_drive_info (drive, &name, &description, &drive_icon, &media_description, &media_icon);
+ if (warning)
+ {
+ s = g_strdup_printf ("<span foreground=\"#ff0000\">%s</span>\n"
+ "<small><span foreground=\"#ff0000\">%s</span></small>",
+ description,
+ name);
+ }
+ else
+ {
+ s = g_strdup_printf ("%s\n"
+ "<small><span foreground=\"#555555\">%s</span></small>",
+ description,
+ name);
+ }
+
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
GDU_DEVICE_TREE_MODEL_COLUMN_ICON, drive_icon,
GDU_DEVICE_TREE_MODEL_COLUMN_NAME, s,
GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, sort_key,
+ GDU_DEVICE_TREE_MODEL_COLUMN_WARNING, warning,
-1);
out:
diff --git a/src/palimpsest/gdudevicetreemodel.h b/src/palimpsest/gdudevicetreemodel.h
index 1396aad..d110d00 100644
--- a/src/palimpsest/gdudevicetreemodel.h
+++ b/src/palimpsest/gdudevicetreemodel.h
@@ -40,6 +40,7 @@ enum
GDU_DEVICE_TREE_MODEL_COLUMN_ICON,
GDU_DEVICE_TREE_MODEL_COLUMN_NAME,
GDU_DEVICE_TREE_MODEL_COLUMN_OBJECT,
+ GDU_DEVICE_TREE_MODEL_COLUMN_WARNING,
GDU_DEVICE_TREE_MODEL_N_COLUMNS
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]