[rygel/wip/track-changes: 5/6] WIP: Changes in plugins. Do not build them for now.



commit 68a2e66d15ce2de75a9ba819bede902a10fb5f90
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Tue Sep 11 16:29:30 2012 +0200

    WIP: Changes in plugins. Do not build them for now.

 src/Makefile.am                                    |    4 ++--
 src/plugins/external/rygel-external-container.vala |   16 +++++++++++-----
 .../external/rygel-external-interfaces.vala        |    4 +++-
 .../tracker/rygel-tracker-metadata-container.vala  |    5 +++--
 .../tracker/rygel-tracker-search-container.vala    |    8 ++++++--
 5 files changed, 25 insertions(+), 12 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 2426f6f..34ba984 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
 if BUILD_UI
-SUBDIRS = librygel-core librygel-renderer librygel-server rygel ui plugins
+SUBDIRS = librygel-core librygel-renderer librygel-server rygel ui
 else
-SUBDIRS = librygel-core librygel-renderer librygel-server rygel plugins
+SUBDIRS = librygel-core librygel-renderer librygel-server rygel
 endif
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/plugins/external/rygel-external-container.vala b/src/plugins/external/rygel-external-container.vala
index 128068f..5b8bb03 100644
--- a/src/plugins/external/rygel-external-container.vala
+++ b/src/plugins/external/rygel-external-container.vala
@@ -62,7 +62,7 @@ public class Rygel.External.Container : Rygel.MediaContainer,
                                          path,
                                          DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
-        this.update_container.begin (true);
+        this.update_container.begin (this, ObjectEventType.ADD, false, true);
         if (parent != null) {
             parent.add_weak_pointer (&this.parent);
         }
@@ -318,7 +318,10 @@ public class Rygel.External.Container : Rygel.MediaContainer,
         }
     }
 
-    private async void update_container (bool connect_signal = false) {
+    private async void update_container (MediaObject object,
+                                         ObjectEventType event_type,
+                                         bool sub_tree_update,
+                                         bool connect_signal = false) {
         try {
             Properties props_iface = yield Bus.get_proxy
                                         (BusType.SESSION,
@@ -352,15 +355,18 @@ public class Rygel.External.Container : Rygel.MediaContainer,
         }
 
         // and signal the clients
-        this.updated ();
+        this.updated (object, event_type, sub_tree_update);
 
         if (connect_signal) {
             this.actual_container.updated.connect (this.on_updated);
         }
     }
 
-    private void on_updated (MediaContainerProxy actual_container) {
-        this.update_container.begin ();
+    private void on_updated (MediaContainerProxy actual_container,
+                             MediaObject object,
+                             ObjectUpdateEvent event_type,
+                             bool sub_tree_update) {
+        this.update_container.begin (object, event_type, sub_tree_update);
     }
 
     private MediaContainer find_container_by_id (string id) {
diff --git a/src/plugins/external/rygel-external-interfaces.vala b/src/plugins/external/rygel-external-interfaces.vala
index 9cd50d4..64ba6ad 100644
--- a/src/plugins/external/rygel-external-interfaces.vala
+++ b/src/plugins/external/rygel-external-interfaces.vala
@@ -41,7 +41,9 @@ public interface Rygel.External.MediaContainerProxy : DBusProxy,
     public static const string IFACE = "org.gnome.UPnP.MediaContainer2";
     public static const string[] PROPERTIES = { "ChildCount", "Searchable" };
 
-    public abstract signal void updated ();
+    public abstract signal void updated (MediaObject object,
+                                         ObjectEventType event_type,
+                                         bool sub_tree_update);
 
     public abstract uint child_count { get; set; }
     public abstract uint item_count { get; set; }
diff --git a/src/plugins/tracker/rygel-tracker-metadata-container.vala b/src/plugins/tracker/rygel-tracker-metadata-container.vala
index 46784d4..b7cbc17 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-container.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-container.vala
@@ -72,6 +72,7 @@ public abstract class Rygel.Tracker.MetadataContainer : Rygel.SimpleContainer {
         this.clear ();
 
         var query = this.create_query ();
+        SearchContainer container;
 
         try {
             yield query.execute (this.resources);
@@ -98,7 +99,7 @@ public abstract class Rygel.Tracker.MetadataContainer : Rygel.SimpleContainer {
                     continue;
                 }
 
-                var container = this.create_container (id, title, value);
+                container = this.create_container (id, title, value);
 
                 if (this.child_class != null) {
                     container.upnp_class = child_class;
@@ -115,7 +116,7 @@ public abstract class Rygel.Tracker.MetadataContainer : Rygel.SimpleContainer {
             return;
         }
 
-        this.updated ();
+        this.updated (container, ObjectEventType.ADDED, false);
         this.update_in_progress = false;
     }
 
diff --git a/src/plugins/tracker/rygel-tracker-search-container.vala b/src/plugins/tracker/rygel-tracker-search-container.vala
index 6d2048c..cfd1ffd 100644
--- a/src/plugins/tracker/rygel-tracker-search-container.vala
+++ b/src/plugins/tracker/rygel-tracker-search-container.vala
@@ -220,8 +220,12 @@ public class Rygel.Tracker.SearchContainer : SimpleContainer {
             yield query.execute (this.resources);
 
             if (query.result.next ()) {
-                this.child_count = int.parse (query.result.get_string (0));
-                this.updated ();
+                var new_child_count = int.parse (query.result.get_string (0));
+
+                if (new_child_count != this.child_count) {
+                    this.child_count = new_child_count;
+                    this.updated (this, ObjectEventType.MODIFIED, false);
+                }
             }
 
         } catch (GLib.Error error) {



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