[rygel] tracker: Special hierarchy for Music



commit b4af622dd206385aa22c3e925d3e3f90fb281872
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Dec 2 16:10:25 2009 +0200

    tracker: Special hierarchy for Music

 src/plugins/tracker/Makefile.am                    |    1 +
 src/plugins/tracker/rygel-tracker-music.vala       |   53 ++++++++++++++++++++
 .../tracker/rygel-tracker-root-container.vala      |   24 +---------
 3 files changed, 55 insertions(+), 23 deletions(-)
---
diff --git a/src/plugins/tracker/Makefile.am b/src/plugins/tracker/Makefile.am
index 315e8e8..da8120e 100644
--- a/src/plugins/tracker/Makefile.am
+++ b/src/plugins/tracker/Makefile.am
@@ -12,6 +12,7 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
 librygel_media_tracker_la_SOURCES = \
 				    rygel-media-tracker.vala \
 				    rygel-tracker-root-container.vala \
+				    rygel-tracker-music.vala \
 				    rygel-tracker-metadata-values.vala \
 				    rygel-tracker-tags.vala \
 				    rygel-tracker-search-container.vala \
diff --git a/src/plugins/tracker/rygel-tracker-music.vala b/src/plugins/tracker/rygel-tracker-music.vala
new file mode 100644
index 0000000..929a1dc
--- /dev/null
+++ b/src/plugins/tracker/rygel-tracker-music.vala
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ *                               <zeeshan ali nokia com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+using Gee;
+
+/**
+ * Container listing Music content hierarchy.
+ */
+public class Rygel.TrackerMusic : Rygel.SimpleContainer {
+    public TrackerMusic (string         id,
+                         MediaContainer parent,
+                         string         title) {
+        base (id, parent, title);
+
+        var item_factory = new TrackerMusicItemFactory ();
+        var key_chain = new string[] { "nmm:performer",
+                                       "nmm:artistName",
+                                       null };
+        this.add_child (new TrackerMetadataValues ("17",
+                                                   this,
+                                                   "Artists",
+                                                   item_factory,
+                                                   key_chain));
+
+        key_chain = new string[] { "nmm:musicAlbum", "nmm:albumTitle", null };
+        this.add_child (new TrackerMetadataValues ("18",
+                                                   this,
+                                                   "Albums",
+                                                   item_factory,
+                                                   key_chain));
+    }
+}
+
diff --git a/src/plugins/tracker/rygel-tracker-root-container.vala b/src/plugins/tracker/rygel-tracker-root-container.vala
index 3e0a9c6..dee8b0d 100644
--- a/src/plugins/tracker/rygel-tracker-root-container.vala
+++ b/src/plugins/tracker/rygel-tracker-root-container.vala
@@ -39,34 +39,12 @@ public class Rygel.TrackerRootContainer : Rygel.SimpleContainer {
                                         "Pictures",
                                         new TrackerImageItemFactory ()));
         this.add_child (new TrackerSearchContainer (
-                                        "14",
-                                        this,
-                                        "Music",
-                                        new TrackerMusicItemFactory ()));
-        this.add_child (new TrackerSearchContainer (
                                         "15",
                                         this,
                                         "Videos",
                                         new TrackerVideoItemFactory ()));
 
-        var key_chain = new string[] { "nmm:performer",
-                                       "nmm:artistName",
-                                       null };
-        this.add_child (new TrackerMetadataValues (
-                                        "17",
-                                        this,
-                                        "Artists",
-                                        new TrackerMusicItemFactory (),
-                                        key_chain));
-
-        key_chain = new string[] { "nmm:musicAlbum", "nmm:albumTitle", null };
-        this.add_child (new TrackerMetadataValues (
-                                        "18",
-                                        this,
-                                        "Albums",
-                                        new TrackerMusicItemFactory (),
-                                        key_chain));
-
+        this.add_child (new TrackerMusic ("14", this, "Music"));
         this.add_child (new TrackerTags ("19", this));
     }
 }



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