[gvfs] udisks2: get icons via UDisksObjectInfo for block devices that are not drives



commit dff2d84d15b7a62a162031f2da3015e989c0eadc
Author: David Zeuthen <zeuthen gmail com>
Date:   Wed Dec 5 12:00:04 2012 -0500

    udisks2: get icons via UDisksObjectInfo for block devices that are not drives
    
    Signed-off-by: David Zeuthen <zeuthen gmail com>

 monitor/udisks2/gvfsudisks2volume.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/monitor/udisks2/gvfsudisks2volume.c b/monitor/udisks2/gvfsudisks2volume.c
index 00f85d9..7bb816c 100644
--- a/monitor/udisks2/gvfsudisks2volume.c
+++ b/monitor/udisks2/gvfsudisks2volume.c
@@ -400,6 +400,27 @@ update_volume (GVfsUDisks2Volume *volume)
             }
           g_object_unref (udisks_drive);
         }
+      else
+        {
+          /* No UDisksDrive, but we do have a UDisksBlock (example: /dev/loop0). Use
+           * that to get the icons via UDisksObjectInfo
+           */
+#if UDISKS_CHECK_VERSION(2,0,90)
+          {
+            UDisksObject *object = (UDisksObject *) g_dbus_interface_get_object (G_DBUS_INTERFACE (volume->block));
+            if (object != NULL)
+              {
+                UDisksObjectInfo *info = udisks_client_get_object_info (udisks_client, object);
+                if (info != NULL)
+                  {
+                    volume->icon = _g_object_ref0 (udisks_object_info_get_icon (info));
+                    volume->symbolic_icon = _g_object_ref0 (udisks_object_info_get_icon_symbolic (info));
+                    g_object_unref (info);
+                  }
+              }
+          }
+#endif
+        }
 
       /* Also automount loop devices set up by the user himself - e.g. via the
        * udisks interfaces or the gnome-disk-image-mounter(1) command



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