Skip to content

Commit

Permalink
feat: partial cleanup (#424)
Browse files Browse the repository at this point in the history
* feat(BookWyrmPage): use builder files

* feat(Background): use cover instead

* feat(Avatar): do not store account or use signals

we only use the account to get the name and the avatar, no point in storing it

* chore(Timelines): use construct

* feat(Main): do not use lambdas for search button

* fix(LWW): infinite loop, statements

* feat(Base): do not use signals for shown status

we can use the setter instead

* chore(Base): move badge properties to Timeline

only used there

* fix(Status): remove menu model on destroy

* chore(EmojiLabel): remove namespaces

* chore: format

* feat(ProfileEdit): use Builder file

* fix(profile_edit): overlay expanding

* feat!: remove GTK < 4.10 compat

* feat!: remove GTK < 4.8 compat

* feat!: remove building without GtkSourceView

* chore(meson): bump gtk version

* feat(Lists): Builder files

* chore: lint

* revert: "chore(Base): move badge properties to Timeline"

This reverts commit 585d045.

* feat(PreviewCard): simplify, builder files

* feat: do not use 'using'

assuming the namespace is difficult for newcomers as one needs to have experience not only in all the namespaces but also the entire codebase

* feat: move more timelines to construct

* fix(FollowRequests): url <-> icon

* feat(Status): move reactions to a sep widget

* feat(Status): move follow request buttons to a sep widget

* fix(Notificatons): attention badge

* chore: lint

* feat(VoteBox): don't use lambdas

* feat(VoteBox): cleanup

* feat(LWW): avoid calling get_text on every allocate_shapes

label's text only gets updated when the label itself does, no reason to call it every time

* feat(LWW): avoid allocating children if there are none

* feat(LWW): avoid keeping track of 3 different arrays for children

instead use a struct

* chore: lint

* feat(Status): split actions

using a generic 'action' request for fav, unfav, boost, unboost, bookmark, unbookmark is kind-of limiting already but could break at a feature mastoapi change. It's better to treat each one as its own request as boosting already takes an extra optional param for visibility. The old 'action' function is still used internally

* feat(EntityCache): force insert option

this allows us to force update entities when we need to update them

* chore: construct object

* feat(Status): ActionRow

let's decouple the actions from the status widget. Also get rid of LockableToggleButton. A toggle button wasn't the right widget for the job, we need to have control over the active state of the button but also handle clicked events ourselves. Network requests happen on click and the active state of the buttons can change multiple times (changes at the beginning and resets on error) before it finishes. Toggle button's toggle signal emits every time the active state changes which the locks had to take care of to avoid doing network requests when in the middle of one or during binding. Additionally, it's better to treat each button as unique instead of assuming they do the same thing but with a different entpoint. They are similar but not identical, boost will have different options eventually (visibility, quote), reply triggers a dialog and bookmark doesn't have a counter

* fix(ActionsRow): unbind on destruction

* fix: only set paintable on is_loaded

* fix(ImageCache): avoid extra var for pixbuf

* feat(Settings): use array for key inits

* fix(Status): avoid lambda

* feat(Status): remove check_actions

this is something notifications should handle

* fix(Status): date not getting formatted correctly on patch when expanded

* feat(Status): do not disconnect the kind avi clicked signal

if the avi doesn't exist so does the signal

* feat(Status): make is_owned () and has_media () getters

* feat(Status): is_quote use array for the widgets

this allows us to skip some repetitive null checks and visibility toggles

* feat(Status): remove direct visibility indicator on bind if not applicable

for clearing before re-binding

* feat(Status): disconnect signals on bind

for clearing before re-binding

* feat(Status): remove obsolete actions box

* feat(Status): remove actions on rebind

* feat(VoteBox): simplify poll binding

BIDIRECTIONAL is enough

* feat(Status): remove attachments on rebind

* chore: lint

* feat(HtmlUtils): use libxml2

warning: libxml2 does not support HTML5 yet

* feat(tests)[HtmlUtils]: remove_tags

* chore: remove comment

* feat(Attachment.Item): avoid lambda

* fix(Status): open formal account directly

using on_activate_link does an extra request, this should be faster as it avoids resolving the account

* feat(NewAccount): hide next button on auto_auth

it's useless then, it's only used on manual auth

* feat(Conversation): remove useless on_error handler

this used to be needed to avoid segfaults, it has been fixed however

* feat: make use of RichLabel's mentions property

this skips resolving the account, should be faster

* feat(RichLabel): stop resolving if mention found

* chore: lint

* feat(Locales): optimize

ListStore needs objects so we can't create a const array of structs

instead of converting a Locale[] to Gee.ArrayList<Locale> on start and then appending each one individually to a liststore every time we need to use them, create a list store of all of them (using splice) on construct and call construct on boot

* fix(MediaViewer): change playing status only when item is done

* feat(MediaViewer): zoom_changed signal should be per item

instead of passing the whole media viewer to every item

* chore(MainWindow): remove unused const

* chore: lint

* feat: initial ListView

* fix(Timeline): nuke entity caches on activation

cache can cause urls to be wrong - even when keys are the same

* fix(Status): unbind bindings

* fix: more listview regressions

* fix(ci): use master for flatpak and disable snap

snap doesn't have the latest runtime yet

* fix(ci): use gnome-nightly
  • Loading branch information
GeopJr authored Aug 30, 2023
1 parent 315c08e commit 0e3c469
Show file tree
Hide file tree
Showing 114 changed files with 3,240 additions and 3,261 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ jobs:
manifest-path: "build-aux/dev.geopjr.Tuba.Devel.json"
cache-key: flatpak-builder-${{ github.sha }}
arch: ${{ matrix.arch }}
repository-name: gnome-nightly
repository-url: https://nightly.gnome.org/gnome-nightly.flatpakrepo # until GNOME 45
snap-builder:
name: "Snap Builder"
runs-on: ubuntu-latest
needs: [ lint ]
if: ${{ false }} # disable until GNOME 45 runtimes get added
strategy:
matrix:
arch: [x86_64, aarch64]
Expand Down
2 changes: 1 addition & 1 deletion build-aux/dev.geopjr.Tuba.Devel.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"app-id": "dev.geopjr.Tuba",
"runtime": "org.gnome.Platform",
"runtime-version": "44",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "dev.geopjr.Tuba",
"finish-args": [
Expand Down
4 changes: 4 additions & 0 deletions data/gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@
<file>ui/views/sidebar/view.ui</file>
<file>ui/views/sidebar/account.ui</file>
<file>ui/views/sidebar/item.ui</file>
<file>ui/widgets/bookwyrmpage.ui</file>
<file>ui/widgets/announcement.ui</file>
<file>ui/widgets/status.ui</file>
<file>ui/widgets/votebox.ui</file>
<file>ui/widgets/preview_card.ui</file>
<file>ui/dialogs/list_edit.ui</file>
<file>ui/dialogs/new_account.ui</file>
<file>ui/dialogs/compose.ui</file>
<file>ui/dialogs/main.ui</file>
<file>ui/dialogs/preferences.ui</file>
<file>ui/dialogs/profile_edit.ui</file>
<file>ui/menus.ui</file>
</gresource>
</gresources>
Expand Down
4 changes: 2 additions & 2 deletions data/gtk/dropdown/language.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="name" type="TubaLocale">
<lookup name="name" type="TubaLocalesLocale">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
Expand All @@ -17,7 +17,7 @@
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="en_name" type="TubaLocale">
<lookup name="en_name" type="TubaLocalesLocale">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
Expand Down
2 changes: 1 addition & 1 deletion data/gtk/dropdown/language_title.ui
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<child> -->
<object class="GtkLabel">
<binding name="label">
<lookup name="locale" type="TubaLocale">
<lookup name="locale" type="TubaLocalesLocale">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
Expand Down
154 changes: 64 additions & 90 deletions data/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,48 +51,6 @@ flowboxchild {
border-radius: 6px;
}

.ttl-view .content row:not(.ttl-post) {
padding: 0px;
}

.ttl-view .small .content {
border: none;
border-radius: 0;
}

.ttl-view .small .content row {
border-left: none;
border-right: none;
border-radius: 0px;
}

/* Hides the top border from the first row of the first listbox */
.ttl-view .small :first-child list row:first-child {
border-top: 0px;
}

.ttl-view:not(.no-transition) .small .content,
.ttl-view:not(.no-transition) clamp>* {
transition: all 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.no-transition {
transition: none;
}

.ttl-view .large {
margin-left: 18px;
margin-right: 18px;
}

.ttl-view .large:first-child {
margin-top: 32px;
}

.ttl-view .large:last-child {
margin-bottom: 32px;
}

.ttl-label-emoji-no-click:hover {
background: transparent;
}
Expand Down Expand Up @@ -290,6 +248,11 @@ flowboxchild {
background-color: @popover_bg_color;
}

.card-spacing {
margin-top: 6px;
margin-bottom: 6px;
}

.ttl-post.direct {
background-color: alpha(@warning_bg_color, .1);
}
Expand Down Expand Up @@ -358,54 +321,6 @@ GtkSourceAssistant.completion list row{
border-radius: 6px 6px 0px 0px;
}

.ttl-view :first-child list row:not(:first-child):not(:last-child) .preview_card.explore {
border-radius: 0px;
}

.ttl-view .small :first-child list row:first-child .preview_card.explore .preview_card_image,
.ttl-view .small :first-child list row:last-child .preview_card.explore .preview_card_image,
.ttl-view :first-child list row:not(:first-child):not(:last-child) .preview_card.explore .preview_card_image {
border-radius: 0px;
}

.ttl-view box:not(.small) :first-child list row:first-child .preview_card.explore {
border-top-left-radius: 12px;
border-top-right-radius: 12px;
}

.ttl-view :first-child list row:first-child .preview_card.explore,
.ttl-view :first-child list row:first-child .preview_card.explore .preview_card_image {
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}

.ttl-view box:not(.small) :first-child list row:first-child .preview_card.explore .preview_card_image:dir(ltr) {
border-top-left-radius: 12px;
}

.ttl-view box:not(.small) :first-child list row:first-child .preview_card.explore .preview_card_image:dir(rtl) {
border-top-right-radius: 12px;
}

.ttl-view :first-child list row:last-child .preview_card.explore,
.ttl-view :first-child list row:last-child .preview_card.explore .preview_card_image {
border-top-left-radius: 0px;
border-top-right-radius: 0px;
}

.ttl-view box:not(.small) :first-child list row:last-child .preview_card.explore {
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
}

.ttl-view box:not(.small) :first-child list row:last-child .preview_card.explore .preview_card_image:dir(ltr) {
border-bottom-left-radius: 12px;
}

.ttl-view box:not(.small) :first-child list row:last-child .preview_card.explore .preview_card_image:dir(rtl) {
border-bottom-right-radius: 12px;
}

.bkwm-desc {
padding: 12px;
}
Expand Down Expand Up @@ -499,3 +414,62 @@ video > overlay > revealer > controls {
.attention {
color: @yellow_4;
}


.ttl-view listview>row.activatable:selected:hover,
.ttl-view listview>row.activatable:hover {
background-color:transparent;
}

.ttl-view listview>row.activatable:selected:active,
.ttl-view listview>row.activatable:active {
box-shadow: none;
}

.ttl-view .content :first-child .card.card-spacing {
margin-top: 0px;
}

.ttl-view .content :last-child .card.card-spacing {
margin-bottom: 0px;
}

.ttl-view .small.content row .card {
border-left: none;
border-right: none;
border-radius: 0px;
}

.ttl-view .small.content {
padding: 0px;
}

.ttl-view .content row:not(.ttl-post) {
padding: 0px;
}

.ttl-view:not(.no-transition) .large.content,
.ttl-view:not(.no-transition) .small.content {
transition: all 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.no-transition {
transition: none;
}

.ttl-view .large {
padding-left: 18px;
padding-right: 18px;
}

.ttl-view .large:first-child {
padding-top: 32px;
}

.ttl-view .large:last-child {
padding-bottom: 32px;
}

.ttl-view .small .preview_card.explore .preview_card_image {
border-radius: 0px;
}
78 changes: 78 additions & 0 deletions data/ui/dialogs/list_edit.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0"/>
<object class="AdwPreferencesPage" id="members_page">
<property name="icon-name">tuba-people-symbolic</property>
<property name="title" translatable="yes">Members</property>
<child>
<object class="AdwPreferencesGroup" id="members_group">
<property name="title" translatable="yes">Remove Members</property>
</object>
</child>
</object>
<template class="TubaDialogsListEdit" parent="AdwPreferencesWindow">
<signal name="close-request" handler="on_close" swapped="no"/>
<property name="modal">1</property>
<property name="default_width">500</property>
<property name="default_height">400</property>
<child>
<object class="AdwPreferencesPage">
<property name="icon-name">tuba-gear-symbolic</property>
<property name="title" translatable="yes">General</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Info</property>
<child>
<object class="AdwEntryRow" id="title_row">
<property name="input-purpose">free-form</property>
<property name="title" translatable="yes">List Name</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Replies Policy</property>
<property name="description" translatable="yes">Show member replies to</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Nobody</property>
<property name="activatable-widget">none_radio</property>
<child type="prefix">
<object class="GtkCheckButton" id="none_radio">
<signal name="toggled" handler="on_radio_toggled" swapped="no"/>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Other members of the list</property>
<property name="activatable-widget">list_radio</property>
<child type="prefix">
<object class="GtkCheckButton" id="list_radio">
<property name="group">none_radio</property>
<signal name="toggled" handler="on_radio_toggled" swapped="no"/>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Any followed user</property>
<property name="activatable-widget">followed_radio</property>
<child type="prefix">
<object class="GtkCheckButton" id="followed_radio">
<property name="group">none_radio</property>
<signal name="toggled" handler="on_radio_toggled" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
1 change: 1 addition & 0 deletions data/ui/dialogs/new_account.ui
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
<object class="GtkButton">
<property name="receives_default">1</property>
<property name="label" translatable="yes">Next</property>
<property name="visible" bind-source="TubaDialogsNewAccount" bind-property="use-auto-auth" bind-flags="sync-create|invert-boolean"/>
<property name="sensitive" bind-source="TubaDialogsNewAccount" bind-property="is_working" bind-flags="sync-create|invert-boolean"/>
<signal name="clicked" handler="on_next_clicked" swapped="no"/>
<style>
Expand Down
2 changes: 1 addition & 1 deletion data/ui/dialogs/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<property name="title" translatable="yes">Default post language</property>

<property name="expression">
<lookup type="TubaLocale" name="name"/>
<lookup type="TubaLocalesLocale" name="name"/>
</property>
</object>
</child>
Expand Down
Loading

0 comments on commit 0e3c469

Please sign in to comment.