[rygel] tracker: Allow subclasses to fail on title/ID creation
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] tracker: Allow subclasses to fail on title/ID creation
- Date: Wed, 8 Dec 2010 16:36:44 +0000 (UTC)
commit 2a7a35150181691a4b1f0c5de13d837f467d9f99
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Dec 8 18:11:13 2010 +0200
tracker: Allow subclasses to fail on title/ID creation
Allow create_id_for_title and create_title_for_value virtual methods of
MetadataValues to return null. When these methods return null for a
metadata value, we simply ignore that value.
.../tracker/rygel-tracker-metadata-values.vala | 10 +++++++---
src/plugins/tracker/rygel-tracker-years.vala | 2 +-
2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index ee08061..472b946 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -125,8 +125,12 @@ public abstract class Rygel.Tracker.MetadataValues : Rygel.SimpleContainer {
}
var title = this.create_title_for_value (value);
+ if (title == null) {
+ continue;
+ }
+
var id = this.create_id_for_title (title);
- if (!this.is_child_id_unique (id)) {
+ if (id == null || !this.is_child_id_unique (id)) {
continue;
}
@@ -165,11 +169,11 @@ public abstract class Rygel.Tracker.MetadataValues : Rygel.SimpleContainer {
}
}
- protected virtual string create_id_for_title (string title) {
+ protected virtual string? create_id_for_title (string title) {
return this.id + ":" + Uri.escape_string (title, "", true);
}
- protected virtual string create_title_for_value (string value) {
+ protected virtual string? create_title_for_value (string value) {
return value;
}
diff --git a/src/plugins/tracker/rygel-tracker-years.vala b/src/plugins/tracker/rygel-tracker-years.vala
index d9ef9f5..60173b3 100644
--- a/src/plugins/tracker/rygel-tracker-years.vala
+++ b/src/plugins/tracker/rygel-tracker-years.vala
@@ -37,7 +37,7 @@ public class Rygel.Tracker.Years : MetadataValues {
KEY_CHAIN);
}
- protected override string create_title_for_value (string value) {
+ protected override string? create_title_for_value (string value) {
return value.ndup (4);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]