Skip to content

Commit 2165daa

Browse files
authored
feat(NewAccount): custom LWW-enabled status page-like widget (#1591)
1 parent 11924c1 commit 2165daa

File tree

5 files changed

+86
-21
lines changed

5 files changed

+86
-21
lines changed

data/style.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,24 @@ splitbutton.pill:dir(ltr) > menubutton > button {
10551055
border-bottom-right-radius: inherit;
10561056
}
10571057

1058+
/*
1059+
New Account Dialog
1060+
*/
1061+
.statusbox {
1062+
margin: 36px 12px;
1063+
border-spacing: 12px;
1064+
}
1065+
1066+
.statusbox > image {
1067+
color: color-mix(in srgb, currentColor var(--dim-opacity), transparent);
1068+
-gtk-icon-size: 128px;
1069+
margin-bottom: 24px;
1070+
}
1071+
1072+
.statusbox > :last-child {
1073+
margin-top: 24px;
1074+
}
1075+
10581076
/*
10591077
Celebrate
10601078
*/

data/ui/dialogs/new_account.ui

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -211,25 +211,68 @@
211211
</object>
212212
</child>
213213
<property name="content">
214-
<object class="AdwStatusPage" id="done_page">
215-
<property name="vexpand">1</property>
216-
<property name="icon_name">tuba-check-round-outline-symbolic</property>
217-
<property name="title">Hello!</property>
218-
<property name="description" translatable="yes">Your account is connected and ready to use!</property>
214+
<object class="GtkScrolledWindow">
215+
<property name="propagate-natural-height">1</property>
219216
<child>
220-
<object class="GtkButton">
221-
<property name="halign">center</property>
222-
<property name="receives_default">1</property>
223-
<property name="label" translatable="yes">Done</property>
224-
<property name="sensitive" bind-source="TubaDialogsNewAccount" bind-property="is_working" bind-flags="sync-create|invert-boolean"/>
225-
<signal name="clicked" handler="on_done_clicked" swapped="no"/>
226-
<style>
227-
<class name="suggested-action"/>
228-
<class name="pill"/>
229-
</style>
217+
<object class="AdwClamp">
218+
<property name="maximum-size">600</property>
219+
<property name="tightening-threshold">400</property>
220+
<child>
221+
<object class="GtkBox">
222+
<property name="orientation">vertical</property>
223+
<property name="valign">center</property>
224+
<style>
225+
<class name="statusbox" />
226+
</style>
227+
<child>
228+
<object class="GtkImage">
229+
<property name="halign">center</property>
230+
<property name="icon_name">tuba-check-round-outline-symbolic</property>
231+
<style>
232+
<class name="icon" />
233+
</style>
234+
</object>
235+
</child>
236+
<child>
237+
<object class="TubaWidgetsEmojiLabel" id="done_page_emoji_label">
238+
<property name="justify">center</property>
239+
<property name="xalign">0.5</property>
240+
<property name="large-emojis">1</property>
241+
<style>
242+
<class name="title-1" />
243+
</style>
244+
</object>
245+
</child>
246+
<child>
247+
<object class="GtkLabel">
248+
<property name="justify">center</property>
249+
<property name="wrap">1</property>
250+
<property name="wrap-mode">word-char</property>
251+
<property name="label" translatable="yes">Your account is connected and ready to use!</property>
252+
<style>
253+
<class name="description" />
254+
<class name="body" />
255+
</style>
256+
</object>
257+
</child>
258+
<child>
259+
<object class="GtkButton">
260+
<property name="halign">center</property>
261+
<property name="receives_default">1</property>
262+
<property name="label" translatable="yes">Done</property>
263+
<property name="sensitive" bind-source="TubaDialogsNewAccount" bind-property="is_working" bind-flags="sync-create|invert-boolean"/>
264+
<signal name="clicked" handler="on_done_clicked" swapped="no"/>
265+
<style>
266+
<class name="suggested-action"/>
267+
<class name="pill"/>
268+
</style>
269+
</object>
270+
</child>
271+
</object>
272+
</child>
230273
</object>
231274
</child>
232-
</object>
275+
</object>
233276
</property>
234277
</object>
235278
</property>

src/Dialogs/NewAccount.vala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ public class Tuba.Dialogs.NewAccount: Adw.Window {
3232
[GtkChild] unowned Gtk.Label code_entry_error;
3333

3434
[GtkChild] unowned Adw.StatusPage auth_page;
35-
[GtkChild] unowned Adw.StatusPage done_page;
35+
[GtkChild] unowned Widgets.EmojiLabel done_page_emoji_label;
3636

3737
[GtkChild] unowned Gtk.Label manual_auth_label;
3838

39+
static construct {
40+
typeof (Widgets.EmojiLabel).ensure ();
41+
}
42+
3943
public string get_full_scopes () {
4044
string scopes = SCOPES;
4145
if (this.admin_mode) scopes = @"$scopes $ADMIN_SCOPES";
@@ -244,7 +248,8 @@ public class Tuba.Dialogs.NewAccount: Adw.Window {
244248
debug ("Saving account");
245249
accounts.add (account);
246250

247-
done_page.title = _("Hello, %s!").printf (account.display_name);
251+
done_page_emoji_label.instance_emojis = account.emojis_map;
252+
done_page_emoji_label.content = _("Hello, %s!").printf (account.display_name);
248253
deck.push (done_step);
249254

250255
debug ("Switching to account");

src/Widgets/EmojiLabel.vala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public class Tuba.Widgets.EmojiLabel : Tuba.Widgets.LabelWithWidgets {
2828
if (text == null) return;
2929

3030
instance_emojis = emojis;
31-
3231
content = text;
3332
}
3433

src/Widgets/LabelWithWidgets.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ public class Tuba.Widgets.LabelWithWidgets : Gtk.Widget, Gtk.Buildable, Gtk.Acce
364364
public bool ellipsize {
365365
get { return _ellipsize; }
366366
set {
367-
if (value != this.ellipsize) {
367+
if (value != _ellipsize) {
368368
label.ellipsize = value ? Pango.EllipsizeMode.END : Pango.EllipsizeMode.NONE;
369-
_ellipsize = true;
369+
_ellipsize = value;
370370
}
371371
}
372372
}

0 commit comments

Comments
 (0)