feat: edited indicator

This commit is contained in:
Evangelos Paterakis 2022-12-15 21:32:03 +02:00
parent aae418ab4c
commit d89d6a97fc
No known key found for this signature in database
GPG Key ID: FE5185F095BFC8C9
3 changed files with 19 additions and 0 deletions

View File

@ -111,6 +111,18 @@
</style>
</object>
</child>
<child>
<object class="GtkImage" id="edited_indicator">
<property name="visible">0</property>
<property name="can_focus">0</property>
<property name="icon_name">tooth-edit-symbolic</property>
<property name="icon_size">1</property>
<property name="tooltip_text" translatable="yes">Edited</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="date_label">
<property name="can_focus">0</property>

View File

@ -23,6 +23,7 @@ public class Tooth.API.Status : Entity, Widgetizable {
public bool sensitive { get; set; default = false; }
public bool muted { get; set; default = false; }
public bool pinned { get; set; default = false; }
public string? edited_at { get; set; default = null; }
public string visibility { get; set; default = "public"; } // TODO: Bring back default post visibility preference
public API.Status? reblog { get; set; default = null; }
public ArrayList<API.Mention>? mentions { get; set; default = null; }
@ -41,6 +42,10 @@ public class Tooth.API.Status : Entity, Widgetizable {
return this.t_url;
}
public bool is_edited {
get { return edited_at != null; }
}
public Status formal {
get { return reblog ?? this; }
}

View File

@ -40,6 +40,7 @@ public class Tooth.Widgets.Status : ListBoxRow {
[GtkChild] protected unowned Box indicators;
[GtkChild] protected unowned Label date_label;
[GtkChild] protected unowned Image pin_indicator;
[GtkChild] protected unowned Image edited_indicator;
[GtkChild] protected unowned Image indicator;
[GtkChild] protected unowned Box content_column;
@ -197,6 +198,7 @@ public class Tooth.Widgets.Status : ListBoxRow {
bind_property ("subtitle_text", handle_label, "label", BindingFlags.SYNC_CREATE);
bind_property ("date", date_label, "label", BindingFlags.SYNC_CREATE);
status.formal.bind_property ("pinned", pin_indicator, "visible", BindingFlags.SYNC_CREATE);
status.formal.bind_property ("is-edited", edited_indicator, "visible", BindingFlags.SYNC_CREATE);
status.formal.bind_property ("visibility", indicator, "icon_name", BindingFlags.SYNC_CREATE, (b, src, ref target) => {
target.set_string (accounts.active.visibility[src.get_string ()].icon_name);
return true;