[rygel/wip/update-object: 15/15] wip: Code style fixes
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/update-object: 15/15] wip: Code style fixes
- Date: Tue, 23 Oct 2012 10:52:20 +0000 (UTC)
commit 1ca1aa1f6f1fce5b7d7e120e9d57996812d3e28d
Author: Krzesimir Nowak <krnowak openismus com>
Date: Tue Oct 23 12:49:07 2012 +0200
wip: Code style fixes
src/librygel-server/rygel-item-updater.vala | 28 ++++++++++++--------------
src/librygel-server/rygel-media-item.vala | 1 +
src/librygel-server/rygel-music-item.vala | 4 ++-
src/librygel-server/rygel-photo-item.vala | 4 ++-
src/librygel-server/rygel-video-item.vala | 4 ++-
5 files changed, 23 insertions(+), 18 deletions(-)
---
diff --git a/src/librygel-server/rygel-item-updater.vala b/src/librygel-server/rygel-item-updater.vala
index be81257..490fd4f 100644
--- a/src/librygel-server/rygel-item-updater.vala
+++ b/src/librygel-server/rygel-item-updater.vala
@@ -45,13 +45,15 @@ internal class Rygel.ItemUpdater: GLib.Object, Rygel.StateMachine {
public async void run () {
try {
- this.action.get ("ObjectID", typeof (string), out this.object_id);
- this.action.get ("CurrentTagValue",
- typeof (string),
- out this.current_tag_value);
- this.action.get ("NewTagValue",
- typeof (string),
- out this.new_tag_value);
+ this.action.get ("ObjectID",
+ typeof (string),
+ out this.object_id,
+ "CurrentTagValue",
+ typeof (string),
+ out this.current_tag_value,
+ "NewTagValue",
+ typeof (string),
+ out this.new_tag_value);
if (this.object_id == null) {
// Sorry we can't do anything without the ID
throw new ContentDirectoryError.NO_SUCH_OBJECT
@@ -94,12 +96,13 @@ internal class Rygel.ItemUpdater: GLib.Object, Rygel.StateMachine {
switch (c) {
case '\\':
escape = true;
- break;
+ break;
case ',':
list.add (tag_values.substring (token_start, token_length));
token_start += token_length + 1;
token_length = 0;
+
break;
}
}
@@ -121,29 +124,23 @@ internal class Rygel.ItemUpdater: GLib.Object, Rygel.StateMachine {
switch (result) {
case DIDLLiteFragmentResult.OK:
break;
-
case DIDLLiteFragmentResult.CURRENT_BAD_XML:
case DIDLLiteFragmentResult.CURRENT_INVALID:
throw new ContentDirectoryError.INVALID_CURRENT_TAG_VALUE
("Bad current tag value.");
-
case DIDLLiteFragmentResult.NEW_BAD_XML:
case DIDLLiteFragmentResult.NEW_INVALID:
throw new ContentDirectoryError.INVALID_NEW_TAG_VALUE
("Bad current tag value.");
-
case DIDLLiteFragmentResult.REQUIRED_TAG:
throw new ContentDirectoryError.REQUIRED_TAG
("Tried to delete required tag.");
-
case DIDLLiteFragmentResult.READONLY_TAG:
throw new ContentDirectoryError.READ_ONLY_TAG
("Tried to change read-only property.");
-
case DIDLLiteFragmentResult.MISMATCH:
throw new ContentDirectoryError.PARAMETER_MISMATCH
("Parameter count mismatch.");
-
default:
throw new ContentDirectoryError.NO_SUCH_OBJECT ("Unknown error.");
}
@@ -151,7 +148,8 @@ internal class Rygel.ItemUpdater: GLib.Object, Rygel.StateMachine {
private async MediaObject fetch_object () throws Error {
var media_object = yield this.content_dir.root_container.find_object
- (this.object_id, this.cancellable);
+ (this.object_id,
+ this.cancellable);
if (media_object == null) {
throw new ContentDirectoryError.NO_SUCH_OBJECT
diff --git a/src/librygel-server/rygel-media-item.vala b/src/librygel-server/rygel-media-item.vala
index 2d98c75..df59356 100644
--- a/src/librygel-server/rygel-media-item.vala
+++ b/src/librygel-server/rygel-media-item.vala
@@ -190,6 +190,7 @@ public abstract class Rygel.MediaItem : MediaObject {
internal override void apply_didl_lite (DIDLLiteObject didl_object) {
base.apply_didl_lite (didl_object);
+
this.date = didl_object.date;
this.description = didl_object.description;
}
diff --git a/src/librygel-server/rygel-music-item.vala b/src/librygel-server/rygel-music-item.vala
index dd3cc84..f709e44 100644
--- a/src/librygel-server/rygel-music-item.vala
+++ b/src/librygel-server/rygel-music-item.vala
@@ -94,15 +94,17 @@ public class Rygel.MusicItem : AudioItem {
}
}
- private string get_first (GLib.List<GUPnP.DIDLLiteContributor>? contributors) {
+ private string get_first (List<DIDLLiteContributor>? contributors) {
if (contributors != null) {
return contributors.data.name;
}
+
return "";
}
internal override void apply_didl_lite (DIDLLiteObject didl_object) {
base.apply_didl_lite (didl_object);
+
this.artist = get_first (didl_object.get_artists ());
this.track_number = didl_object.track_number;
this.album = didl_object.album;
diff --git a/src/librygel-server/rygel-photo-item.vala b/src/librygel-server/rygel-photo-item.vala
index a419c2c..f2fc913 100644
--- a/src/librygel-server/rygel-photo-item.vala
+++ b/src/librygel-server/rygel-photo-item.vala
@@ -58,15 +58,17 @@ public class Rygel.PhotoItem : ImageItem {
}
}
- private string get_first (GLib.List<GUPnP.DIDLLiteContributor>? contributors) {
+ private string get_first (List<DIDLLiteContributor>? contributors) {
if (contributors != null) {
return contributors.data.name;
}
+
return "";
}
internal override void apply_didl_lite (DIDLLiteObject didl_object) {
base.apply_didl_lite (didl_object);
+
this.creator = get_first (didl_object.get_creators ());
}
diff --git a/src/librygel-server/rygel-video-item.vala b/src/librygel-server/rygel-video-item.vala
index 676f75f..c91bbf9 100644
--- a/src/librygel-server/rygel-video-item.vala
+++ b/src/librygel-server/rygel-video-item.vala
@@ -137,15 +137,17 @@ public class Rygel.VideoItem : AudioItem, VisualItem {
}
}
- private string get_first (GLib.List<GUPnP.DIDLLiteContributor>? contributors) {
+ private string get_first (List<DIDLLiteContributor>? contributors) {
if (contributors != null) {
return contributors.data.name;
}
+
return "";
}
internal override void apply_didl_lite (DIDLLiteObject didl_object) {
base.apply_didl_lite (didl_object);
+
this.author = get_first (didl_object.get_authors ());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]