rygel r572 - trunk/src/plugins/tracker



Author: zeeshanak
Date: Sat Feb 14 15:24:24 2009
New Revision: 572
URL: http://svn.gnome.org/viewvc/rygel?rev=572&view=rev

Log:
Each container class implements fetch_item_by_path().

Modified:
   trunk/src/plugins/tracker/rygel-tracker-container.vala
   trunk/src/plugins/tracker/rygel-tracker-image-container.vala
   trunk/src/plugins/tracker/rygel-tracker-music-container.vala
   trunk/src/plugins/tracker/rygel-tracker-video-container.vala

Modified: trunk/src/plugins/tracker/rygel-tracker-container.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-container.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-container.vala	Sat Feb 14 15:24:24 2009
@@ -29,7 +29,7 @@
 /**
  * Represents Tracker category.
  */
-public class Rygel.TrackerContainer : MediaContainer {
+public abstract class Rygel.TrackerContainer : MediaContainer {
     /* class-wide constants */
     private const string TRACKER_SERVICE = "org.freedesktop.Tracker";
     private const string TRACKER_PATH = "/org/freedesktop/Tracker";
@@ -212,27 +212,7 @@
         return this.fetch_item_by_path (path);
     }
 
-    private MediaItem? fetch_item_by_path (string path) throws GLib.Error {
-        MediaItem item;
-
-        if (this.child_class == MediaItem.VIDEO_CLASS) {
-            item = new TrackerVideoItem (this.id + ":" + path,
-                                         path,
-                                         this,
-                                         null);
-        } else if (this.child_class == MediaItem.IMAGE_CLASS) {
-            item = new TrackerImageItem (this.id + ":" + path,
-                                         path,
-                                         this,
-                                         null);
-        } else {
-            item = new TrackerMusicItem (this.id + ":" + path,
-                                         path,
-                                         this,
-                                         null);
-        }
-
-        return item;
-    }
+    protected abstract MediaItem? fetch_item_by_path (string path)
+                                                      throws GLib.Error;
 }
 

Modified: trunk/src/plugins/tracker/rygel-tracker-image-container.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-image-container.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-image-container.vala	Sat Feb 14 15:24:24 2009
@@ -32,5 +32,13 @@
                                   string title) {
         base (id, parent_id, title, "Images", MediaItem.IMAGE_CLASS);
     }
+
+    protected override MediaItem? fetch_item_by_path (string path)
+                                                      throws GLib.Error {
+        return new TrackerImageItem (this.id + ":" + path,
+                                     path,
+                                     this,
+                                     null);
+    }
 }
 

Modified: trunk/src/plugins/tracker/rygel-tracker-music-container.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-music-container.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-music-container.vala	Sat Feb 14 15:24:24 2009
@@ -32,5 +32,13 @@
                                   string title) {
         base (id, parent_id, title, "Music", MediaItem.MUSIC_CLASS);
     }
+
+    protected override MediaItem? fetch_item_by_path (string path)
+                                                      throws GLib.Error {
+        return new TrackerMusicItem (this.id + ":" + path,
+                                     path,
+                                     this,
+                                     null);
+    }
 }
 

Modified: trunk/src/plugins/tracker/rygel-tracker-video-container.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-video-container.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-video-container.vala	Sat Feb 14 15:24:24 2009
@@ -32,5 +32,13 @@
                                   string title) {
         base (id, parent_id, title, "Videos", MediaItem.VIDEO_CLASS);
     }
+
+    protected override MediaItem? fetch_item_by_path (string path)
+                                                      throws GLib.Error {
+        return new TrackerVideoItem (this.id + ":" + path,
+                                     path,
+                                     this,
+                                     null);
+    }
 }
 



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