|
| 1 | +From 4722a5c710261b95fbf455d9ec7b7967ca8e5c75 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Clayton Craft < [email protected]> |
| 3 | +Date: Tue, 26 Oct 2021 15:03:25 -0700 |
| 4 | +Subject: [PATCH 1/2] Adhere to GLib.Object naming conventions for properties |
| 5 | + |
| 6 | +Vala now validates property names against GLib.Object conventions, this |
| 7 | +fixes a compilation error as a result of this enforcement: |
| 8 | + |
| 9 | +../src/API/Status.vala:27.5-27.23: error: Name `_url' is not valid for a GLib.Object property |
| 10 | + public string? _url { get; set; } |
| 11 | + ^^^^^^^^^^^^^^^^^^^ |
| 12 | + |
| 13 | +Relevant Vala change: |
| 14 | +https://gitlab.gnome.org/GNOME/vala/-/commit/38d61fbff037687ea4772e6df85c7e22a74b335e |
| 15 | + |
| 16 | +fixes #337 |
| 17 | + |
| 18 | +Signed-off-by: Clayton Craft < [email protected]> |
| 19 | +--- |
| 20 | + src/API/Attachment.vala | 6 +++--- |
| 21 | + src/API/Status.vala | 8 ++++---- |
| 22 | + 2 files changed, 7 insertions(+), 7 deletions(-) |
| 23 | + |
| 24 | +diff --git a/src/API/Attachment.vala b/src/API/Attachment.vala |
| 25 | +index 5c66e79..3749bd7 100644 |
| 26 | +--- a/src/API/Attachment.vala |
| 27 | ++++ b/src/API/Attachment.vala |
| 28 | +@@ -32,10 +32,10 @@ public class Tootle.API.Attachment : Entity { |
| 29 | + public string kind { get; set; } |
| 30 | + public string url { get; set; } |
| 31 | + public string? description { get; set; } |
| 32 | +- public string? _preview_url { get; set; } |
| 33 | ++ private string? t_preview_url { get; set; } |
| 34 | + public string? preview_url { |
| 35 | +- set { this._preview_url = value; } |
| 36 | +- get { return (this._preview_url == null || this._preview_url == "") ? url : _preview_url; } |
| 37 | ++ set { this.t_preview_url = value; } |
| 38 | ++ get { return (this.t_preview_url == null || this.t_preview_url == "") ? url : t_preview_url; } |
| 39 | + } |
| 40 | + |
| 41 | + public static Attachment from (Json.Node node) throws Error { |
| 42 | +diff --git a/src/API/Status.vala b/src/API/Status.vala |
| 43 | +index 4de9b9d..7ebb2e5 100644 |
| 44 | +--- a/src/API/Status.vala |
| 45 | ++++ b/src/API/Status.vala |
| 46 | +@@ -24,16 +24,16 @@ public class Tootle.API.Status : Entity, Widgetizable { |
| 47 | + public ArrayList<API.Mention>? mentions { get; set; default = null; } |
| 48 | + public ArrayList<API.Attachment>? media_attachments { get; set; default = null; } |
| 49 | + |
| 50 | +- public string? _url { get; set; } |
| 51 | ++ private string? t_url { get; set; } |
| 52 | + public string url { |
| 53 | + owned get { return this.get_modified_url (); } |
| 54 | +- set { this._url = value; } |
| 55 | ++ set { this.t_url = value; } |
| 56 | + } |
| 57 | + string get_modified_url () { |
| 58 | +- if (this._url == null) { |
| 59 | ++ if (this.t_url == null) { |
| 60 | + return this.uri.replace ("/activity", ""); |
| 61 | + } |
| 62 | +- return this._url; |
| 63 | ++ return this.t_url; |
| 64 | + } |
| 65 | + |
| 66 | + public Status formal { |
| 67 | +-- |
| 68 | +2.33.1 |
| 69 | + |
0 commit comments