[rygel] core: More generic ObjectSearch class
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core: More generic ObjectSearch class
- Date: Sun, 20 Sep 2009 23:26:42 +0000 (UTC)
commit 658f1782e8727b8aee5e61f5e4b57ba9663fdbbc
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Sep 17 16:48:20 2009 +0300
core: More generic ObjectSearch class
src/rygel/rygel-simple-container.vala | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/src/rygel/rygel-simple-container.vala b/src/rygel/rygel-simple-container.vala
index 9a3b879..ef71a8a 100644
--- a/src/rygel/rygel-simple-container.vala
+++ b/src/rygel/rygel-simple-container.vala
@@ -96,7 +96,11 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer {
}
}
- var search = new ObjectSearch (id, containers, res, cancellable);
+ var search = new ObjectSearch<Rygel.SimpleAsyncResult<MediaObject>>
+ (id,
+ containers,
+ res,
+ cancellable);
search.completed.connect (this.on_object_search_completed);
this.searches.add (search);
@@ -117,28 +121,32 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer {
}
private void on_object_search_completed (StateMachine state_machine) {
- var search = state_machine as ObjectSearch;
+ var search = state_machine as
+ ObjectSearch<Rygel.SimpleAsyncResult<MediaObject>>;
- search.res.complete ();
+ search.data.data = search.media_object;
+ search.data.complete ();
this.searches.remove (search);
}
}
-private class Rygel.ObjectSearch : GLib.Object, Rygel.StateMachine {
+private class Rygel.ObjectSearch<G> : GLib.Object, Rygel.StateMachine {
public string id;
public ArrayList<MediaContainer> containers;
- public Rygel.SimpleAsyncResult<MediaObject> res;
+ public G data;
public Cancellable cancellable { get; set; }
- public ObjectSearch (string id,
- ArrayList<MediaContainer> containers,
- SimpleAsyncResult<MediaObject> res,
- Cancellable? cancellable) {
+ public MediaObject media_object;
+
+ public ObjectSearch (string id,
+ ArrayList<MediaContainer> containers,
+ G data,
+ Cancellable? cancellable) {
this.id = id;
this.containers = containers;
- this.res = res;
+ this.data = data;
this.cancellable = cancellable;
}
@@ -158,9 +166,9 @@ private class Rygel.ObjectSearch : GLib.Object, Rygel.StateMachine {
AsyncResult res) {
try {
var container = source_object as MediaContainer;
- this.res.data = container.find_object_finish (res);
+ this.media_object = container.find_object_finish (res);
- if (this.res.data == null) {
+ if (this.media_object == null) {
// continue the search
this.containers.remove_at (0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]