[maemo-commits] [maemo-commits] r17111 - in projects/haf/trunk/totem-pl-parser: . plparse

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Jan 12 16:43:37 EET 2009
Author: ifrade
Date: 2009-01-12 16:43:36 +0200 (Mon, 12 Jan 2009)
New Revision: 17111

Modified:
   projects/haf/trunk/totem-pl-parser/ChangeLog
   projects/haf/trunk/totem-pl-parser/plparse/totem-disc.c
Log:
2008-12-05 Bastien Nocera <hadess at hadess.net>

	* plparse/totem-disc.c (cd_cache_get_dev_from_volumes),
	(cd_cache_has_content_type), (cd_cache_disc_is_cdda):
	Make detecting the type of devices not connected 1-to-1
	to a drive work again, as it did in 2.24

Modified: projects/haf/trunk/totem-pl-parser/ChangeLog
===================================================================
--- projects/haf/trunk/totem-pl-parser/ChangeLog	2009-01-12 14:43:35 UTC (rev 17110)
+++ projects/haf/trunk/totem-pl-parser/ChangeLog	2009-01-12 14:43:36 UTC (rev 17111)
@@ -1,3 +1,10 @@
+2008-12-05  Bastien Nocera  <hadess at hadess.net>
+
+	* plparse/totem-disc.c (cd_cache_get_dev_from_volumes),
+	(cd_cache_has_content_type), (cd_cache_disc_is_cdda):
+	Make detecting the type of devices not connected 1-to-1
+	to a drive work again, as it did in 2.24
+
 2008-12-01  Bastien Nocera  <hadess at hadess.net>
 
 	* plparse/totem-pl-parser-builtins.c

Modified: projects/haf/trunk/totem-pl-parser/plparse/totem-disc.c
===================================================================
--- projects/haf/trunk/totem-pl-parser/plparse/totem-disc.c	2009-01-12 14:43:35 UTC (rev 17110)
+++ projects/haf/trunk/totem-pl-parser/plparse/totem-disc.c	2009-01-12 14:43:36 UTC (rev 17111)
@@ -204,6 +204,38 @@
   g_list_foreach (list, (GFunc) g_object_unref, NULL);
   g_list_free (list);
 
+  if (found != FALSE)
+    return found;
+
+  /* Not in the drives? Look in the volumes themselves */
+  found = FALSE;
+  list = g_volume_monitor_get_volumes (mon);
+  for (l = list; l != NULL; l = l->next) {
+    GVolume *vol;
+    char *ddev, *resolved;
+
+    vol = l->data;
+    ddev = g_volume_get_identifier (vol, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+    if (ddev == NULL)
+      continue;
+    resolved = totem_resolve_symlink (ddev, NULL);
+    g_free (ddev);
+    if (resolved == NULL)
+      continue;
+
+    if (strcmp (resolved, device) == 0) {
+      found = TRUE;
+      *volume = g_object_ref (vol);
+    }
+
+    g_free (resolved);
+    if (found != FALSE)
+      break;
+  }
+
+  g_list_foreach (list, (GFunc) g_object_unref, NULL);
+  g_list_free (list);
+
   return found;
 }
 
@@ -213,12 +245,10 @@
   guint i;
 
   if (cache->content_types == NULL) {
-    g_message ("no content type");
     return FALSE;
   }
 
   for (i = 0; cache->content_types[i] != NULL; i++) {
-    g_message ("type: %s", cache->content_types[i]);
     if (g_str_equal (cache->content_types[i], content_type) != FALSE)
       return TRUE;
   }
@@ -526,7 +556,6 @@
 {
   /* We can't have audio CDs on disc, yet */
   if (cache->is_media == FALSE) {
-    g_message ("has no media");
     return MEDIA_TYPE_DATA;
   }
   if (!cd_cache_open_device (cache, error))


More information about the maemo-commits mailing list