feat(base)[state]: use StatusPage (#69)
* feat(statuspage): new design * fix(button): center halign * chore: simplify inline statement Co-authored-by: Evangelos Paterakis <evan@geopjr.dev>
This commit is contained in:
parent
5397244af9
commit
7905bf3898
|
@ -47,61 +47,28 @@
|
|||
<object class="GtkStackPage">
|
||||
<property name="name">status</property>
|
||||
<property name="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>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="status_stack">
|
||||
<property name="transition_type">crossfade</property>
|
||||
<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="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 class="GtkSpinner" id="status_spinner">
|
||||
<property name="height_request">32</property>
|
||||
<property name="spinning">True</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 class="GtkButton" id="status_button">
|
||||
<property name="visible">0</property>
|
||||
<property name="halign">center</property>
|
||||
<style>
|
||||
<class name="pill"/>
|
||||
</style>
|
||||
</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>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
|
|
@ -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 Stack status_stack;
|
||||
[GtkChild] unowned Label status_message_label;
|
||||
[GtkChild] unowned Adw.StatusPage status_page;
|
||||
[GtkChild] unowned Spinner status_spinner;
|
||||
|
||||
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_message_label.label = @"<span size='large'>$status_message</span>";
|
||||
status_stack.visible_child_name = status_message == STATUS_LOADING ? "spinner" : "message";
|
||||
status_page.description = @"<span size='large'>$status_message</span>";
|
||||
status_spinner.visible = status_message == STATUS_LOADING;
|
||||
});
|
||||
|
||||
notify["current"].connect (() => {
|
||||
|
|
|
@ -104,7 +104,7 @@ public class Tooth.Views.Timeline : AccountHolder, Streamable, Views.ContentBase
|
|||
|
||||
public virtual void on_refresh () {
|
||||
scrolled.vadjustment.value = 0;
|
||||
status_button.sensitive = false;
|
||||
status_button.visible = false;
|
||||
clear ();
|
||||
status_message = STATUS_LOADING;
|
||||
GLib.Idle.add (request);
|
||||
|
|
Loading…
Reference in New Issue