rygel r574 - trunk/src/plugins/tracker



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

Log:
Container classes fetch the metadata.

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

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:53 2009
@@ -35,10 +35,15 @@
 
     protected override MediaItem? fetch_item_by_path (string path)
                                                       throws GLib.Error {
+        string[] keys = TrackerImageItem.get_metadata_keys ();
+
+        /* TODO: make this async */
+        string[] item_metadata = this.metadata.Get (this.category, path, keys);
+
         return new TrackerImageItem (this.id + ":" + path,
                                      path,
                                      this,
-                                     null);
+                                     item_metadata);
     }
 }
 

Modified: trunk/src/plugins/tracker/rygel-tracker-image-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-image-item.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-image-item.vala	Sat Feb 14 15:24:53 2009
@@ -46,11 +46,11 @@
     public TrackerImageItem (string           id,
                              string           path,
                              TrackerContainer parent,
-                             string[]?        metadata) throws GLib.Error {
+                             string[]         metadata) throws GLib.Error {
         base (id, path, parent, metadata);
     }
 
-    public override string[] get_metadata_keys () {
+    public static string[] get_metadata_keys () {
         string[] keys = new string[Metadata.LAST_KEY];
         keys[Metadata.FILE_NAME] = "File:Name";
         keys[Metadata.MIME] = "File:Mime";

Modified: trunk/src/plugins/tracker/rygel-tracker-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-item.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-item.vala	Sat Feb 14 15:24:53 2009
@@ -29,26 +29,17 @@
  * Represents Tracker item.
  */
 public abstract class Rygel.TrackerItem : MediaItem {
-    protected TrackerContainer parent;
     protected string path;
 
     public TrackerItem (string           id,
                         string           path,
                         TrackerContainer parent,
-                        string[]?        metadata) throws GLib.Error {
+                        string[]         metadata) throws GLib.Error {
         base (id, parent.id, "", parent.child_class);
 
         this.path = path;
-        this.parent = parent;
 
-        string[] values;
-        if (metadata == null) {
-            values = this.fetch_metadata ();
-        } else {
-            values = metadata;
-        }
-
-        this.init_from_metadata (values);
+        this.init_from_metadata (metadata);
     }
 
     protected string seconds_to_iso8601 (string seconds) {
@@ -68,14 +59,6 @@
         return date;
     }
 
-    private string[] fetch_metadata () throws GLib.Error {
-        string[] keys = this.get_metadata_keys ();
-
-        /* TODO: make this async */
-        return this.parent.metadata.Get (parent.category, path, keys);
-    }
-
-    public abstract string[] get_metadata_keys ();
     protected abstract void init_from_metadata (string[] values);
 }
 

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:53 2009
@@ -35,10 +35,15 @@
 
     protected override MediaItem? fetch_item_by_path (string path)
                                                       throws GLib.Error {
+        string[] keys = TrackerMusicItem.get_metadata_keys ();
+
+        /* TODO: make this async */
+        string[] item_metadata = this.metadata.Get (this.category, path, keys);
+
         return new TrackerMusicItem (this.id + ":" + path,
                                      path,
                                      this,
-                                     null);
+                                     item_metadata);
     }
 }
 

Modified: trunk/src/plugins/tracker/rygel-tracker-music-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-music-item.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-music-item.vala	Sat Feb 14 15:24:53 2009
@@ -46,11 +46,11 @@
     public TrackerMusicItem (string           id,
                              string           path,
                              TrackerContainer parent,
-                             string[]?        metadata) throws GLib.Error {
+                             string[]         metadata) throws GLib.Error {
         base (id, path, parent, metadata);
     }
 
-    public override string[] get_metadata_keys () {
+    public static string[] get_metadata_keys () {
         string[] keys = new string[Metadata.LAST_KEY];
         keys[Metadata.FILE_NAME] = "File:Name";
         keys[Metadata.MIME] = "File:Mime";

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:53 2009
@@ -35,10 +35,15 @@
 
     protected override MediaItem? fetch_item_by_path (string path)
                                                       throws GLib.Error {
+        string[] keys = TrackerVideoItem.get_metadata_keys ();
+
+        /* TODO: make this async */
+        string[] item_metadata = this.metadata.Get (this.category, path, keys);
+
         return new TrackerVideoItem (this.id + ":" + path,
                                      path,
                                      this,
-                                     null);
+                                     item_metadata);
     }
 }
 

Modified: trunk/src/plugins/tracker/rygel-tracker-video-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-video-item.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-video-item.vala	Sat Feb 14 15:24:53 2009
@@ -44,11 +44,11 @@
     public TrackerVideoItem (string           id,
                              string           path,
                              TrackerContainer parent,
-                             string[]?        metadata) throws GLib.Error {
+                             string[]         metadata) throws GLib.Error {
         base (id, path, parent, metadata);
     }
 
-    public override string[] get_metadata_keys () {
+    public static string[] get_metadata_keys () {
         string[] keys = new string[Metadata.LAST_KEY];
         keys[Metadata.FILE_NAME] = "File:Name";
         keys[Metadata.MIME] = "File:Mime";



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