bleakgrey / tootle

GTK-based Mastodon client for Linux
GNU General Public License v3.0
404 stars 61 forks source link

Do not use Soup.Status.get_phrase #333

Closed spaetz closed 2 years ago

spaetz commented 2 years ago

Hi, Debian fails to build from source https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=993088

../../src/Services/Network.vala:69.19-69.40: error: The name `get_phrase' does not exist in the context of `Soup.Status' (libsoup-2.4)
        var reason = Soup.Status.get_phrase (code);
                     ^^^^^^^^^^^^^^^^^^^^^^

I don't know why that code is not available, according to the API docs it should be. However, the docs describe the API as **"There is no reason for you to ever use this function."** (https://valadoc.org/libsoup-2.4/Soup.Status.get_phrase.html).

Instead "you should just look at the message's reason_phrase". Given that the function network.describe_error() is only used twice, it should be easy to replace it:

1) https://github.com/bleakgrey/tootle/blob/cb7a17963ca491562e83005ec19018e9b94dd134/src/Services/Cache/ImageCache.vala#L10 instead of network.describe_error (code), we can use the msg that is available in that function. and

2) https://github.com/bleakgrey/tootle/blob/ddba63d805bcd9ab84ddb74e87b5095a51316647/src/Services/Network/Network.vala#L59

same, we also have the message available in that function and can use the "reason_phrase". This brings tootle in line with the recommended API as per the libsoup authors.

spaetz commented 2 years ago

Just discovered this is aduplicate of #322 and has been filed as #320