create_item should be implemented by SearchContainer.
var search_container = (TrackerSearchContainer) this.source_object;
string path = search_container.get_item_path (item_id);
- this.data = search_container.create_item (path, metadata);
+ this.data = search_container.create_item (search_container.service,
+ path,
+ metadata);
this.complete ();
}
protected override string[] get_metadata_keys () {
return TrackerImageItem.get_metadata_keys ();
}
-
- protected override MediaItem? create_item (string path, string[] metadata) {
- return new TrackerImageItem (this.id + ":" + path,
- path,
- this,
- metadata);
- }
}
protected override string[] get_metadata_keys () {
return TrackerMusicItem.get_metadata_keys ();
}
-
- protected override MediaItem? create_item (string path, string[] metadata) {
- return new TrackerMusicItem (this.id + ":" + path,
- path,
- this,
- metadata);
- }
}
}
}
+ public MediaItem? create_item (string service,
+ string path,
+ string[] metadata) {
+ if (service == TrackerVideoItem.SERVICE) {
+ return new TrackerVideoItem (this.id + ":" + path,
+ path,
+ this,
+ metadata);
+ } else if (service == TrackerImageItem.SERVICE) {
+ return new TrackerImageItem (this.id + ":" + path,
+ path,
+ this,
+ metadata);
+ } else if (service == TrackerMusicItem.SERVICE) {
+ return new TrackerMusicItem (this.id + ":" + path,
+ path,
+ this,
+ metadata);
+ } else {
+ return null;
+ }
+ }
+
private void create_proxies () throws GLib.Error {
DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
}
protected abstract string[] get_metadata_keys ();
- protected abstract MediaItem? create_item (string path, string[] metadata);
}
/* Iterate through all items */
for (uint i = 0; i < search_result.length; i++) {
string child_path = search_result[i][0];
+ string service = search_result[i][1];
string[] metadata = this.slice_strv_tail (search_result[i], 2);
- var item = search_container.create_item (child_path, metadata);
+ var item = search_container.create_item (service,
+ child_path,
+ metadata);
this.data.add (item);
}
protected override string[] get_metadata_keys () {
return TrackerVideoItem.get_metadata_keys ();
}
-
- protected override MediaItem? create_item (string path, string[] metadata) {
- return new TrackerVideoItem (this.id + ":" + path,
- path,
- this,
- metadata);
- }
}