window: Take toast text as impl AsRef instead of &impl AsRef
This commit is contained in:
parent
37f170b165
commit
d921cd8044
1 changed files with 3 additions and 6 deletions
|
|
@ -180,7 +180,7 @@ mod imp {
|
||||||
obj.set_image_from_file(&file, false);
|
obj.set_image_from_file(&file, false);
|
||||||
} else {
|
} else {
|
||||||
obj.show_toast(
|
obj.show_toast(
|
||||||
&format!("\"{}\" is not a valid image.", info.display_name()),
|
format!("\"{}\" is not a valid image.", info.display_name()),
|
||||||
adw::ToastPriority::High,
|
adw::ToastPriority::High,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -296,14 +296,11 @@ impl LpWindow {
|
||||||
if let Err(e) = imp.image_view.copy() {
|
if let Err(e) = imp.image_view.copy() {
|
||||||
log::error!("Failed to copy to clipboard: {}", e);
|
log::error!("Failed to copy to clipboard: {}", e);
|
||||||
} else {
|
} else {
|
||||||
self.show_toast(
|
self.show_toast("Image copied to clipboard", adw::ToastPriority::High);
|
||||||
&"Image copied to clipboard".to_string(),
|
|
||||||
adw::ToastPriority::High,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_toast(&self, text: &impl AsRef<str>, priority: adw::ToastPriority) {
|
fn show_toast(&self, text: impl AsRef<str>, priority: adw::ToastPriority) {
|
||||||
let imp = self.imp();
|
let imp = self.imp();
|
||||||
|
|
||||||
let toast = adw::Toast::new(text.as_ref());
|
let toast = adw::Toast::new(text.as_ref());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue