[rygel] tracker: Adapt to new Tracker update API
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] tracker: Adapt to new Tracker update API
- Date: Fri, 12 Nov 2010 15:56:32 +0000 (UTC)
commit 6fd3fed7c927784066255add308cfb2405a0dfa7
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Nov 12 15:38:22 2010 +0200
tracker: Adapt to new Tracker update API
src/plugins/tracker/rygel-tracker-interfaces.vala | 28 +++++++------------
.../tracker/rygel-tracker-item-factory.vala | 3 --
.../tracker/rygel-tracker-metadata-values.vala | 27 +++++++------------
.../tracker/rygel-tracker-music-item-factory.vala | 1 -
.../rygel-tracker-picture-item-factory.vala | 1 -
.../tracker/rygel-tracker-video-item-factory.vala | 1 -
6 files changed, 20 insertions(+), 41 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-interfaces.vala b/src/plugins/tracker/rygel-tracker-interfaces.vala
index 30ac613..1b29bf3 100644
--- a/src/plugins/tracker/rygel-tracker-interfaces.vala
+++ b/src/plugins/tracker/rygel-tracker-interfaces.vala
@@ -21,6 +21,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+public struct Event {
+ int graph_id;
+ int subject_id;
+ int pred_id;
+ int object_id;
+}
+
[DBus (name = "org.freedesktop.Tracker1.Statistics")]
public interface Rygel.Tracker.StatsIface : DBusProxy {
public abstract async string[,] get_statistics () throws IOError;
@@ -33,23 +40,8 @@ public interface Rygel.Tracker.ResourcesIface: DBusProxy {
public abstract async void sparql_update (string query) throws IOError;
public abstract async HashTable<string,string>[,] sparql_update_blank (
string query) throws IOError;
-}
-
-[DBus (name = "org.freedesktop.Tracker1.Resources.Class")]
-public interface Rygel.Tracker.ResourcesClassIface: DBusProxy {
- public abstract signal void subjects_added (string[] subjects);
- public abstract signal void subjects_removed (string[] subjects);
- public abstract signal void subjects_changed (string[] before,
- string[] after);
-}
-namespace Rygel {
- public const string RESOURCES_CLASS_PATH = "/org/freedesktop/Tracker1/" +
- "Resources/Classes/";
- public const string MUSIC_RESOURCES_CLASS_PATH = RESOURCES_CLASS_PATH +
- "nmm/MusicPiece";
- public const string VIDEO_RESOURCES_CLASS_PATH = RESOURCES_CLASS_PATH +
- "nmm/Video";
- public const string PHOTO_RESOURCES_CLASS_PATH = RESOURCES_CLASS_PATH +
- "nfo/Image";
+ public signal void graph_updated (string class_name,
+ Event[] deletes,
+ Event[] inserts);
}
diff --git a/src/plugins/tracker/rygel-tracker-item-factory.vala b/src/plugins/tracker/rygel-tracker-item-factory.vala
index 5993ef5..6cf9e75 100644
--- a/src/plugins/tracker/rygel-tracker-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-item-factory.vala
@@ -40,18 +40,15 @@ public abstract class Rygel.Tracker.ItemFactory {
public string category;
public string upnp_class;
- public string resources_class_path;
public string upload_dir;
public ArrayList<ArrayList<string>> key_chains;
public ItemFactory (string category,
string upnp_class,
- string resources_class_path,
string? upload_dir) {
this.category = category;
this.upnp_class = upnp_class;
- this.resources_class_path = resources_class_path;
this.upload_dir = upload_dir;
this.key_chains = new ArrayList<ArrayList<string>> ();
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index bfbc65e..52d8a23 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -42,7 +42,6 @@ public abstract class Rygel.Tracker.MetadataValues : Rygel.SimpleContainer {
private string child_class;
private ResourcesIface resources;
- private ResourcesClassIface resources_class;
public MetadataValues (string id,
MediaContainer parent,
@@ -66,7 +65,7 @@ public abstract class Rygel.Tracker.MetadataValues : Rygel.SimpleContainer {
this.fetch_metadata_values.begin ();
- this.hook_to_changes ();
+ this.resources.graph_updated.connect (this.on_graph_updated);
}
private async void fetch_metadata_values () {
@@ -188,23 +187,17 @@ public abstract class Rygel.Tracker.MetadataValues : Rygel.SimpleContainer {
this.resources = Bus.get_proxy_sync (BusType.SESSION,
TRACKER_SERVICE,
RESOURCES_PATH);
- this.resources_class = Bus.get_proxy_sync (
- BusType.SESSION,
- TRACKER_SERVICE,
- this.item_factory.resources_class_path);
}
- private void hook_to_changes () {
- // For any changes in subjects, just recreate hierarchy
- this.resources_class.subjects_added.connect ((subjects) => {
- this.fetch_metadata_values.begin ();
- });
- this.resources_class.subjects_removed.connect ((subjects) => {
- this.fetch_metadata_values.begin ();
- });
- this.resources_class.subjects_changed.connect ((before, after) => {
- this.fetch_metadata_values.begin ();
- });
+ private void on_graph_updated (string class_name,
+ Event[] deletes,
+ Event[] inserts) {
+ var our_suffix = this.item_factory.category.replace (":", "#");
+ if (!class_name.has_suffix (our_suffix)) {
+ return;
+ }
+
+ this.fetch_metadata_values.begin ();
}
private bool is_child_id_unique (string child_id) {
diff --git a/src/plugins/tracker/rygel-tracker-music-item-factory.vala b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
index 8b5e9e9..2db4f97 100644
--- a/src/plugins/tracker/rygel-tracker-music-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
@@ -46,7 +46,6 @@ public class Rygel.Tracker.MusicItemFactory : ItemFactory {
public MusicItemFactory () {
base (CATEGORY,
MusicItem.UPNP_CLASS,
- MUSIC_RESOURCES_CLASS_PATH,
Environment.get_user_special_dir (UserDirectory.MUSIC));
for (var i = this.key_chains.size; i < MusicMetadata.LAST_KEY; i++) {
diff --git a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
index d722ed3..c73a4e6 100644
--- a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
@@ -39,7 +39,6 @@ public class Rygel.Tracker.PictureItemFactory : ItemFactory {
public PictureItemFactory () {
base (CATEGORY,
PhotoItem.UPNP_CLASS,
- PHOTO_RESOURCES_CLASS_PATH,
Environment.get_user_special_dir (UserDirectory.PICTURES));
for (var i = this.key_chains.size; i < PictureMetadata.LAST_KEY; i++) {
diff --git a/src/plugins/tracker/rygel-tracker-video-item-factory.vala b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
index db66cdf..dfdfb4b 100644
--- a/src/plugins/tracker/rygel-tracker-video-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
@@ -40,7 +40,6 @@ public class Rygel.Tracker.VideoItemFactory : ItemFactory {
public VideoItemFactory () {
base (CATEGORY,
VideoItem.UPNP_CLASS,
- VIDEO_RESOURCES_CLASS_PATH,
Environment.get_user_special_dir (UserDirectory.VIDEOS));
for (var i = this.key_chains.size; i < VideoMetadata.LAST_KEY; i++) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]