Simply use basename everywhere
authorJens Georg <mail@jensge.org>
Tue, 5 May 2009 20:09:33 +0000 (22:09 +0200)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Thu, 28 May 2009 11:14:43 +0000 (14:14 +0300)
There's no need to calculate the relative path to the parent
folder; that's exactly what basename does

src/plugins/folder/rygel-folder-container.vala
src/plugins/folder/rygel-folder-directory-search-result.vala
src/plugins/folder/rygel-folder-root-container.vala

index 040801c..861870e 100644 (file)
@@ -146,10 +146,6 @@ public class Rygel.FolderContainer : MediaContainer {
         return item;
     }
 
-    public string strip_parent (File child) {
-        return root_dir.get_relative_path (child);
-    }
-
     /**
      * Create a new root container.
      * 
@@ -157,17 +153,13 @@ public class Rygel.FolderContainer : MediaContainer {
      * @parameter file, directory you want to expose
      * @parameter full, show full path in title
      */
-    public FolderContainer (MediaContainer parent, File file, bool full) {
+    public FolderContainer (MediaContainer parent, File file) {
         string id = Checksum.compute_for_string (ChecksumType.MD5, 
                                                  file.get_uri ());
 
         base(id, parent, file.get_basename (), 0);
         this.root_dir = file;
 
-        if (!full && parent is FolderContainer) {
-            this.title = ((FolderContainer) parent).strip_parent (root_dir);
-        }
-
         this.items = new ArrayList<MediaObject> ();
         this.child_count = 0;
         this.results = new ArrayList<AsyncResult> ();
index 58f18c1..ac194d5 100644 (file)
@@ -64,8 +64,7 @@ public class Rygel.FolderDirectorySearchResult :
                     if (file_info.get_file_type () == FileType.DIRECTORY) {
                         item = new Rygel.FolderContainer (
                                                (MediaContainer) source_object,
-                                               f, 
-                                               false);
+                                               f);
 
                     } else {
                         try {
index a8e65f7..533e164 100644 (file)
@@ -117,7 +117,7 @@ public class Rygel.FolderRootContainer : MediaContainer {
         foreach (var dir in dirs) {
             var f = File.new_for_commandline_arg (dir);
             if (f.query_exists (null)) {
-                items.add (new FolderContainer (this, f, true));
+                items.add (new FolderContainer (this, f));
             }
         }