diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/http-files/CMakeLists.txt | 15 | ||||
-rw-r--r-- | plugins/http-files/src/file_provider.vala | 4 | ||||
-rw-r--r-- | plugins/http-files/src/file_sender.vala | 6 |
3 files changed, 12 insertions, 13 deletions
diff --git a/plugins/http-files/CMakeLists.txt b/plugins/http-files/CMakeLists.txt index b29cfda3..f9d1213b 100644 --- a/plugins/http-files/CMakeLists.txt +++ b/plugins/http-files/CMakeLists.txt @@ -1,11 +1,4 @@ -set(HTTP_FILES_DEFINITIONS) -if(USE_SOUP3) - set(Soup Soup3) - set(HTTP_FILES_DEFINITIONS ${HTTP_FILES_DEFINITIONS} SOUP_3) -else() - set(Soup Soup2) -endif() - +include(SoupVersion) find_packages(HTTP_FILES_PACKAGES REQUIRED Gee GLib @@ -15,6 +8,12 @@ find_packages(HTTP_FILES_PACKAGES REQUIRED ${Soup} ) +set(HTTP_FILES_DEFINITIONS) + +if(${Soup}_VERSION VERSION_GREATER_EQUAL "3.0") + set(HTTP_FILES_DEFINITIONS ${HTTP_FILES_DEFINITIONS} SOUP_3_0) +endif() + vala_precompile(HTTP_FILES_VALA_C SOURCES src/file_provider.vala diff --git a/plugins/http-files/src/file_provider.vala b/plugins/http-files/src/file_provider.vala index 3a3aeb94..7928dc81 100644 --- a/plugins/http-files/src/file_provider.vala +++ b/plugins/http-files/src/file_provider.vala @@ -101,7 +101,7 @@ public class FileProvider : Dino.FileProvider, Object { head_message.request_headers.append("Accept-Encoding", "identity"); try { -#if SOUP_3 +#if SOUP_3_0 yield session.send_async(head_message, GLib.Priority.LOW, null); #else yield session.send_async(head_message, null); @@ -136,7 +136,7 @@ public class FileProvider : Dino.FileProvider, Object { var get_message = new Soup.Message("GET", http_receive_data.url); try { -#if SOUP_3 +#if SOUP_3_0 InputStream stream = yield session.send_async(get_message, GLib.Priority.LOW, file_transfer.cancellable); #else InputStream stream = yield session.send_async(get_message, file_transfer.cancellable); diff --git a/plugins/http-files/src/file_sender.vala b/plugins/http-files/src/file_sender.vala index ab81ffce..a39d695b 100644 --- a/plugins/http-files/src/file_sender.vala +++ b/plugins/http-files/src/file_sender.vala @@ -73,7 +73,7 @@ public class HttpFileSender : FileSender, Object { } } -#if !SOUP_3 +#if !SOUP_3_0 private static void transfer_more_bytes(InputStream stream, Soup.MessageBody body) { uint8[] bytes = new uint8[4096]; ssize_t read = stream.read(bytes); @@ -93,7 +93,7 @@ public class HttpFileSender : FileSender, Object { var session = new Soup.Session(); session.user_agent = @"Dino/$(Dino.get_short_version()) "; var put_message = new Soup.Message("PUT", file_send_data.url_up); -#if SOUP_3 +#if SOUP_3_0 put_message.set_request_body(file_meta.mime_type, file_transfer.input_stream, (ssize_t) file_meta.size); #else put_message.request_headers.set_content_type(file_meta.mime_type, null); @@ -106,7 +106,7 @@ public class HttpFileSender : FileSender, Object { put_message.request_headers.append(entry.key, entry.value); } try { -#if SOUP_3 +#if SOUP_3_0 yield session.send_async(put_message, GLib.Priority.LOW, file_transfer.cancellable); #else yield session.send_async(put_message, file_transfer.cancellable); |