[rygel] tracker: Prefer ArrayList over vala arrays
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] tracker: Prefer ArrayList over vala arrays
- Date: Wed, 23 Dec 2009 15:41:25 +0000 (UTC)
commit cdb5b7dcabf374c72a4fcf8a7085462687b97477
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Dec 11 15:08:41 2009 +0200
tracker: Prefer ArrayList over vala arrays
.../tracker/rygel-tracker-item-factory.vala | 17 ++++++++++-------
.../tracker/rygel-tracker-music-item-factory.vala | 18 ++++++++----------
.../rygel-tracker-picture-item-factory.vala | 14 ++++++--------
.../tracker/rygel-tracker-video-item-factory.vala | 16 +++++++---------
4 files changed, 31 insertions(+), 34 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-item-factory.vala b/src/plugins/tracker/rygel-tracker-item-factory.vala
index 1cf822d..2fa247e 100644
--- a/src/plugins/tracker/rygel-tracker-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-item-factory.vala
@@ -23,6 +23,7 @@
using GUPnP;
using DBus;
+using Gee;
/**
* Abstract Tracker item factory.
@@ -73,13 +74,15 @@ public abstract class Rygel.TrackerItemFactory {
return item;
}
- public virtual string[] get_metadata_keys () {
- string[] keys = new string[Metadata.LAST_KEY];
- keys[Metadata.FILE_NAME] = "nfo:fileName";
- keys[Metadata.TITLE] = "nie:title";
- keys[Metadata.MIME] = "nie:mimeType";
- keys[Metadata.SIZE] = "nfo:fileSize";
- keys[Metadata.DATE] = "nie:contentCreated";
+ public virtual ArrayList<string> get_metadata_keys () {
+ var keys = new ArrayList<string> ();
+ keys.add ("nfo:fileName"); // Metadata.FILE_NAME
+ keys.add ("nie:title"); // Metadata.TITLE
+ keys.add ("nie:mimeType"); // Metadata.MIME
+ keys.add ("nfo:fileSize"); // Metadata.SIZE
+ keys.add ("nie:contentCreated"); // Metadata.DATE
+
+ assert (keys.size == Metadata.LAST_KEY);
return keys;
}
diff --git a/src/plugins/tracker/rygel-tracker-music-item-factory.vala b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
index 3d240d6..60b88ca 100644
--- a/src/plugins/tracker/rygel-tracker-music-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
@@ -23,6 +23,7 @@
using GUPnP;
using DBus;
+using Gee;
/**
* Tracker music item factory.
@@ -64,18 +65,15 @@ public class Rygel.TrackerMusicItemFactory : Rygel.TrackerItemFactory {
return item;
}
- public override string[] get_metadata_keys () {
- var base_keys = base.get_metadata_keys ();
+ public override ArrayList<string> get_metadata_keys () {
+ var keys = base.get_metadata_keys ();
- var keys = new string[MusicMetadata.LAST_KEY];
- for (var i = 0; i < base_keys.length; i++) {
- keys[i] = base_keys[i];
- }
+ keys.add ("nmm:length"); // MusicMetadata.DURATION
+ keys.add ("nmm:performer"); // MusicMetadata.AUDIO_ARTIST
+ keys.add ("nmm:musicAlbum"); // MusicMetadata.AUDIO_ALBUM
+ keys.add ("nmm:trackNumber"); // MusicMetadata.AUDIO_TRACK_NUM
- keys[MusicMetadata.DURATION] = "nmm:length";
- keys[MusicMetadata.AUDIO_ARTIST] = "nmm:performer";
- keys[MusicMetadata.AUDIO_ALBUM] = "nmm:musicAlbum";
- keys[MusicMetadata.AUDIO_TRACK_NUM] = "nmm:trackNumber";
+ assert (keys.size == MusicMetadata.LAST_KEY);
return keys;
}
diff --git a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
index 147e48e..676e0ed 100644
--- a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
@@ -23,6 +23,7 @@
using GUPnP;
using DBus;
+using Gee;
/**
* Tracker picture item factory.
@@ -57,16 +58,13 @@ public class Rygel.TrackerPictureItemFactory : Rygel.TrackerItemFactory {
return item;
}
- public override string[] get_metadata_keys () {
- var base_keys = base.get_metadata_keys ();
+ public override ArrayList<string> get_metadata_keys () {
+ var keys = base.get_metadata_keys ();
- var keys = new string[PictureMetadata.LAST_KEY];
- for (var i = 0; i < base_keys.length; i++) {
- keys[i] = base_keys[i];
- }
+ keys.add ("nfo:width"); // PictureMetadata.WIDTH
+ keys.add ("nfo:height"); // PictureMetadata.HEIGHT
- keys[PictureMetadata.WIDTH] = "nfo:width";
- keys[PictureMetadata.HEIGHT] = "nfo:height";
+ assert (keys.size == PictureMetadata.LAST_KEY);
return keys;
}
diff --git a/src/plugins/tracker/rygel-tracker-video-item-factory.vala b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
index 1d95415..378fd20 100644
--- a/src/plugins/tracker/rygel-tracker-video-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
@@ -23,6 +23,7 @@
using GUPnP;
using DBus;
+using Gee;
/**
* Tracker video item factory.
@@ -61,17 +62,14 @@ public class Rygel.TrackerVideoItemFactory : Rygel.TrackerItemFactory {
return item;
}
- public override string[] get_metadata_keys () {
- var base_keys = base.get_metadata_keys ();
+ public override ArrayList<string> get_metadata_keys () {
+ var keys = base.get_metadata_keys ();
- var keys = new string[VideoMetadata.LAST_KEY];
- for (var i = 0; i < base_keys.length; i++) {
- keys[i] = base_keys[i];
- }
+ keys.add ("nfo:width"); // VideoMetadata.WIDTH
+ keys.add ("nfo:height"); // VideoMetadata.HEIGHT
+ keys.add ("nmm:length"); // VideoMetadata.DURATION
- keys[VideoMetadata.WIDTH] = "nfo:width";
- keys[VideoMetadata.HEIGHT] = "nfo:height";
- keys[VideoMetadata.DURATION] = "nmm:length";
+ assert (keys.size == VideoMetadata.LAST_KEY);
return keys;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]