[gnome-disk-utility] Use udisks_object_info_get_sort_key() instead of rolling our own



commit 777220959e64de77e357c376a05383e29edbda80
Author: David Zeuthen <zeuthen gmail com>
Date:   Wed Dec 5 12:58:53 2012 -0500

    Use udisks_object_info_get_sort_key() instead of rolling our own
    
    Signed-off-by: David Zeuthen <zeuthen gmail com>

 src/disks/gdudevicetreemodel.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)
---
diff --git a/src/disks/gdudevicetreemodel.c b/src/disks/gdudevicetreemodel.c
index 1770fe7..0d1b327 100644
--- a/src/disks/gdudevicetreemodel.c
+++ b/src/disks/gdudevicetreemodel.c
@@ -893,7 +893,6 @@ update_drive (GduDeviceTreeModel *model,
   UDisksObjectInfo *info = NULL;
   UDisksBlock *block = NULL;
   gchar *s = NULL;
-  gchar *sort_key = NULL;
   gboolean warning = FALSE;
   gboolean jobs_running = FALSE;
   GtkTreeIter iter;
@@ -914,8 +913,6 @@ update_drive (GduDeviceTreeModel *model,
 
   block = udisks_client_get_block_for_drive (model->client, drive, FALSE); /* get_physical */
 
-  sort_key = g_strdup_printf ("00_drives_1_%s", udisks_drive_get_sort_key (drive));
-
   if (ata != NULL)
     {
       s = gdu_ata_smart_get_one_liner_assessment (ata, NULL /* out_smart_supported */, &warning);
@@ -956,7 +953,7 @@ update_drive (GduDeviceTreeModel *model,
                       &iter,
                       GDU_DEVICE_TREE_MODEL_COLUMN_ICON, udisks_object_info_get_icon (info),
                       GDU_DEVICE_TREE_MODEL_COLUMN_NAME, s,
-                      GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, sort_key,
+                      GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, udisks_object_info_get_sort_key (info),
                       GDU_DEVICE_TREE_MODEL_COLUMN_WARNING, warning,
                       GDU_DEVICE_TREE_MODEL_COLUMN_JOBS_RUNNING, jobs_running,
                       GDU_DEVICE_TREE_MODEL_COLUMN_PULSE, pulse,
@@ -976,7 +973,6 @@ update_drive (GduDeviceTreeModel *model,
  out:
   g_clear_object (&block);
   g_clear_object (&info);
-  g_free (sort_key);
   g_free (s);
   return jobs_running;
 }
@@ -1062,7 +1058,6 @@ update_mdraid (GduDeviceTreeModel *model,
   gchar *desc = NULL;
   gchar *desc2 = NULL;
   gchar *s = NULL;
-  gchar *sort_key = NULL;
   gboolean warning = FALSE;
   gboolean jobs_running = FALSE;
   GtkTreeIter iter;
@@ -1082,8 +1077,6 @@ update_mdraid (GduDeviceTreeModel *model,
   block = udisks_client_get_block_for_mdraid (model->client, mdraid);
   info = udisks_client_get_object_info (model->client, object);
 
-  sort_key = g_strdup_printf ("01_mdraid_1_%s", udisks_mdraid_get_uuid (mdraid)); /* TODO: sort_key? */
-
   name = udisks_mdraid_get_name (mdraid);
   /* skip homehost, if any */
   s = strstr (name, ":");
@@ -1160,7 +1153,7 @@ update_mdraid (GduDeviceTreeModel *model,
                       &iter,
                       GDU_DEVICE_TREE_MODEL_COLUMN_ICON, udisks_object_info_get_icon (info),
                       GDU_DEVICE_TREE_MODEL_COLUMN_NAME, s,
-                      GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, sort_key,
+                      GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, udisks_object_info_get_sort_key (info),
                       GDU_DEVICE_TREE_MODEL_COLUMN_WARNING, warning,
                       GDU_DEVICE_TREE_MODEL_COLUMN_JOBS_RUNNING, jobs_running,
                       GDU_DEVICE_TREE_MODEL_COLUMN_PULSE, pulse,
@@ -1179,7 +1172,6 @@ update_mdraid (GduDeviceTreeModel *model,
 
  out:
   g_clear_object (&info);
-  g_free (sort_key);
   g_free (s);
   g_free (desc);
   g_free (desc2);
@@ -1337,7 +1329,6 @@ update_block (GduDeviceTreeModel  *model,
   UDisksLoop *loop;
   UDisksObjectInfo *info = NULL;
   gchar *s = NULL;
-  gchar *sort_key = NULL;
   const gchar *preferred_device;
   const gchar *loop_backing_file;
   guint64 size;
@@ -1382,10 +1373,6 @@ update_block (GduDeviceTreeModel  *model,
                            preferred_device);
     }
 
-  /* for now */
-  sort_key = g_strdup_printf ("02_block_1_%s",
-                              g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
-
   jobs_running = block_has_jobs (model->client, block);
 
   gtk_tree_model_get (GTK_TREE_MODEL (model),
@@ -1399,7 +1386,7 @@ update_block (GduDeviceTreeModel  *model,
                       &iter,
                       GDU_DEVICE_TREE_MODEL_COLUMN_ICON, udisks_object_info_get_icon (info),
                       GDU_DEVICE_TREE_MODEL_COLUMN_NAME, s,
-                      GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, sort_key,
+                      GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, udisks_object_info_get_sort_key (info),
                       GDU_DEVICE_TREE_MODEL_COLUMN_JOBS_RUNNING, jobs_running,
                       GDU_DEVICE_TREE_MODEL_COLUMN_PULSE, pulse,
                       GDU_DEVICE_TREE_MODEL_COLUMN_SIZE, size,
@@ -1417,7 +1404,6 @@ update_block (GduDeviceTreeModel  *model,
 
  out:
   g_clear_object (&info);
-  g_free (sort_key);
   g_free (s);
   g_free (size_str);
   return jobs_running;



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