properly reset copy icon

This commit is contained in:
Ferdinand Schober
2024-04-13 00:28:53 +02:00
parent 5b76c3bcda
commit e537cdbc7e

View File

@@ -67,7 +67,6 @@ impl Window {
#[template_callback]
fn handle_copy_hostname(&self, button: &Button) {
if let Ok(hostname) = hostname::get() {
let prev_icon = button.icon_name().unwrap();
let display = gdk::Display::default().unwrap();
let clipboard = display.clipboard();
clipboard.set_text(hostname.to_str().expect("hostname: invalid utf8"));
@@ -75,7 +74,7 @@ impl Window {
button.set_css_classes(&["success"]);
glib::spawn_future_local(clone!(@weak button => async move {
glib::timeout_future_seconds(1).await;
button.set_icon_name(&prev_icon);
button.set_icon_name("edit-copy-symbolic");
button.set_css_classes(&[]);
}));
}