util/root: Use specific function to show toasts
This commit is contained in:
parent
3e69dc4c6f
commit
7b45009eed
5 changed files with 40 additions and 65 deletions
|
|
@ -39,15 +39,28 @@ pub trait ParentWindow: WidgetExt {
|
|||
let result = self.root().and_downcast();
|
||||
|
||||
if result.is_none() {
|
||||
log::debug!(
|
||||
"Couldn't find LpWindow for {self:?}. mapped={}",
|
||||
self.is_mapped()
|
||||
log::error!(
|
||||
"Couldn't find LpWindow for {self:?}. mapped={}. caller={}",
|
||||
self.is_mapped(),
|
||||
std::panic::Location::caller(),
|
||||
);
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
fn window_show_toast(&self, text: &str, priority: adw::ToastPriority) {
|
||||
if let Some(window) = self.try_window() {
|
||||
window.show_toast(text, priority);
|
||||
}
|
||||
}
|
||||
|
||||
fn window_add_toast(&self, toast: adw::Toast) {
|
||||
if let Some(window) = self.try_window() {
|
||||
window.add_toast(toast);
|
||||
}
|
||||
}
|
||||
|
||||
fn edit_window(&self) -> LpEditWindow {
|
||||
let parent = self.parent().unwrap();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue