implement notice banner

This commit is contained in:
yggverse 2025-03-03 09:54:02 +02:00
parent a68033bc01
commit 12474b0f44
7 changed files with 71 additions and 16 deletions

View file

@ -3,14 +3,16 @@ mod database;
mod error;
mod input;
mod navigation;
mod notice;
mod search;
use super::{Action as ItemAction, BrowserAction, Profile, TabAction, WindowAction};
use adw::TabPage;
use adw::{Banner, TabPage};
use content::Content;
use error::Error;
use input::Input;
use navigation::Navigation;
use notice::Notice;
use search::Search;
use sqlite::Transaction;
use std::rc::Rc;
@ -23,9 +25,10 @@ pub struct Page {
pub window_action: Rc<WindowAction>,
// Components
pub content: Rc<Content>,
pub search: Rc<Search>,
pub input: Rc<Input>,
pub navigation: Rc<Navigation>,
pub notice: Banner,
pub search: Rc<Search>,
// System
/// Reference to [TabPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.TabPage.html)
/// wanted to update title, loading status and other features related with page.
@ -56,6 +59,7 @@ impl Page {
(window_action, tab_action, item_action),
));
let input = Rc::new(Input::new());
let notice = Banner::notice();
// Done
Self {
@ -67,9 +71,10 @@ impl Page {
window_action: window_action.clone(),
// Components
content,
search,
input,
navigation,
notice,
search,
}
}
@ -99,6 +104,11 @@ impl Page {
self.search.show()
}
/// Toggle `Notice` widget
pub fn notice(&self, title: &str) {
self.notice.show(title)
}
/// Cleanup session for `Self`
pub fn clean(
&self,