Setup loading functions

This commit is contained in:
heliguy
2024-07-21 12:32:31 -04:00
parent 859d1ff28c
commit 36a70fdf71
2 changed files with 7 additions and 2 deletions

View File

@@ -31,7 +31,6 @@ template $RemotesPage : Adw.NavigationPage {
Adw.ToastOverlay {
Stack stack {
Adw.StatusPage loading_remotes {
visible: false;
title: _("Loading Remotes");
description: _("This should only take a moment");
child:
@@ -46,7 +45,6 @@ template $RemotesPage : Adw.NavigationPage {
icon-name: "system-search-symbolic";
}
Adw.StatusPage no_remotes {
visible: false;
title: _("No Remotes Found");
description: _("Warehouse cannot see the current remotes or your system has no remotes added");
icon-name: "error-symbolic";

View File

@@ -23,6 +23,12 @@ class RemotesPage(Adw.NavigationPage):
# It is used to determine if a new page should be made or not
# This must be set to the created object from within the class's __init__ method
instance = None
def start_loading(self):
self.stack.set_visible_child(self.loading_remotes)
def end_loading(self):
self.stack.set_visible_child(self.content_page)
def __init__(self, main_window, **kwargs):
super().__init__(**kwargs)
@@ -30,6 +36,7 @@ class RemotesPage(Adw.NavigationPage):
# Extra Object Creation
ms = main_window.main_split
self.search_bar.set_key_capture_widget(main_window)
self.__class__.instance = self
# Connections
ms.connect("notify::show-sidebar", lambda *_: self.sidebar_button.set_active(ms.get_show_sidebar()))