[rygel] tracker: 'upnp_class' now an item factory field



commit 38377981e0fed7af52ac53c4bcf5f25e3afe92e5
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Nov 30 20:06:19 2009 +0200

    tracker: 'upnp_class' now an item factory field
    
    No need to pass 'upnp_class' to TrackerItemFactory.create() each time it's
    called, just keep it in an instance field.

 .../tracker/rygel-tracker-image-item-factory.vala  |    9 ++-------
 .../tracker/rygel-tracker-item-factory.vala        |    8 +++++---
 .../tracker/rygel-tracker-music-item-factory.vala  |    9 ++-------
 .../tracker/rygel-tracker-search-container.vala    |    1 -
 .../tracker/rygel-tracker-video-item-factory.vala  |    9 ++-------
 5 files changed, 11 insertions(+), 25 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-image-item-factory.vala b/src/plugins/tracker/rygel-tracker-image-item-factory.vala
index 2014ba0..f355779 100644
--- a/src/plugins/tracker/rygel-tracker-image-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-image-item-factory.vala
@@ -31,20 +31,15 @@ public class Rygel.TrackerImageItemFactory : Rygel.TrackerItemFactory {
     private const string CATEGORY = "nmm:Photo";
 
     public TrackerImageItemFactory () {
-        base (CATEGORY);
+        base (CATEGORY, MediaItem.IMAGE_CLASS);
     }
 
     public override MediaItem create (string                 id,
                                       string                 path,
                                       TrackerSearchContainer parent,
-                                      string?                upnp_class,
                                       string[]               metadata)
                                       throws GLib.Error {
-        var item = base.create (id,
-                                path,
-                                parent,
-                                MediaItem.IMAGE_CLASS,
-                                metadata);
+        var item = base.create (id, path, parent, metadata);
 
         if (metadata[Metadata.WIDTH] != "")
             item.width = metadata[Metadata.WIDTH].to_int ();
diff --git a/src/plugins/tracker/rygel-tracker-item-factory.vala b/src/plugins/tracker/rygel-tracker-item-factory.vala
index c407337..c91a66c 100644
--- a/src/plugins/tracker/rygel-tracker-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-item-factory.vala
@@ -51,18 +51,20 @@ public abstract class Rygel.TrackerItemFactory {
     }
 
     public string category;
+    public string upnp_class;
 
-    public TrackerItemFactory (string category) {
+    public TrackerItemFactory (string category,
+                               string upnp_class) {
         this.category = category;
+        this.upnp_class = upnp_class;
     }
 
     public virtual MediaItem create (string                 id,
                                      string                 path,
                                      TrackerSearchContainer parent,
-                                     string?                upnp_class,
                                      string[]               metadata)
                                      throws GLib.Error {
-        var item = new MediaItem (id, parent, "", upnp_class);
+        var item = new MediaItem (id, parent, "", this.upnp_class);
 
         if (metadata[Metadata.TITLE] != "")
             item.title = metadata[Metadata.TITLE];
diff --git a/src/plugins/tracker/rygel-tracker-music-item-factory.vala b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
index f382b70..86c4b96 100644
--- a/src/plugins/tracker/rygel-tracker-music-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
@@ -31,20 +31,15 @@ public class Rygel.TrackerMusicItemFactory : Rygel.TrackerItemFactory {
     private const string CATEGORY = "nmm:MusicPiece";
 
     public TrackerMusicItemFactory () {
-        base (CATEGORY);
+        base (CATEGORY, MediaItem.MUSIC_CLASS);
     }
 
     public override MediaItem create (string                 id,
                                       string                 path,
                                       TrackerSearchContainer parent,
-                                      string?                upnp_class,
                                       string[]               metadata)
                                       throws GLib.Error {
-        var item = base.create (id,
-                                path,
-                                parent,
-                                MediaItem.MUSIC_CLASS,
-                                metadata);
+        var item = base.create (id, path, parent, metadata);
 
         if (metadata[Metadata.DURATION] != "")
             item.duration = metadata[Metadata.DURATION].to_int ();
diff --git a/src/plugins/tracker/rygel-tracker-search-container.vala b/src/plugins/tracker/rygel-tracker-search-container.vala
index 55d8c47..0bf949f 100644
--- a/src/plugins/tracker/rygel-tracker-search-container.vala
+++ b/src/plugins/tracker/rygel-tracker-search-container.vala
@@ -243,7 +243,6 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
         return this.item_factory.create (id,
                                          uri,
                                          this,
-                                         null,
                                          metadata);
     }
 
diff --git a/src/plugins/tracker/rygel-tracker-video-item-factory.vala b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
index 3f586c7..95ca114 100644
--- a/src/plugins/tracker/rygel-tracker-video-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
@@ -31,20 +31,15 @@ public class Rygel.TrackerVideoItemFactory : Rygel.TrackerItemFactory {
     private const string CATEGORY = "nmm:Video";
 
     public TrackerVideoItemFactory () {
-        base (CATEGORY);
+        base (CATEGORY, MediaItem.VIDEO_CLASS);
     }
 
     public override MediaItem create (string                 id,
                                       string                 path,
                                       TrackerSearchContainer parent,
-                                      string?                upnp_class,
                                       string[]               metadata)
                                       throws GLib.Error {
-        var item = base.create (id,
-                                path,
-                                parent,
-                                MediaItem.VIDEO_CLASS,
-                                metadata);
+        var item = base.create (id, path, parent, metadata);
 
         if (metadata[Metadata.WIDTH] != "")
             item.width = metadata[Metadata.WIDTH].to_int ();



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