Views.Thread: Make root status widget prominent

This commit is contained in:
Bleak Grey 2020-10-17 14:01:54 +03:00
parent d92672d895
commit 2b4fd15a25
3 changed files with 18 additions and 4 deletions

View File

@ -171,7 +171,7 @@
</packing>
</child>
<child>
<object class="GtkBox">
<object class="GtkBox" id="content_column">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">8</property>

View File

@ -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) => {

View File

@ -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);
}
}