[gnome-disk-utility/udisks2-port] Use udisks_util_get_lun_info() for information about the LUN



commit e65be7715f0a48ce3c715aeb43294b00aeeebaf1
Author: David Zeuthen <davidz redhat com>
Date:   Wed Mar 9 12:41:14 2011 -0500

    Use udisks_util_get_lun_info() for information about the LUN
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 data/ui/palimpsest.ui               |    2 +-
 src/palimpsest/gdudevicetreemodel.c |   40 +++++++++++++++++++++--------------
 src/palimpsest/gduwindow.c          |    2 +-
 3 files changed, 26 insertions(+), 18 deletions(-)
---
diff --git a/data/ui/palimpsest.ui b/data/ui/palimpsest.ui
index 8dca848..92a0b00 100644
--- a/data/ui/palimpsest.ui
+++ b/data/ui/palimpsest.ui
@@ -172,7 +172,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkHBox" id="hbox30">
+                      <object class="GtkHBox" id="lun-write-cache-hbox">
                         <property name="visible">True</property>
                         <child>
                           <object class="GtkSwitch" id="lun-write-cache-switch">
diff --git a/src/palimpsest/gdudevicetreemodel.c b/src/palimpsest/gdudevicetreemodel.c
index 755eac2..0ba6fa8 100644
--- a/src/palimpsest/gdudevicetreemodel.c
+++ b/src/palimpsest/gdudevicetreemodel.c
@@ -24,6 +24,7 @@
 #include <glib/gi18n.h>
 
 #include "gdudevicetreemodel.h"
+#include "gduutils.h"
 
 struct _GduDeviceTreeModel
 {
@@ -410,38 +411,45 @@ add_lun (GduDeviceTreeModel *model,
          GDBusObjectProxy   *object_proxy,
          GtkTreeIter        *parent)
 {
-  const gchar *lun_vendor;
-  const gchar *lun_model;
   UDisksLun *lun;
-  GIcon *icon;
+  GIcon *drive_icon;
+  GIcon *media_icon;
   gchar *name;
+  gchar *description;
+  gchar *s;
   gchar *sort_key;
   GtkTreeIter iter;
 
   lun = UDISKS_PEEK_LUN (object_proxy);
-  lun_vendor = udisks_lun_get_vendor (lun);
-  lun_model = udisks_lun_get_model (lun);
-
-  if (strlen (lun_vendor) == 0)
-    name = g_strdup (lun_model);
-  else if (strlen (lun_model) == 0)
-    name = g_strdup (lun_vendor);
-  else
-    name = g_strconcat (lun_vendor, " ", lun_model, NULL);
+  udisks_util_get_lun_info (lun, &name, &description, &drive_icon, &media_icon);
+  s = g_strdup_printf ("%s\n"
+                       "<small><span foreground=\"#555555\">%s</span></small>",
+                       description,
+                       name);
+
+  g_debug ("lun %s ->\n"
+           " drive_icon=%s\n"
+           " media_icon=%s\n"
+           "\n",
+           g_dbus_object_proxy_get_object_path (object_proxy),
+           g_icon_to_string (drive_icon),
+           g_icon_to_string (media_icon));
 
-  icon = g_themed_icon_new ("drive-harddisk"); /* for now */
   sort_key = g_strdup (g_dbus_object_proxy_get_object_path (object_proxy)); /* for now */
   gtk_tree_store_insert_with_values (GTK_TREE_STORE (model),
                                      &iter,
                                      parent,
                                      0,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_ICON, icon,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_NAME, name,
+                                     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_OBJECT_PROXY, object_proxy,
                                      -1);
-  g_object_unref (icon);
+  g_object_unref (media_icon);
+  g_object_unref (drive_icon);
   g_free (sort_key);
+  g_free (s);
+  g_free (description);
   g_free (name);
 }
 
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index 9de0cbf..0826aa5 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -267,7 +267,7 @@ gdu_window_constructed (GObject *object)
   gtk_tree_view_column_pack_start (column, renderer, FALSE);
   gtk_tree_view_column_set_attributes (column,
                                        renderer,
-                                       "text", GDU_DEVICE_TREE_MODEL_COLUMN_NAME,
+                                       "markup", GDU_DEVICE_TREE_MODEL_COLUMN_NAME,
                                        NULL);
 
   /* expand on insertion - hmm, I wonder if there's an easier way to do this */



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