summaryrefslogtreecommitdiff
path: root/src/udiskslinuxdrive.c
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2011-08-15 10:57:29 -0400
committerDavid Zeuthen <davidz@redhat.com>2011-08-15 10:57:29 -0400
commitc9ec20ce4871bac7c56eade6e73c9fc267c16b9c (patch)
tree9c5ddf82446eee7870d22f7027a8ee7d3c917927 /src/udiskslinuxdrive.c
parent68c6a224e5eecbdd0082ae20cf62dfe6610d35f4 (diff)
Add a sorting key for drives
Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'src/udiskslinuxdrive.c')
-rw-r--r--src/udiskslinuxdrive.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/udiskslinuxdrive.c b/src/udiskslinuxdrive.c
index 408828e..81ef377 100644
--- a/src/udiskslinuxdrive.c
+++ b/src/udiskslinuxdrive.c
@@ -68,6 +68,8 @@ struct _UDisksLinuxDrive
gboolean ata_smart_failing;
gdouble ata_smart_temperature;
guint64 ata_smart_power_on_seconds;
+
+ guint64 detection_time_at_construction;
};
G_LOCK_DEFINE_STATIC (drive_lock);
@@ -772,6 +774,8 @@ drive_update (UDisksLinuxDrive *drive,
{
UDisksDrive *iface = UDISKS_DRIVE (_iface);
GUdevDevice *device;
+ gchar *sort_key;
+ const gchar *name;
if (drive->devices == NULL)
goto out;
@@ -916,6 +920,19 @@ drive_update (UDisksLinuxDrive *drive,
drive_set_media (drive, iface, device);
drive_set_rotation_rate (drive, iface, device);
drive_set_connection_bus (drive, iface, device);
+
+ /* This is pretty lame but works for now
+ *
+ * TODO: we probably want to make it so devices inserted last sorts
+ * last in the list etc.
+ */
+ name = g_udev_device_get_name (device);
+ if (g_str_has_prefix (name, "sd"))
+ sort_key = g_strdup_printf ("z_%s", name);
+ else
+ sort_key = g_strdup (name);
+ udisks_drive_set_sort_key (iface, sort_key);
+ g_free (sort_key);
out:
;
}