[grilo-plugins] optical-media: Don't show USB drives in the list



commit 28bb41fea5146f14139194d4f210eb7351cf2981
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Mar 29 17:58:58 2013 +0100

    optical-media: Don't show USB drives in the list
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679624

 src/optical-media/grl-optical-media.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/optical-media/grl-optical-media.c b/src/optical-media/grl-optical-media.c
index 7bdc1ad..f04fd5c 100644
--- a/src/optical-media/grl-optical-media.c
+++ b/src/optical-media/grl-optical-media.c
@@ -355,12 +355,26 @@ add_drive (GList *media_list,
            GrlOpticalMediaSource *source)
 {
   GList *volumes, *i;
+  GIcon *icon;
 
   if (g_drive_can_eject (drive) == FALSE ||
       g_drive_has_media (drive) == FALSE) {
     return media_list;
   }
 
+  /* Hack to avoid USB devices showing up
+   * https://bugzilla.gnome.org/show_bug.cgi?id=679624 */
+  icon = g_drive_get_icon (drive);
+  if (icon && G_IS_THEMED_ICON (icon)) {
+    const gchar * const * names;
+    names = g_themed_icon_get_names (G_THEMED_ICON (icon));
+    if (names && names[0] && !g_str_has_prefix (names[0], "drive-optical")) {
+      g_object_unref (icon);
+      return media_list;
+    }
+  }
+  g_clear_object (&icon);
+
   /* Repeat for all the drive's volumes */
   volumes = g_drive_get_volumes (drive);
 


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