summarylogtreecommitdiffstats
path: root/libsoup3.patch
blob: 93124ed65e1b65a222faf463591cc2b00b72344a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
as community/grilo-libs is being built against libsoup-3.0,
we cannot use libsoup-2.4 here; upstream has migrated away
from using libsoup entirely, but they haven't released a new
version since march 2021 :/

the only change here is migrating from session.queue_message
(removed [here][1]) to newer session.send_and_read_async

[1]: https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/139

diff --git a/meson.build b/meson.build
index 2c70551..c97352e 100644
--- a/meson.build
+++ b/meson.build
@@ -43,7 +43,7 @@ m_dep = cc.find_library('m', required : false)
 manette_dep = dependency ('manette-0.2', version: '>=' + manette_min_version)
 retro_gtk_dep = dependency ('retro-gtk-1', version: '>=' + retro_gtk_min_version)
 rsvg_dep = dependency ('librsvg-2.0')
-soup_dep = dependency ('libsoup-2.4')
+soup_dep = dependency ('libsoup-3.0')
 sqlite_dep = dependency ('sqlite3')
 tracker_sparql_dep = dependency ('tracker-sparql-2.0')
 xml_dep = dependency ('libxml-2.0')
diff --git a/plugins/steam/src/steam-cover.vala b/plugins/steam/src/steam-cover.vala
index 6023956..55e08cb 100644
--- a/plugins/steam/src/steam-cover.vala
+++ b/plugins/steam/src/steam-cover.vala
@@ -56,24 +56,24 @@ public class Games.SteamCover : Object, Cover {
 		var message = new Soup.Message ("GET", uri);
 		var success = false;
 
-		session.queue_message (message, (sess, mess) => {
-			if (mess.status_code != Soup.Status.OK) {
-				debug ("Failed to load %s: %u %s.", uri, mess.status_code, mess.reason_phrase);
-				fetch_cover.callback ();
-				return;
-			}
-
-			try {
-				FileUtils.set_data (cover_path, mess.response_body.data);
-				load_cover ();
-				success = true;
-			} catch (Error e) {
-				warning (e.message);
-			}
+		var bytes = yield session.send_and_read_async(message, 0, null);
 
+		if (message.status_code != Soup.Status.OK) {
+			debug ("Failed to load %s: %u %s.", uri, message.status_code, message.reason_phrase);
 			fetch_cover.callback ();
-		});
-		yield;
+			return success;
+		}
+
+		try {
+			FileUtils.set_data (cover_path, bytes.get_data());
+			load_cover ();
+			success = true;
+		} catch (Error e) {
+			warning (e.message);
+		}
+
+		fetch_cover.callback ();
+
 		return success;
 	}
 
diff --git a/src/grilo/grilo-cover.vala b/src/grilo/grilo-cover.vala
index a401576..0d02816 100644
--- a/src/grilo/grilo-cover.vala
+++ b/src/grilo/grilo-cover.vala
@@ -76,20 +76,20 @@ public class Games.GriloCover : Object, Cover {
 		var session = new Soup.Session ();
 		var message = new Soup.Message ("GET", uri);
 
-		session.queue_message (message, (sess, mess) => {
-			if (mess.status_code != Soup.Status.OK) {
-				debug ("Failed to load %s: %u %s.", uri, mess.status_code, mess.reason_phrase);
-
-				return;
-			}
-
-			try {
-				FileUtils.set_data (cover_path, mess.response_body.data);
-				load_cover ();
-			} catch (Error e) {
-				warning (e.message);
-			}
-		});
+		var bytes = yield session.send_and_read_async(message, 0, null);
+
+		if (message.status_code != Soup.Status.OK) {
+			debug ("Failed to load %s: %u %s.", uri, message.status_code, message.reason_phrase);
+
+			return;
+		}
+
+		try {
+			FileUtils.set_data (cover_path, bytes.get_data());
+			load_cover ();
+		} catch (Error e) {
+			warning (e.message);
+		}
 	}
 
 	private void load_cover () throws Error {