mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
reset notice banner on page update
This commit is contained in:
parent
f7b653f36a
commit
c8607e151a
4 changed files with 24 additions and 14 deletions
|
|
@ -63,7 +63,7 @@ impl Item {
|
||||||
));
|
));
|
||||||
|
|
||||||
target_child.append(&page.navigation.g_box);
|
target_child.append(&page.navigation.g_box);
|
||||||
target_child.append(&page.notice);
|
target_child.append(&page.notice.banner);
|
||||||
target_child.append(&page.content.g_box);
|
target_child.append(&page.content.g_box);
|
||||||
target_child.append(&page.search.g_box);
|
target_child.append(&page.search.g_box);
|
||||||
target_child.append(&page.input.clamp);
|
target_child.append(&page.input.clamp);
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,9 @@ impl Client {
|
||||||
.set_enabled(false);
|
.set_enabled(false);
|
||||||
|
|
||||||
// Reset widgets
|
// Reset widgets
|
||||||
self.page.search.unset();
|
|
||||||
self.page.input.unset();
|
self.page.input.unset();
|
||||||
|
self.page.notice.unset();
|
||||||
|
self.page.search.unset();
|
||||||
self.page.set_title("Loading..");
|
self.page.set_title("Loading..");
|
||||||
self.page.set_progress(0.1);
|
self.page.set_progress(0.1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ mod notice;
|
||||||
mod search;
|
mod search;
|
||||||
|
|
||||||
use super::{Action as ItemAction, BrowserAction, Profile, TabAction, WindowAction};
|
use super::{Action as ItemAction, BrowserAction, Profile, TabAction, WindowAction};
|
||||||
use adw::{Banner, TabPage};
|
use adw::TabPage;
|
||||||
use content::Content;
|
use content::Content;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use input::Input;
|
use input::Input;
|
||||||
|
|
@ -27,7 +27,7 @@ pub struct Page {
|
||||||
pub content: Rc<Content>,
|
pub content: Rc<Content>,
|
||||||
pub input: Rc<Input>,
|
pub input: Rc<Input>,
|
||||||
pub navigation: Rc<Navigation>,
|
pub navigation: Rc<Navigation>,
|
||||||
pub notice: Banner,
|
pub notice: Rc<Notice>,
|
||||||
pub search: Rc<Search>,
|
pub search: Rc<Search>,
|
||||||
// System
|
// System
|
||||||
/// Reference to [TabPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.TabPage.html)
|
/// Reference to [TabPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.TabPage.html)
|
||||||
|
|
@ -59,7 +59,7 @@ impl Page {
|
||||||
(window_action, tab_action, item_action),
|
(window_action, tab_action, item_action),
|
||||||
));
|
));
|
||||||
let input = Rc::new(Input::new());
|
let input = Rc::new(Input::new());
|
||||||
let notice = Banner::notice();
|
let notice = Rc::new(Notice::new());
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
Self {
|
Self {
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,33 @@
|
||||||
use adw::Banner;
|
use adw::Banner;
|
||||||
|
|
||||||
pub trait Notice {
|
pub struct Notice {
|
||||||
fn notice() -> Self;
|
pub banner: Banner,
|
||||||
fn show(&self, title: &str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Notice for Banner {
|
impl Notice {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
/// Create new `Self`
|
/// Create new `Self`
|
||||||
fn notice() -> Self {
|
pub fn new() -> Self {
|
||||||
let banner = Banner::builder().button_label("Ok").build();
|
let banner = Banner::builder().button_label("Ok").build();
|
||||||
banner.connect_button_clicked(|this| this.set_revealed(false));
|
banner.connect_button_clicked(|this| this.set_revealed(false));
|
||||||
banner
|
Self { banner }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
fn show(&self, title: &str) {
|
pub fn show(&self, title: &str) {
|
||||||
self.set_title(title);
|
self.banner.set_title(title);
|
||||||
self.set_revealed(true);
|
self.banner.set_revealed(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn unset(&self) {
|
||||||
|
self.banner.set_revealed(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Notice {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue