From b7155df0ce7ea245fb443ee0a0946b9051987241 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Mon, 27 Feb 2023 23:59:27 +0200 Subject: [PATCH] fix(Lists): don't show spinner if there's no results --- src/Views/Lists.vala | 3 ++- src/Views/Timeline.vala | 28 +++++++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/Views/Lists.vala b/src/Views/Lists.vala index 2287313..91a9c0c 100644 --- a/src/Views/Lists.vala +++ b/src/Views/Lists.vala @@ -279,7 +279,7 @@ public class Tooth.Views.Lists : Views.Timeline { public Lists () { Object ( - url: @"/api/v1/lists", + url: @"/api/v1/lists", label: _("Lists"), icon: "tooth-list-compact-symbolic" ); @@ -343,6 +343,7 @@ public class Tooth.Views.Lists : Views.Timeline { } public override void on_request_finish () { + base.on_request_finish (); on_content_changed (); } diff --git a/src/Views/Timeline.vala b/src/Views/Timeline.vala index 97d3574..8841f3f 100644 --- a/src/Views/Timeline.vala +++ b/src/Views/Timeline.vala @@ -80,23 +80,25 @@ public class Tooth.Views.Timeline : AccountHolder, Streamable, Views.ContentBase return req; } - public virtual void on_request_finish () {} + public virtual void on_request_finish () { + status_loading = false; + } public virtual bool request () { var req = append_params (new Request.GET (get_req_url ())) - .with_account (account) - .with_ctx (this) - .then ((sess, msg) => { - Network.parse_array (msg, node => { - var e = entity_cache.lookup_or_insert (node, accepts); - model.append (e); //FIXME: use splice(); - }); + .with_account (account) + .with_ctx (this) + .then ((sess, msg) => { + Network.parse_array (msg, node => { + var e = entity_cache.lookup_or_insert (node, accepts); + model.append (e); //FIXME: use splice(); + }); - get_pages (msg.response_headers.get_one ("Link")); - on_content_changed (); - on_request_finish (); - }) - .on_error (on_error); + get_pages (msg.response_headers.get_one ("Link")); + on_content_changed (); + on_request_finish (); + }) + .on_error (on_error); req.exec (); return GLib.Source.REMOVE;