[gnome-disk-utility] Use MP emblems for volume icons



commit 37ab4094d20e71a4734d454dafe57576efac170c
Author: David Zeuthen <davidz redhat com>
Date:   Tue Feb 23 11:50:51 2010 -0500

    Use MP emblems for volume icons
    
    Apparently we only did this for drive icons. With this change we now
    get the emblem when using volume objects - cf.
    
     http://people.freedesktop.org/~david/palimpsest-lvm2-pvs-on-mp.png
     http://people.freedesktop.org/~david/palimpsest-md-raid-components-on-mp.png
    
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 src/gdu/gdu-volume.c |   41 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 36 insertions(+), 5 deletions(-)
---
diff --git a/src/gdu/gdu-volume.c b/src/gdu/gdu-volume.c
index a27e68f..715433d 100644
--- a/src/gdu/gdu-volume.c
+++ b/src/gdu/gdu-volume.c
@@ -674,11 +674,6 @@ gdu_volume_get_icon (GduPresentable *presentable)
         }
 
 out:
-        if (p != NULL)
-                g_object_unref (p);
-        if (d != NULL)
-                g_object_unref (d);
-
 #if 0
         if (usage != NULL && strcmp (usage, "crypto") == 0) {
                 GEmblem *emblem;
@@ -706,6 +701,42 @@ out:
                 icon = g_themed_icon_new_with_default_fallbacks (name);
         }
 
+        /* Attach a MP emblem if it's a multipathed device or a path for a multipathed device */
+        if (d != NULL && gdu_device_is_linux_dmmp (d)) {
+                GEmblem *emblem;
+                GIcon *padlock;
+                GIcon *emblemed_icon;
+
+                padlock = g_themed_icon_new ("gdu-emblem-mp");
+                emblem = g_emblem_new_with_origin (padlock, G_EMBLEM_ORIGIN_DEVICE);
+
+                emblemed_icon = g_emblemed_icon_new (icon, emblem);
+                g_object_unref (icon);
+                icon = emblemed_icon;
+
+                g_object_unref (padlock);
+                g_object_unref (emblem);
+        } else if (d != NULL && gdu_device_is_linux_dmmp_component (d)) {
+                GEmblem *emblem;
+                GIcon *padlock;
+                GIcon *emblemed_icon;
+
+                padlock = g_themed_icon_new ("gdu-emblem-mp-component");
+                emblem = g_emblem_new_with_origin (padlock, G_EMBLEM_ORIGIN_DEVICE);
+
+                emblemed_icon = g_emblemed_icon_new (icon, emblem);
+                g_object_unref (icon);
+                icon = emblemed_icon;
+
+                g_object_unref (padlock);
+                g_object_unref (emblem);
+        }
+
+        if (p != NULL)
+                g_object_unref (p);
+        if (d != NULL)
+                g_object_unref (d);
+
         return icon;
 }
 



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