[rygel] all: Port to new libsoup vapi



commit de90ebc44e59c8d195f838eb4ad70b44e1038a67
Author: Jens Georg <jensg openismus com>
Date:   Sat Sep 28 12:55:37 2013 +0200

    all: Port to new libsoup vapi

 configure.ac                                       |    2 +-
 src/librygel-renderer/rygel-av-transport.vala      |   10 +++++-----
 src/librygel-server/rygel-http-get.vala            |   10 +++++-----
 src/librygel-server/rygel-http-post.vala           |    6 +++---
 src/librygel-server/rygel-http-request.vala        |   12 ++++++------
 src/librygel-server/rygel-http-response.vala       |   12 ++++++------
 src/librygel-server/rygel-http-seek.vala           |    4 ++--
 src/librygel-server/rygel-import-resource.vala     |    7 +++----
 .../mediathek/rygel-mediathek-playlist-parser.vala |    2 +-
 .../mediathek/rygel-mediathek-rss-container.vala   |    2 +-
 10 files changed, 33 insertions(+), 34 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e0ca7a3..64b9a60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ dnl Required versions of library packages
 dnl Not all of these are actually used, depending on the configure options.
 GLIB_REQUIRED=2.31.13
 LIBXML_REQUIRED=2.7
-VALA_REQUIRED=0.20.0
+VALA_REQUIRED=0.22.0
 VALADOC_REQUIRED=0.2
 GSSDP_REQUIRED=0.13.0
 GUPNP_REQUIRED=0.19.0
diff --git a/src/librygel-renderer/rygel-av-transport.vala b/src/librygel-renderer/rygel-av-transport.vala
index ccf93a9..085be2c 100644
--- a/src/librygel-renderer/rygel-av-transport.vala
+++ b/src/librygel-renderer/rygel-av-transport.vala
@@ -247,10 +247,10 @@ internal class Rygel.AVTransport : Service {
             message.request_headers.append ("getContentFeatures.dlna.org",
                                             "1");
             message.finished.connect ((msg) => {
-                if ((msg.status_code == KnownStatusCode.MALFORMED ||
-                     msg.status_code == KnownStatusCode.BAD_REQUEST ||
-                     msg.status_code == KnownStatusCode.METHOD_NOT_ALLOWED ||
-                     msg.status_code == KnownStatusCode.NOT_IMPLEMENTED) &&
+                if ((msg.status_code == Status.MALFORMED ||
+                     msg.status_code == Status.BAD_REQUEST ||
+                     msg.status_code == Status.METHOD_NOT_ALLOWED ||
+                     msg.status_code == Status.NOT_IMPLEMENTED) &&
                     msg.method == "HEAD") {
                     debug ("Peer does not support HEAD, trying GET");
                     msg.method = "GET";
@@ -263,7 +263,7 @@ internal class Rygel.AVTransport : Service {
                     return;
                 }
 
-                if (msg.status_code != KnownStatusCode.OK) {
+                if (msg.status_code != Status.OK) {
                     warning ("Failed to access %s: %s",
                              _uri,
                              msg.reason_phrase);
diff --git a/src/librygel-server/rygel-http-get.vala b/src/librygel-server/rygel-http-get.vala
index 2190b7f..95be210 100644
--- a/src/librygel-server/rygel-http-get.vala
+++ b/src/librygel-server/rygel-http-get.vala
@@ -155,9 +155,9 @@ internal class Rygel.HTTPGet : HTTPRequest {
             this.server.unpause_message (this.msg);
 
             if (error is HTTPSeekError.INVALID_RANGE) {
-                this.end (Soup.KnownStatusCode.BAD_REQUEST);
+                this.end (Soup.Status.BAD_REQUEST);
             } else if (error is HTTPSeekError.OUT_OF_RANGE) {
-                this.end (Soup.KnownStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE);
+                this.end (Soup.Status.REQUESTED_RANGE_NOT_SATISFIABLE);
             } else {
                 throw error;
             }
@@ -170,9 +170,9 @@ internal class Rygel.HTTPGet : HTTPRequest {
 
         // Add general headers
         if (this.msg.request_headers.get_one ("Range") != null) {
-            this.msg.set_status (Soup.KnownStatusCode.PARTIAL_CONTENT);
+            this.msg.set_status (Soup.Status.PARTIAL_CONTENT);
         } else {
-            this.msg.set_status (Soup.KnownStatusCode.OK);
+            this.msg.set_status (Soup.Status.OK);
         }
 
         if (this.handler.knows_size (this)) {
@@ -197,7 +197,7 @@ internal class Rygel.HTTPGet : HTTPRequest {
 
         yield response.run ();
 
-        this.end (Soup.KnownStatusCode.NONE);
+        this.end (Soup.Status.NONE);
     }
 
     private void ensure_correct_mode () throws HTTPRequestError {
diff --git a/src/librygel-server/rygel-http-post.vala b/src/librygel-server/rygel-http-post.vala
index 0e5e96c..f2b598b 100644
--- a/src/librygel-server/rygel-http-post.vala
+++ b/src/librygel-server/rygel-http-post.vala
@@ -164,7 +164,7 @@ internal class Rygel.HTTPPost : HTTPRequest {
         try {
             this.stream.close (this.cancellable);
         } catch (Error error) {
-            this.end (KnownStatusCode.INTERNAL_SERVER_ERROR);
+            this.end (Status.INTERNAL_SERVER_ERROR);
             this.handle_continue ();
 
             return;
@@ -188,7 +188,7 @@ internal class Rygel.HTTPPost : HTTPRequest {
                      move_error.message);
 
             this.server.unpause_message (this.msg);
-            this.end (KnownStatusCode.INTERNAL_SERVER_ERROR);
+            this.end (Status.INTERNAL_SERVER_ERROR);
             this.handle_continue ();
 
             return;
@@ -197,7 +197,7 @@ internal class Rygel.HTTPPost : HTTPRequest {
         yield wait_for_item (this.object.parent, this.object.id, 5);
 
         this.server.unpause_message (this.msg);
-        this.end (KnownStatusCode.OK);
+        this.end (Status.OK);
         this.handle_continue ();
     }
 
diff --git a/src/librygel-server/rygel-http-request.vala b/src/librygel-server/rygel-http-request.vala
index 245967e..9b77f04 100644
--- a/src/librygel-server/rygel-http-request.vala
+++ b/src/librygel-server/rygel-http-request.vala
@@ -24,10 +24,10 @@
  */
 
 internal errordomain Rygel.HTTPRequestError {
-    UNACCEPTABLE = Soup.KnownStatusCode.NOT_ACCEPTABLE,
-    BAD_REQUEST = Soup.KnownStatusCode.BAD_REQUEST,
-    NOT_FOUND = Soup.KnownStatusCode.NOT_FOUND,
-    INTERNAL_SERVER_ERROR = Soup.KnownStatusCode.INTERNAL_SERVER_ERROR
+    UNACCEPTABLE = Soup.Status.NOT_ACCEPTABLE,
+    BAD_REQUEST = Soup.Status.BAD_REQUEST,
+    NOT_FOUND = Soup.Status.NOT_FOUND,
+    INTERNAL_SERVER_ERROR = Soup.Status.INTERNAL_SERVER_ERROR
 }
 
 /**
@@ -109,14 +109,14 @@ internal abstract class Rygel.HTTPRequest : GLib.Object, Rygel.StateMachine {
         if (error is HTTPRequestError) {
             status = error.code;
         } else {
-            status = Soup.KnownStatusCode.NOT_FOUND;
+            status = Soup.Status.NOT_FOUND;
         }
 
         this.end (status);
     }
 
     protected void end (uint status) {
-        if (status != Soup.KnownStatusCode.NONE) {
+        if (status != Soup.Status.NONE) {
             this.msg.set_status (status);
         }
 
diff --git a/src/librygel-server/rygel-http-response.vala b/src/librygel-server/rygel-http-response.vala
index 3403d8c..7cfa7bf 100644
--- a/src/librygel-server/rygel-http-response.vala
+++ b/src/librygel-server/rygel-http-response.vala
@@ -72,14 +72,14 @@ internal class Rygel.HTTPResponse : GLib.Object, Rygel.StateMachine {
         this.src = src;
         this.sink = new DataSink (this.src, this.server, this.msg, this.seek);
         this.src.done.connect ( () => {
-            this.end (false, KnownStatusCode.NONE);
+            this.end (false, Status.NONE);
         });
         this.src.error.connect ( (error) => {
             if (error is DataSourceError.SEEK_FAILED) {
                 this.end (false,
-                          KnownStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE);
+                          Status.REQUESTED_RANGE_NOT_SATISFIABLE);
             } else {
-                this.end (false, KnownStatusCode.NONE);
+                this.end (false, Status.NONE);
             }
         });
 
@@ -105,7 +105,7 @@ internal class Rygel.HTTPResponse : GLib.Object, Rygel.StateMachine {
             this.src.start (this.seek);
         } catch (Error error) {
             Idle.add (() => {
-                this.end (false, KnownStatusCode.NONE);
+                this.end (false, Status.NONE);
 
                 return false;
             });
@@ -128,7 +128,7 @@ internal class Rygel.HTTPResponse : GLib.Object, Rygel.StateMachine {
             this.run_continue ();
         }
 
-        if (status != Soup.KnownStatusCode.NONE) {
+        if (status != Soup.Status.NONE) {
             this.msg.set_status (status);
         }
 
@@ -136,7 +136,7 @@ internal class Rygel.HTTPResponse : GLib.Object, Rygel.StateMachine {
     }
 
     private void on_cancelled (Cancellable cancellable) {
-        this.end (true, Soup.KnownStatusCode.CANCELLED);
+        this.end (true, Soup.Status.CANCELLED);
     }
 
     private void on_server_weak_ref (GLib.Object object) {
diff --git a/src/librygel-server/rygel-http-seek.vala b/src/librygel-server/rygel-http-seek.vala
index 96482e2..a7c66ea 100644
--- a/src/librygel-server/rygel-http-seek.vala
+++ b/src/librygel-server/rygel-http-seek.vala
@@ -24,8 +24,8 @@
  */
 
 public errordomain Rygel.HTTPSeekError {
-    INVALID_RANGE = Soup.KnownStatusCode.BAD_REQUEST,
-    OUT_OF_RANGE = Soup.KnownStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE,
+    INVALID_RANGE = Soup.Status.BAD_REQUEST,
+    OUT_OF_RANGE = Soup.Status.REQUESTED_RANGE_NOT_SATISFIABLE,
 }
 
 public enum Rygel.HTTPSeekType {
diff --git a/src/librygel-server/rygel-import-resource.vala b/src/librygel-server/rygel-import-resource.vala
index 69c49f3..0b35fd2 100644
--- a/src/librygel-server/rygel-import-resource.vala
+++ b/src/librygel-server/rygel-import-resource.vala
@@ -211,7 +211,7 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
                 file.delete (this.cancellable);
             } catch (Error error) {};
 
-            var phrase = status_get_phrase (message.status_code);
+            var phrase = Status.get_phrase (message.status_code);
             if (message.status_code == 404) {
                 this.action.return_error (714, phrase);
             } else {
@@ -235,8 +235,7 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
             } else {
                 this.status = TransferStatus.ERROR;
             }
-            this.session.cancel_message (message,
-                                         KnownStatusCode.CANCELLED);
+            this.session.cancel_message (message, Status.CANCELLED);
         }
     }
 
@@ -265,7 +264,7 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
             if (!(message.status_code >= 200 && message.status_code <= 299)) {
                 this.status = TransferStatus.ERROR;
 
-                var phrase = status_get_phrase (message.status_code);
+                var phrase = Status.get_phrase (message.status_code);
                 this.action.return_error (714, phrase);
             }
         }
diff --git a/src/plugins/mediathek/rygel-mediathek-playlist-parser.vala 
b/src/plugins/mediathek/rygel-mediathek-playlist-parser.vala
index f9b0fec..bb5e979 100644
--- a/src/plugins/mediathek/rygel-mediathek-playlist-parser.vala
+++ b/src/plugins/mediathek/rygel-mediathek-playlist-parser.vala
@@ -40,7 +40,7 @@ internal abstract class Rygel.Mediathek.PlaylistParser : Object {
             throw new VideoItemError.NETWORK_ERROR
                                         ("Playlist download failed: %u (%s)",
                                          message.status_code,
-                                         Soup.status_get_phrase
+                                         Status.get_phrase
                                                       (message.status_code));
         }
 
diff --git a/src/plugins/mediathek/rygel-mediathek-rss-container.vala 
b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
index 5fa24bb..4e40a53 100644
--- a/src/plugins/mediathek/rygel-mediathek-rss-container.vala
+++ b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
@@ -69,7 +69,7 @@ public class Rygel.Mediathek.RssContainer : Rygel.TrackableContainer,
                 warning ("Unexpected response %u for %s: %s",
                          message.status_code,
                          message.uri.to_string (false),
-                         Soup.status_get_phrase (message.status_code));
+                         Soup.Status.get_phrase (message.status_code));
                 break;
         }
     }


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