rygel r569 - trunk/src/plugins/tracker



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

Log:
Refactor: Separate function for retreiving the metadata keys.

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

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:23:31 2009
@@ -49,7 +49,7 @@
         base (id, path, parent);
     }
 
-    public override string[] fetch_metadata () throws GLib.Error {
+    public override string[] get_metadata_keys () {
         string[] keys = new string[Metadata.LAST_KEY];
         keys[Metadata.FILE_NAME] = "File:Name";
         keys[Metadata.MIME] = "File:Mime";
@@ -62,6 +62,12 @@
         keys[Metadata.IMAGE_DATE] = "Image:Date";
         keys[Metadata.DATE] = "DC:Date";
 
+        return keys;
+    }
+
+    public override 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);
     }

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:23:31 2009
@@ -61,6 +61,7 @@
         return date;
     }
 
+    public abstract string[] get_metadata_keys ();
     protected abstract string[] fetch_metadata () throws GLib.Error;
     protected abstract void init_from_metadata (string[] values);
 }

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:23:31 2009
@@ -49,7 +49,7 @@
         base (id, path, parent);
     }
 
-    public override string[] fetch_metadata () throws GLib.Error {
+    public override string[] get_metadata_keys () {
         string[] keys = new string[Metadata.LAST_KEY];
         keys[Metadata.FILE_NAME] = "File:Name";
         keys[Metadata.MIME] = "File:Mime";
@@ -62,6 +62,12 @@
         keys[Metadata.DATE_ADDED] = "Audio:DateAdded";
         keys[Metadata.DATE] = "DC:Date";
 
+        return keys;
+    }
+
+    public override 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);
     }

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:23:31 2009
@@ -47,7 +47,7 @@
         base (id, path, parent);
     }
 
-    public override string[] fetch_metadata () throws GLib.Error {
+    public override string[] get_metadata_keys () {
         string[] keys = new string[Metadata.LAST_KEY];
         keys[Metadata.FILE_NAME] = "File:Name";
         keys[Metadata.MIME] = "File:Mime";
@@ -58,6 +58,12 @@
         keys[Metadata.HEIGHT] = "Video:Height";
         keys[Metadata.DATE] = "DC:Date";
 
+        return keys;
+    }
+
+    public override 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);
 



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