rygel r559 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r559 - trunk/src/rygel
- Date: Mon, 9 Feb 2009 22:29:20 +0000 (UTC)
Author: zeeshanak
Date: Mon Feb 9 22:29:20 2009
New Revision: 559
URL: http://svn.gnome.org/viewvc/rygel?rev=559&view=rev
Log:
More utilization of state-machine in Browse.
These changes are particularly for ease of move to async
MediaContainer.get_children method when it's there.
Modified:
trunk/src/rygel/rygel-browse.vala
Modified: trunk/src/rygel/rygel-browse.vala
==============================================================================
--- trunk/src/rygel/rygel-browse.vala (original)
+++ trunk/src/rygel/rygel-browse.vala Mon Feb 9 22:29:20 2009
@@ -153,19 +153,14 @@
var container = (MediaContainer) this.media_object;
this.total_matches = container.child_count;
+ this.update_id = container.update_id;
+
if (this.requested_count == 0) {
// No max count requested, try to fetch all children
this.requested_count = this.total_matches;
}
- if (!this.serialize_children ()) {
- return;
- }
-
- this.update_id = container.update_id;
-
- // Conclude the successful Browse action
- this.conclude ();
+ this.fetch_children ();
}
private void parse_args () {
@@ -241,10 +236,11 @@
this.completed ();
}
- private bool serialize_children () {
- var children = this.get_children ();
+ private void serialize_children (Gee.List<MediaObject>? children) {
if (children == null) {
- return false;
+ this.handle_error (
+ new ContentDirectoryError.NO_SUCH_OBJECT ("No such object"));
+ return;
}
/* serialize all children */
@@ -253,27 +249,27 @@
this.didl_writer.serialize (children[i]);
} catch (Error err) {
this.handle_error (err);
- return false;
+ return;
}
}
- this.number_returned = children.size;
-
- return true;
+ // Conclude the successful Browse action
+ this.conclude ();
}
- private Gee.List<MediaObject>? get_children () {
+ private void fetch_children () {
var container = (MediaContainer) this.media_object;
try {
var children = container.get_children (this.index,
this.requested_count);
+ this.number_returned = children.size;
- return children;
+ serialize_children (children);
} catch {
this.handle_error (
new ContentDirectoryError.NO_SUCH_OBJECT ("No such object"));
- return null;
+ return;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]