Skip to content

Commit 8db0624

Browse files
committed
feat: ListBox => ListView
1 parent 316ec29 commit 8db0624

19 files changed

+275
-105
lines changed

build-aux/dev.geopjr.Tuba.Stack.json

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"app-id": "dev.geopjr.Tuba",
3+
"runtime": "org.gnome.Platform",
4+
"runtime-version": "master",
5+
"sdk": "org.gnome.Sdk",
6+
"command": "dev.geopjr.Tuba",
7+
"finish-args": [
8+
"--device=dri",
9+
"--share=ipc",
10+
"--share=network",
11+
"--socket=fallback-x11",
12+
"--socket=wayland",
13+
"--socket=pulseaudio"
14+
],
15+
"cleanup": [
16+
"/include",
17+
"/lib/pkgconfig",
18+
"/man",
19+
"/share/doc",
20+
"/share/gtk-doc",
21+
"/share/man",
22+
"/share/pkgconfig",
23+
"/share/vala",
24+
"*.la",
25+
"*.a"
26+
],
27+
"modules": [
28+
{
29+
"name": "libsass",
30+
"buildsystem": "meson",
31+
"cleanup": [
32+
"*"
33+
],
34+
"sources": [
35+
{
36+
"type": "git",
37+
"url": "https://github.com/lazka/libsass.git",
38+
"commit": "302397c0c8ae2d7ab02f45ea461c2c3d768f248e"
39+
}
40+
]
41+
},
42+
{
43+
"name": "sassc",
44+
"buildsystem": "meson",
45+
"cleanup": [
46+
"*"
47+
],
48+
"sources": [
49+
{
50+
"type": "git",
51+
"url": "https://github.com/lazka/sassc.git",
52+
"commit": "82803377c33247265d779af034eceb5949e78354"
53+
}
54+
]
55+
},
56+
{
57+
"name": "gtk",
58+
"buildsystem": "meson",
59+
"config-opts": [
60+
"-Dbuildtype=release",
61+
"-Dprint-cups=disabled",
62+
"-Dbuild-demos=false",
63+
"-Dbuild-testsuite=false",
64+
"-Dbuild-examples=false",
65+
"-Dbuild-tests=false"
66+
],
67+
"cleanup": [
68+
"/bin/gtk*"
69+
],
70+
"sources": [
71+
{
72+
"type": "git",
73+
"url": "https://gitlab.gnome.org/GNOME/gtk.git",
74+
"tag": "4.17.2"
75+
},
76+
{
77+
"type": "patch",
78+
"path": "listview_lower_min_recycler.patch"
79+
}
80+
]
81+
},
82+
{
83+
"name": "libspelling",
84+
"buildsystem": "meson",
85+
"config-opts": [
86+
"-Ddocs=false"
87+
],
88+
"sources": [
89+
{
90+
"type": "git",
91+
"url": "https://gitlab.gnome.org/GNOME/libspelling.git",
92+
"tag": "0.4.5"
93+
}
94+
]
95+
},
96+
{
97+
"name": "tuba",
98+
"builddir": true,
99+
"buildsystem": "meson",
100+
"config-opts": [
101+
"-Ddevel=true",
102+
"--libdir=lib"
103+
],
104+
"sources": [
105+
{
106+
"type": "dir",
107+
"path": "../"
108+
}
109+
]
110+
}
111+
],
112+
"build-options": {
113+
"env": {}
114+
}
115+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/gtk/gtklistview.c b/gtk/gtklistview.c
2+
--- gtk/gtklistview.c
3+
+++ gtk/gtklistview.c
4+
@@ -33,9 +33,9 @@
5+
/* Maximum number of list items created by the listview.
6+
* For debugging, you can set this to G_MAXUINT to ensure
7+
* there's always a list item for every row.
8+
*/
9+
-#define GTK_LIST_VIEW_MAX_LIST_ITEMS 200
10+
+#define GTK_LIST_VIEW_MAX_LIST_ITEMS 20
11+
12+
/* Extra items to keep above + below every tracker */
13+
#define GTK_LIST_VIEW_EXTRA_ITEMS 2
14+

data/style.css

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ headerbar.flat.no-title .title {
208208
}
209209

210210
.small .ttl-profile-cover>.content {
211-
border-bottom-left-radius: 0px;
212-
border-bottom-right-radius: 0px;
211+
border-radius: 0px;
213212
}
214213

215214
.ttl-box-no-shadow>revealer>box {
@@ -523,67 +522,70 @@ video > overlay > revealer > controls, .audio-controls {
523522
box-shadow: none;
524523
}
525524

526-
/* .ttl-view .content row:first-child { */
527-
.ttl-view .fake-content row:first-child {
525+
.ttl-view .contentbase row:first-child {
526+
/* .ttl-view .fake-content row:first-child { */
528527
margin-top: 0px;
529528
}
530529

531-
/* .ttl-view .content row:last-child { */
532-
.ttl-view .fake-content row:last-child {
530+
.ttl-view .contentbase row:last-child {
531+
/* .ttl-view .fake-content row:last-child { */
533532
margin-bottom: 0px;
534533
}
535534

536-
/* .ttl-view:not(.large-view) .content .card { */
537-
.ttl-view:not(.large-view) .fake-content .card,
538-
.ttl-view:not(.large-view) .fake-content .toggle-group-17 {
535+
.ttl-view:not(.large-view) .contentbase .card,
536+
.ttl-view:not(.large-view) .contentbase .toggle-group-17 {
537+
/* .ttl-view:not(.large-view) .fake-content .card,
538+
.ttl-view:not(.large-view) .fake-content .toggle-group-17 { */
539539
border-left: none;
540540
border-right: none;
541541
border-radius: 0px;
542542
}
543543

544-
/* .ttl-view:not(.large-view) .content { */
545-
.ttl-view:not(.large-view) .fake-content {
544+
.ttl-view:not(.large-view) .contentbase {
545+
/* .ttl-view:not(.large-view) .fake-content { */
546546
padding: 0px;
547547
}
548548

549-
/* .ttl-view .content row:not(.ttl-post) { */
550-
.ttl-view .fake-content row:not(.ttl-post):not(.toggle-group-17) {
549+
.ttl-view .contentbase row:not(.ttl-post):not(.toggle-group-17) {
550+
/* .ttl-view .fake-content row:not(.ttl-post):not(.toggle-group-17) { */
551551
padding: 0px;
552552
}
553553

554-
.card-spacing {
554+
/* .card-spacing {
555555
background-color: var(--card-bg-color);
556-
}
556+
} */
557557

558-
.ttl-profile-cover > .content {
558+
.ttl-profile-cover > .contentbase {
559559
background: none;
560560
}
561561

562-
/* .ttl-view .content { */
563-
.ttl-view .fake-content {
562+
.ttl-view .contentbase {
563+
/* .ttl-view .fake-content { */
564564
transition: all 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
565565
}
566566

567-
.ttl-view.large-view .fake-content:first-child {
567+
.ttl-view.large-view .contentbase:first-child {
568+
/* .ttl-view.large-view .fake-content:first-child { */
568569
padding-top: 32px;
569570
}
570571

571-
.ttl-view.large-view .fake-content:last-child {
572+
.ttl-view.large-view .contentbase:last-child {
573+
/* .ttl-view.large-view .fake-content:last-child { */
572574
padding-bottom: 32px;
573575
}
574576

575-
/* .ttl-view:not(.large-view) .content .card { */
576-
.ttl-view:not(.large-view) .fake-content .card {
577+
.ttl-view:not(.large-view) .contentbase .card {
578+
/* .ttl-view:not(.large-view) .fake-content .card { */
577579
border-bottom: 1px var(--border-color) solid;
578580
}
579581

580-
/* .ttl-view:not(.large-view) .content .card:first-child { */
581-
.ttl-view:not(.large-view) .fake-content .card:first-child {
582+
.ttl-view:not(.large-view) .contentbase .card:first-child {
583+
/* .ttl-view:not(.large-view) .fake-content .card:first-child { */
582584
border-top: 1px var(--border-color) solid;
583585
}
584586

585-
/* .ttl-view:not(.large-view) .content .card { */
586-
.ttl-view:not(.large-view) .fake-content .card {
587+
.ttl-view:not(.large-view) .contentbase .card {
588+
/* .ttl-view:not(.large-view) .fake-content .card { */
587589
box-shadow: none;
588590
}
589591

@@ -599,8 +601,8 @@ video > overlay > revealer > controls, .audio-controls {
599601
border-radius: 12px;
600602
}
601603

602-
/* .ttl-view:not(.large-view) .content .card.card-spacing { */
603-
.ttl-view:not(.large-view) .fake-content .card.card-spacing {
604+
.ttl-view:not(.large-view) .contentbase .card-spacing:not(.keep-margin) {
605+
/* .ttl-view:not(.large-view) .fake-content .card.card-spacing { */
604606
margin: 0px;
605607
}
606608

@@ -612,7 +614,7 @@ video > overlay > revealer > controls, .audio-controls {
612614
padding: 3px 14px;
613615
}
614616

615-
.ttl-view.large-view .fake-content {
617+
.ttl-view.large-view .contentbase {
616618
padding-left: 0;
617619
padding-right: 0;
618620
margin-left: 18px;

data/ui/views/base.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@
159159
<property name="vexpand">1</property>
160160
<property name="hscrollbar_policy">never</property>
161161
<property name="child">
162-
<!-- <object class="AdwClampScrollable" id="content_box"> -->
163-
<object class="AdwClamp" id="content_box">
162+
<object class="AdwClampScrollable" id="content_box">
163+
<!-- <object class="AdwClamp" id="content_box"> -->
164164
<property name="vexpand">1</property>
165165
<property name="visible">True</property>
166166
<property name="maximum_size">670</property>

data/ui/views/profile_header.ui

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<object class="GtkListBox" id="info">
88
<property name="selection_mode">none</property>
99
<property name="activate_on_single_click">0</property>
10+
<property name="overflow">hidden</property>
1011
<style>
1112
<class name="content" />
1213
<class name="uniform-border-color" />

data/ui/widgets/status.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<interface>
33
<requires lib="gtk" version="4.0" />
4-
<!-- <template class="TubaWidgetsStatus" parent="AdwBin"> -->
5-
<template class="TubaWidgetsStatus" parent="GtkListBoxRow">
4+
<template class="TubaWidgetsStatus" parent="AdwBin">
5+
<!-- <template class="TubaWidgetsStatus" parent="GtkListBoxRow"> -->
66
<accessibility>
77
<relation name="described-by">content</relation>
88
</accessibility>

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ project(
99
],
1010
)
1111

12-
# add_project_arguments(['--define=USE_LISTVIEW'], language: 'vala')
12+
add_project_arguments(['--define=USE_LISTVIEW'], language: 'vala')
1313

1414
# https://gitlab.gnome.org/GNOME/vala/-/issues/1413#note_1707480
1515
if meson.get_compiler ('c').get_id () == 'clang'

src/Dialogs/Admin/Report.vala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ public class Tuba.Dialogs.Admin.Report : Dialogs.Admin.Base {
285285
widget.add_css_class ("card-spacing");
286286
widget.actions.visible = false;
287287
widget.menu_button.visible = false;
288-
widget.activatable = false;
288+
#if !USE_LISTVIEW
289+
widget.activatable = false;
290+
#endif
289291
widget.filter_stack.can_focus = false;
290292
widget.filter_stack.can_target = false;
291293
widget.filter_stack.focusable = false;

src/Dialogs/AnnualReport.vala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public class Tuba.Dialogs.AnnualReport : Adw.Dialog {
1818
var widg = status.to_widget () as Widgets.Status;
1919
widg.actions.visible = false;
2020
widg.menu_button.visible = false;
21-
widg.activatable = false;
21+
#if !USE_LISTVIEW
22+
widg.activatable = false;
23+
#endif
2224
widg.filter_stack.can_focus = false;
2325
widg.filter_stack.can_target = false;
2426
widg.filter_stack.focusable = false;

src/Services/Network/Streamable.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public abstract interface Tuba.Streamable : Object {
1+
public interface Tuba.Streamable : Object {
22

33
public struct Event {
44
public string type;

0 commit comments

Comments
 (0)