revert: "feat(base)[state]: use StatusPage (#69)"

Using AdwStatusPage for base status does not work that well when nested like in Profile. Nested ScrolledWindows also steal focus making it impossible to scroll.

This reverts commit 7905bf3898.
This commit is contained in:
Evangelos Paterakis 2023-02-15 21:32:42 +02:00
parent cd5ca6375c
commit b3f8e943f0
No known key found for this signature in database
GPG Key ID: FE5185F095BFC8C9
3 changed files with 59 additions and 26 deletions

View File

@ -47,28 +47,61 @@
<object class="GtkStackPage">
<property name="name">status</property>
<property name="child">
<object class="AdwStatusPage" id="status_page">
<property name="icon-name">dev.geopjr.tooth-symbolic</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkSpinner" id="status_spinner">
<property name="height_request">32</property>
<property name="spinning">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="status_button">
<property name="visible">0</property>
<property name="halign">center</property>
<style>
<class name="pill"/>
</style>
</object>
</child>
<object class="GtkBox" id="status">
<property name="valign">center</property>
<property name="margin_top">16</property>
<property name="margin_bottom">16</property>
<property name="orientation">vertical</property>
<property name="spacing">16</property>
<child>
<object class="GtkImage">
<property name="width_request">128</property>
<property name="height_request">128</property>
<property name="pixel_size">128</property>
<property name="icon_name">dev.geopjr.tooth-symbolic</property>
<style>
<class name="dim-label"/>
</style>
</object>
</property>
</child>
<child>
<object class="GtkStack" id="status_stack">
<property name="transition_type">crossfade</property>
<child>
<object class="GtkStackPage">
<property name="name">message</property>
<property name="child">
<object class="GtkLabel" id="status_message_label">
<property name="use_markup">1</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">spinner</property>
<property name="child">
<object class="GtkSpinner" id="status_spinner">
<property name="height_request">32</property>
<property name="spinning">True</property>
</object>
</property>
</object>
</child>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="status_button">
<property name="visible">0</property>
<property name="halign">center</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
</object>
</property>
</object>

View File

@ -26,8 +26,8 @@ public class Tooth.Views.Base : Box {
[GtkChild] protected unowned Stack states;
[GtkChild] protected unowned Box content_box;
[GtkChild] protected unowned Button status_button;
[GtkChild] unowned Adw.StatusPage status_page;
[GtkChild] unowned Spinner status_spinner;
[GtkChild] unowned Stack status_stack;
[GtkChild] unowned Label status_message_label;
public string state { get; set; default = "status"; }
public string status_message { get; set; default = STATUS_EMPTY; }
@ -40,8 +40,8 @@ public class Tooth.Views.Base : Box {
bind_property ("state", states, "visible-child-name", BindingFlags.SYNC_CREATE);
notify["status-message"].connect (() => {
status_page.description = @"<span size='large'>$status_message</span>";
status_spinner.visible = status_message == STATUS_LOADING;
status_message_label.label = @"<span size='large'>$status_message</span>";
status_stack.visible_child_name = status_message == STATUS_LOADING ? "spinner" : "message";
});
notify["current"].connect (() => {

View File

@ -104,7 +104,7 @@ public class Tooth.Views.Timeline : AccountHolder, Streamable, Views.ContentBase
public virtual void on_refresh () {
scrolled.vadjustment.value = 0;
status_button.visible = false;
status_button.sensitive = false;
clear ();
status_message = STATUS_LOADING;
GLib.Idle.add (request);