Skip to content

Commit

Permalink
community/tootle: fix build, re-enable
Browse files Browse the repository at this point in the history
Both of the patches here are submitted upstream:

bleakgrey/tootle#339
bleakgrey/tootle#336

fixes #13140
  • Loading branch information
craftyguy authored and jirutka committed Oct 27, 2021
1 parent 17203a3 commit 001bf1c
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
From 4722a5c710261b95fbf455d9ec7b7967ca8e5c75 Mon Sep 17 00:00:00 2001
From: Clayton Craft <[email protected]>
Date: Tue, 26 Oct 2021 15:03:25 -0700
Subject: [PATCH 1/2] Adhere to GLib.Object naming conventions for properties

Vala now validates property names against GLib.Object conventions, this
fixes a compilation error as a result of this enforcement:

../src/API/Status.vala:27.5-27.23: error: Name `_url' is not valid for a GLib.Object property
public string? _url { get; set; }
^^^^^^^^^^^^^^^^^^^

Relevant Vala change:
https://gitlab.gnome.org/GNOME/vala/-/commit/38d61fbff037687ea4772e6df85c7e22a74b335e

fixes #337

Signed-off-by: Clayton Craft <[email protected]>
---
src/API/Attachment.vala | 6 +++---
src/API/Status.vala | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/API/Attachment.vala b/src/API/Attachment.vala
index 5c66e79..3749bd7 100644
--- a/src/API/Attachment.vala
+++ b/src/API/Attachment.vala
@@ -32,10 +32,10 @@ public class Tootle.API.Attachment : Entity {
public string kind { get; set; }
public string url { get; set; }
public string? description { get; set; }
- public string? _preview_url { get; set; }
+ private string? t_preview_url { get; set; }
public string? preview_url {
- set { this._preview_url = value; }
- get { return (this._preview_url == null || this._preview_url == "") ? url : _preview_url; }
+ set { this.t_preview_url = value; }
+ get { return (this.t_preview_url == null || this.t_preview_url == "") ? url : t_preview_url; }
}

public static Attachment from (Json.Node node) throws Error {
diff --git a/src/API/Status.vala b/src/API/Status.vala
index 4de9b9d..7ebb2e5 100644
--- a/src/API/Status.vala
+++ b/src/API/Status.vala
@@ -24,16 +24,16 @@ public class Tootle.API.Status : Entity, Widgetizable {
public ArrayList<API.Mention>? mentions { get; set; default = null; }
public ArrayList<API.Attachment>? media_attachments { get; set; default = null; }

- public string? _url { get; set; }
+ private string? t_url { get; set; }
public string url {
owned get { return this.get_modified_url (); }
- set { this._url = value; }
+ set { this.t_url = value; }
}
string get_modified_url () {
- if (this._url == null) {
+ if (this.t_url == null) {
return this.uri.replace ("/activity", "");
}
- return this._url;
+ return this.t_url;
}

public Status formal {
--
2.33.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From 09737d32285f0bad5555be61effab8d512809433 Mon Sep 17 00:00:00 2001
From: Clayton Craft <[email protected]>
Date: Tue, 26 Oct 2021 15:21:22 -0700
Subject: [PATCH 2/2] Use reason_phrase instead of get_phrase

Based on the patch here:
https://github.com/bleakgrey/tootle/pull/336

Rebased on 1.0 branch
---
src/Services/Cache.vala | 2 +-
src/Services/Network.vala | 7 +------
2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/Services/Cache.vala b/src/Services/Cache.vala
index 2251697..2ed314e 100644
--- a/src/Services/Cache.vala
+++ b/src/Services/Cache.vala
@@ -88,7 +88,7 @@ public class Tootle.Cache : GLib.Object {
try {
var code = msg.status_code;
if (code != Soup.Status.OK) {
- var error = network.describe_error (code);
+ var error = msg.reason_phrase;
throw new Oopsie.INSTANCE (@"Server returned $error");
}

diff --git a/src/Services/Network.vala b/src/Services/Network.vala
index fa2839c..d0143b0 100644
--- a/src/Services/Network.vala
+++ b/src/Services/Network.vala
@@ -56,7 +56,7 @@ public class Tootle.Network : GLib.Object {
else if (status == Soup.Status.CANCELLED)
debug ("Message is cancelled. Ignoring callback invocation.");
else
- ecb ((int32) status, describe_error ((int32) status));
+ ecb ((int32) status, msg.reason_phrase);
});
}
catch (Error e) {
@@ -65,11 +65,6 @@ public class Tootle.Network : GLib.Object {
}
}

- public string describe_error (uint code) {
- var reason = Soup.Status.get_phrase (code);
- return @"$code: $reason";
- }
-
public void on_error (int32 code, string message) {
warning (message);
app.toast (message);
--
2.33.1

14 changes: 10 additions & 4 deletions community/tootle/APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
# Maintainer: Clayton Craft <[email protected]>
pkgname=tootle
pkgver=1.0
pkgrel=0
pkgrel=1
pkgdesc="Simple Mastodon client for Linux"
url="https://github.com/bleakgrey/tootle"
# riscv64 disabled due to missing rust in recursive dependency
arch="all !s390x !mips !mips64 !riscv64" # no libhandy
arch="" # See https://gitlab.alpinelinux.org/alpine/aports/-/issues/13140
license="GPL-3.0-or-later"
makedepends="
glib-dev
Expand All @@ -20,7 +19,10 @@ makedepends="
vala
"
subpackages="$pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/bleakgrey/tootle/archive/$pkgver.tar.gz"
source="$pkgname-$pkgver.tar.gz::https://github.com/bleakgrey/tootle/archive/$pkgver.tar.gz
0001-Adhere-to-GLib.Object-naming-conventions-for-propert.patch
0002-Use-reason_phrase-instead-of-get_phrase.patch
"
options="!check" # no tests

build() {
Expand All @@ -31,4 +33,8 @@ build() {
package() {
DESTDIR="$pkgdir" meson install -C output
}
sha512sums="31eadfcc27cff26e8c84ecc56209e8bc9e0f616a9ab32a63208a89875597ecc668ac856a6044533b718c90f4acd286b7f07ca1386d6bb8d259a793e339a3f79d tootle-1.0.tar.gz"
sha512sums="
31eadfcc27cff26e8c84ecc56209e8bc9e0f616a9ab32a63208a89875597ecc668ac856a6044533b718c90f4acd286b7f07ca1386d6bb8d259a793e339a3f79d tootle-1.0.tar.gz
f2c98f02e07bc8d065bee2c959f6339deb82f26ab69ad41de87f7792f1b794d00a817d8e3b02ea2170935eb983c07853c37f9d93eb6b5d2c78cc18f2057d35ca 0001-Adhere-to-GLib.Object-naming-conventions-for-propert.patch
23de63b96506f01dd8619c7c13c8c58e2919fbfe20de531f48714ce017905c4762c3920ec3f7ebae8b42b393f2a751801d09ceb8352656895d55bbe76dc49917 0002-Use-reason_phrase-instead-of-get_phrase.patch
"

0 comments on commit 001bf1c

Please sign in to comment.