-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Announcements * fix: statement * chore: lint * feat: respect settings
- Loading branch information
Showing
13 changed files
with
428 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
data/icons/scalable/actions/tuba-important-small-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -468,3 +468,7 @@ video > overlay > revealer > controls { | |
border-radius: 100%; | ||
padding: 3px; | ||
} | ||
|
||
.attention { | ||
color: @yellow_4; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<interface> | ||
<requires lib="gtk" version="4.0" /> | ||
<template class="TubaWidgetsAnnouncement" parent="GtkListBoxRow"> | ||
<property name="child"> | ||
<object class="GtkBox"> | ||
<property name="margin-start">18</property> | ||
<property name="margin-end">18</property> | ||
<property name="margin_top">15</property> | ||
<property name="margin_bottom">18</property> | ||
<property name="hexpand">1</property> | ||
<property name="orientation">horizontal</property> | ||
<property name="spacing">14</property> | ||
<child> | ||
<object class="GtkBox"> | ||
<property name="orientation">vertical</property> | ||
<child> | ||
<object class="AdwAvatar" id="avatar"> | ||
<property name="size">48</property> | ||
<property name="valign">start</property> | ||
<property name="visible">true</property> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
<child> | ||
<object class="GtkBox"> | ||
<property name="orientation">vertical</property> | ||
<child> | ||
<object class="GtkBox"> | ||
<property name="vexpand">1</property> | ||
<property name="spacing">6</property> | ||
<property name="valign">start</property> | ||
<child> | ||
<object class="GtkFlowBox"> | ||
<property name="selection-mode">none</property> | ||
<property name="column_spacing">6</property> | ||
<!-- Lower values leave space between items --> | ||
<property name="max_children_per_line">100</property> | ||
<child> | ||
<object class="GtkFlowBoxChild"> | ||
<property name="focusable">0</property> | ||
<child> | ||
<object class="TubaWidgetsRichLabel" id="name_label"> | ||
<property name="visible">True</property> | ||
<property name="ellipsize">False</property> | ||
<property name="use-markup">False</property> | ||
<property name="smaller-emoji-pixel-size">True</property> | ||
<style> | ||
<class name="font-bold" /> | ||
<class name="ttl-name-button" /> | ||
</style> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
<child> | ||
<object class="GtkFlowBoxChild"> | ||
<property name="can-target">0</property> | ||
<child> | ||
<object class="GtkLabel" id="handle_label"> | ||
<property name="label" translatable="no">Handle</property> | ||
<property name="ellipsize">end</property> | ||
<property name="single_line_mode">1</property> | ||
<property name="xalign">0</property> | ||
<property name="hexpand">1</property> | ||
<style> | ||
<class name="body" /> | ||
<class name="dim-label" /> | ||
</style> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
<child> | ||
<object class="GtkBox"> | ||
<property name="halign">end</property> | ||
<property name="valign">center</property> | ||
<property name="margin_start">6</property> | ||
<property name="spacing">3</property> | ||
<child> | ||
<object class="GtkImage" id="attention_indicator"> | ||
<property name="visible">0</property> | ||
<property name="icon_name">tuba-important-small-symbolic</property> | ||
<property name="icon_size">1</property> | ||
<property name="tooltip_text" translatable="yes">Unread</property> | ||
<style> | ||
<class name="attention" /> | ||
</style> | ||
</object> | ||
</child> | ||
<child> | ||
<object class="GtkImage" id="edited_indicator"> | ||
<property name="visible">0</property> | ||
<property name="icon_name">tuba-paper-small-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="label" translatable="no">Yesterday</property> | ||
<property name="xalign">0</property> | ||
<style> | ||
<class name="body" /> | ||
<class name="dim-label" /> | ||
</style> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
|
||
<child> | ||
<object class="GtkBox"> | ||
<property name="orientation">vertical</property> | ||
<property name="spacing">6</property> | ||
<style> | ||
<class name="ttl-status-content" /> | ||
</style> | ||
<child> | ||
<object class="TubaWidgetsMarkupView" id="content"> | ||
<property name="visible">True</property> | ||
<property name="hexpand">False</property> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
|
||
<child> | ||
<object class="GtkFlowBox" id="emoji_reactions"> | ||
<property name="margin-top">16</property> | ||
<property name="visible">0</property> | ||
<property name="column_spacing">6</property> | ||
<property name="row_spacing">6</property> | ||
<!-- Lower values leave space between items --> | ||
<property name="max_children_per_line">100</property> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
</object> | ||
</property> | ||
<style> | ||
<class name="ttl-post" /> | ||
</style> | ||
</template> | ||
</interface> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
public class Tuba.API.Announcement : Entity, Widgetizable { | ||
public string id { get; set; } | ||
public string content { get; set; } | ||
public bool published { get; set; default=true; } | ||
public string published_at { get; set; } | ||
public string updated_at { get; set; } | ||
public bool read { get; set; default=true; } | ||
public Gee.ArrayList<API.Emoji>? emojis { get; set; } | ||
public Gee.ArrayList<API.EmojiReaction>? reactions { get; set; default = null; } | ||
|
||
public Gee.HashMap<string, string>? emojis_map { | ||
owned get { | ||
return gen_emojis_map (); | ||
} | ||
} | ||
|
||
private Gee.HashMap<string, string>? gen_emojis_map () { | ||
var res = new Gee.HashMap<string, string> (); | ||
if (emojis != null && emojis.size > 0) { | ||
emojis.@foreach (e => { | ||
res.set (e.shortcode, e.url); | ||
return true; | ||
}); | ||
} | ||
|
||
return res; | ||
} | ||
|
||
public override Gtk.Widget to_widget () { | ||
return new Widgets.Announcement (this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
public class Tuba.Views.Announcements : Views.Timeline { | ||
public Announcements () { | ||
Object ( | ||
url: "/api/v1/announcements?with_dismissed=true", | ||
label: _("Announcements"), | ||
icon: "tuba-lightbulb-symbolic" | ||
); | ||
accepts = typeof (API.Announcement); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
sources += files( | ||
'Announcements.vala', | ||
'Base.vala', | ||
'Bookmarks.vala', | ||
'ContentBase.vala', | ||
|
Oops, something went wrong.