rygel r371 - trunk/src/plugins/tracker



Author: zeeshanak
Date: Thu Dec 25 11:59:58 2008
New Revision: 371
URL: http://svn.gnome.org/viewvc/rygel?rev=371&view=rev

Log:
Add API to get the MediaItem, given it's ID.

Modified:
   trunk/src/plugins/tracker/rygel-tracker-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	Thu Dec 25 11:59:58 2008
@@ -161,13 +161,7 @@
         MediaItem item;
 
         try {
-            if (this.child_class == MediaItem.VIDEO_CLASS) {
-                item = new TrackerVideoItem (path, path, this);
-            } else if (this.child_class == MediaItem.IMAGE_CLASS) {
-                item = new TrackerImageItem (path, path, this);
-            } else {
-                item = new TrackerMusicItem (path, path, this);
-            }
+            item = this.get_item_from_db (path);
         } catch (GLib.Error error) {
             critical ("Failed to fetch item %s. Reason: %s",
                       item.id,
@@ -196,5 +190,19 @@
 
         return category;
     }
+
+    public MediaItem get_item_from_db (string path) throws GLib.Error {
+        MediaItem item;
+
+        if (this.child_class == MediaItem.VIDEO_CLASS) {
+            item = new TrackerVideoItem (path, path, this);
+        } else if (this.child_class == MediaItem.IMAGE_CLASS) {
+            item = new TrackerImageItem (path, path, this);
+        } else {
+            item = new TrackerMusicItem (path, path, this);
+        }
+
+        return item;
+    }
 }
 



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