[grilo-plugins] Treat a single chosen-path differently



commit 525e00deabdcb673279de3d9b8b6a8a94d4f35f7
Author: Chris Lord <chris linux intel com>
Date:   Fri Jul 2 14:53:36 2010 +0100

    Treat a single chosen-path differently
    
    If there is only a single chosen-path, instead of creating a view of that
    single path, use produce_from_path and create a view of inside that path.

 src/filesystem/grl-filesystem.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/src/filesystem/grl-filesystem.c b/src/filesystem/grl-filesystem.c
index c7b1b20..14dbdda 100644
--- a/src/filesystem/grl-filesystem.c
+++ b/src/filesystem/grl-filesystem.c
@@ -578,18 +578,23 @@ grl_filesystem_source_browse (GrlMediaSource *source,
   chosen_paths = GRL_FILESYSTEM_SOURCE(source)->priv->chosen_paths;
   if (!id && chosen_paths) {
     guint remaining = g_list_length (chosen_paths);
-    for (; chosen_paths; chosen_paths = g_list_next (chosen_paths)) {
-      GrlMedia *content = create_content (NULL,
-					  (gchar *) chosen_paths->data,
-					  GRL_RESOLVE_FAST_ONLY,
-					  FALSE);
-
-      bs->callback (source,
-		    bs->browse_id,
-		    content,
-		    --remaining,
-		    bs->user_data,
-		    NULL);
+
+    if (remaining == 1) {
+        produce_from_path (bs, chosen_paths->data);
+    } else {
+      for (; chosen_paths; chosen_paths = g_list_next (chosen_paths)) {
+        GrlMedia *content = create_content (NULL,
+                                            (gchar *) chosen_paths->data,
+                                            GRL_RESOLVE_FAST_ONLY,
+                                            FALSE);
+
+        bs->callback (source,
+                      bs->browse_id,
+                      content,
+                      --remaining,
+                      bs->user_data,
+                      NULL);
+      }
     }
   } else {
     produce_from_path (bs, id ? id : G_DIR_SEPARATOR_S);



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