From 2b4fd15a255ae75c70fb8f9446703d006225f633 Mon Sep 17 00:00:00 2001 From: Bleak Grey Date: Sat, 17 Oct 2020 14:01:54 +0300 Subject: [PATCH] Views.Thread: Make root status widget prominent --- data/ui/widgets/status.ui | 2 +- src/Views/Thread.vala | 7 ++++--- src/Widgets/Status.vala | 13 +++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/data/ui/widgets/status.ui b/data/ui/widgets/status.ui index 3f11be2..344331f 100644 --- a/data/ui/widgets/status.ui +++ b/data/ui/widgets/status.ui @@ -171,7 +171,7 @@ - + True False 8 diff --git a/src/Views/Thread.vala b/src/Views/Thread.vala index dadcfcc..d555f58 100644 --- a/src/Views/Thread.vala +++ b/src/Views/Thread.vala @@ -4,7 +4,7 @@ public class Tootle.Views.Thread : Views.Base, IAccountListener { public API.Status root_status { get; construct set; } protected InstanceAccount? account = null; - protected Widget root_widget; + protected Widgets.Status root_widget; public Thread (API.Status status) { Object ( @@ -20,7 +20,7 @@ public class Tootle.Views.Thread : Views.Base, IAccountListener { request (); } - Widget prepend (Entity entity, bool to_end = false){ + Widgets.Status prepend (Entity entity, bool to_end = false){ var w = entity.to_widget () as Widgets.Status; w.reveal_spoiler = true; @@ -49,7 +49,8 @@ public class Tootle.Views.Thread : Views.Base, IAccountListener { append (status); }); - root_widget = append (root_status); + root_widget = append (root_status) as Widgets.Status; + root_widget.expand_root (); var descendants = root.get_array_member ("descendants"); descendants.foreach_element ((array, i, node) => { diff --git a/src/Widgets/Status.vala b/src/Widgets/Status.vala index 94bdd55..ae3f629 100644 --- a/src/Widgets/Status.vala +++ b/src/Widgets/Status.vala @@ -30,6 +30,8 @@ public class Tootle.Widgets.Status : ListBoxRow { [GtkChild] protected Image indicator; + [GtkChild] + protected Box content_column; [GtkChild] protected Stack spoiler_stack; [GtkChild] @@ -250,4 +252,15 @@ public class Tootle.Widgets.Status : ListBoxRow { menu.popup_at_widget (menu_button, Gravity.SOUTH_EAST, Gravity.SOUTH_EAST); } + public void expand_root () { + activatable = false; + content.selectable = true; + + var parent = content_column.get_parent () as Container; + var left_attach = parent.find_child_property ("left-attach"); + var width = parent.find_child_property ("width"); + parent.set_child_property (content_column, 1, 0, left_attach); + parent.set_child_property (content_column, 3, 2, width); + } + }