Respect live updates setting

This commit is contained in:
Bleak Grey 2020-05-30 19:37:35 +03:00
parent d79023b605
commit 61a60e482b
4 changed files with 14 additions and 14 deletions

View File

@ -6,11 +6,6 @@
<summary>Current Account</summary>
<description>Do not edit or it shall set your house on fire</description>
</key>
<key name="notifications" type="b">
<default>true</default>
<summary>Display desktop notifications</summary>
<description></description>
</key>
<key name="always-online" type="b">
<default>false</default>
<summary>Always monitor new notifications</summary>

View File

@ -132,8 +132,7 @@ public class Tootle.InstanceAccount : API.Account, IStreamListener {
notification.set_body (body);
}
if (settings.notifications)
app.send_notification (app.application_id + ":" + obj.id.to_string (), notification);
app.send_notification (app.application_id + ":" + obj.id.to_string (), notification);
if (obj.kind == API.NotificationType.WATCHLIST) {
cached_notifications.add (obj);

View File

@ -3,7 +3,6 @@ using GLib;
public class Tootle.Settings : GLib.Settings {
public int current_account { get; set; }
public bool notifications { get; set; }
public bool always_online { get; set; }
public int char_limit { get; set; }
public bool live_updates { get; set; }

View File

@ -155,15 +155,22 @@ public class Tootle.Views.Timeline : IAccountListener, IStreamListener, Views.Ba
}
protected virtual void add_status (API.Status status) {
prepend (widgetize (status));
var allow_update = true;
if (is_public)
allow_update = settings.live_updates_public;
if (settings.live_updates && allow_update)
prepend (widgetize (status));
}
protected virtual void remove_status (int64 id) {
content.get_children ().@foreach (w => {
var sw = w as Widgets.Status;
if (sw != null && sw.status.id == id)
sw.destroy ();
});
if (settings.live_updates) {
content.get_children ().@foreach (w => {
var sw = w as Widgets.Status;
if (sw != null && sw.status.id == id)
sw.destroy ();
});
}
}
}