rygel r513 - in trunk/src: plugins/dvb plugins/test plugins/tracker rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r513 - in trunk/src: plugins/dvb plugins/test plugins/tracker rygel
- Date: Wed, 28 Jan 2009 12:34:28 +0000 (UTC)
Author: zeeshanak
Date: Wed Jan 28 12:34:28 2009
New Revision: 513
URL: http://svn.gnome.org/viewvc/rygel?rev=513&view=rev
Log:
Move most of ContentDirectory implementation into the base class.
The only method that derived classes need to implement now is
'create_root_container'.
Modified:
trunk/src/plugins/dvb/rygel-dvb-content-dir.vala
trunk/src/plugins/test/rygel-test-content-dir.vala
trunk/src/plugins/tracker/rygel-media-tracker.vala
trunk/src/rygel/rygel-content-directory.vala
Modified: trunk/src/plugins/dvb/rygel-dvb-content-dir.vala
==============================================================================
--- trunk/src/plugins/dvb/rygel-dvb-content-dir.vala (original)
+++ trunk/src/plugins/dvb/rygel-dvb-content-dir.vala Wed Jan 28 12:34:28 2009
@@ -32,53 +32,6 @@
*/
public class Rygel.DVBContentDir : ContentDirectory {
// Pubic methods
- public override MediaObject find_object_by_id (string object_id)
- throws GLib.Error {
- var media_object = this.root_container.find_object_by_id (object_id);
- if (media_object == null) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- return media_object;
- }
-
- public override Gee.List<MediaObject> get_children (
- string container_id,
- uint offset,
- uint max_count,
- out uint child_count)
- throws GLib.Error {
- var media_object = this.find_object_by_id (container_id);
- if (media_object == null || !(media_object is MediaContainer)) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- var container = (MediaContainer) media_object;
- var children = container.get_children (offset,
- max_count,
- out child_count);
- if (children == null) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- return children;
- }
-
- public override Gee.List<MediaObject> get_root_children (
- uint offset,
- uint max_count,
- out uint child_count)
- throws GLib.Error {
- var children = this.root_container.get_children (offset,
- max_count,
- out child_count);
- if (children == null) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- return children;
- }
-
public override MediaContainer? create_root_container () {
string friendly_name = this.root_device.get_friendly_name ();
return new DVBRootContainer (friendly_name, this.http_server);
Modified: trunk/src/plugins/test/rygel-test-content-dir.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-content-dir.vala (original)
+++ trunk/src/plugins/test/rygel-test-content-dir.vala Wed Jan 28 12:34:28 2009
@@ -31,31 +31,6 @@
*/
public class Rygel.TestContentDir : ContentDirectory {
/* Pubic methods */
- public override Gee.List<MediaObject> get_root_children (
- uint offset,
- uint max_count,
- out uint child_count)
- throws GLib.Error {
- var children = this.root_container.get_children (offset,
- max_count,
- out child_count);
- if (children == null) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- return children;
- }
-
- public override MediaObject find_object_by_id (string object_id)
- throws GLib.Error {
- var media_object = this.root_container.find_object_by_id (object_id);
- if (media_object == null) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- return media_object;
- }
-
public override MediaContainer? create_root_container () {
string friendly_name = this.root_device.get_friendly_name ();
return new TestRootContainer (friendly_name, this.http_server);
Modified: trunk/src/plugins/tracker/rygel-media-tracker.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-media-tracker.vala (original)
+++ trunk/src/plugins/tracker/rygel-media-tracker.vala Wed Jan 28 12:34:28 2009
@@ -31,53 +31,6 @@
*/
public class Rygel.MediaTracker : ContentDirectory {
/* Pubic methods */
- public override Gee.List<MediaObject> get_children (
- string container_id,
- uint offset,
- uint max_count,
- out uint child_count)
- throws GLib.Error {
- var media_object = this.find_object_by_id (container_id);
- if (media_object == null || !(media_object is MediaContainer)) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- var container = (MediaContainer) media_object;
- var children = container.get_children (offset,
- max_count,
- out child_count);
- if (children == null) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- return children;
- }
-
- public override MediaObject find_object_by_id (string object_id)
- throws GLib.Error {
- var media_object = this.root_container.find_object_by_id (object_id);
- if (media_object == null) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- return media_object;
- }
-
- public override Gee.List<MediaObject> get_root_children (
- uint offset,
- uint max_count,
- out uint child_count)
- throws GLib.Error {
- var children = this.root_container.get_children (offset,
- max_count,
- out child_count);
- if (children == null) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
-
- return children;
- }
-
public override MediaContainer? create_root_container () {
string friendly_name = this.root_device.get_friendly_name ();
return new TrackerRootContainer (friendly_name, this.http_server);
Modified: trunk/src/rygel/rygel-content-directory.vala
==============================================================================
--- trunk/src/rygel/rygel-content-directory.vala (original)
+++ trunk/src/rygel/rygel-content-directory.vala Wed Jan 28 12:34:28 2009
@@ -74,27 +74,6 @@
DIDLLiteWriter didl_writer;
// Public abstract methods derived classes need to implement
- public virtual Gee.List<MediaObject> get_children (string container_id,
- uint offset,
- uint max_count,
- out uint child_count)
- throws GLib.Error {
- throw new ServerError.NOT_IMPLEMENTED ("Not Implemented\n");
- }
-
- public virtual MediaObject find_object_by_id (string object_id)
- throws GLib.Error {
- throw new ServerError.NOT_IMPLEMENTED ("Not Implemented\n");
- }
-
- public virtual Gee.List<MediaObject> get_root_children (
- uint offset,
- uint max_count,
- out uint child_count)
- throws GLib.Error {
- throw new ServerError.NOT_IMPLEMENTED ("Not Implemented\n");
- }
-
public virtual MediaContainer? create_root_container () {
return null;
}
@@ -372,6 +351,52 @@
args.update_id = uint32.MAX;
}
+ protected virtual Gee.List<MediaObject> get_children (string container_id,
+ uint offset,
+ uint max_count,
+ out uint child_count)
+ throws GLib.Error {
+ var media_object = this.find_object_by_id (container_id);
+ if (media_object == null || !(media_object is MediaContainer)) {
+ throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
+ }
+
+ var container = (MediaContainer) media_object;
+ var children = container.get_children (offset,
+ max_count,
+ out child_count);
+ if (children == null) {
+ throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
+ }
+
+ return children;
+ }
+
+ protected virtual MediaObject find_object_by_id (string object_id)
+ throws GLib.Error {
+ var media_object = this.root_container.find_object_by_id (object_id);
+ if (media_object == null) {
+ throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
+ }
+
+ return media_object;
+ }
+
+ protected virtual Gee.List<MediaObject> get_root_children (
+ uint offset,
+ uint max_count,
+ out uint child_count)
+ throws GLib.Error {
+ var children = this.root_container.get_children (offset,
+ max_count,
+ out child_count);
+ if (children == null) {
+ throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
+ }
+
+ return children;
+ }
+
private void on_item_requested (HTTPServer http_server,
string item_id,
out MediaItem item) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]