mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-11 21:01:26 +03:00
properly reset copy icon
This commit is contained in:
@@ -67,7 +67,6 @@ impl Window {
|
|||||||
#[template_callback]
|
#[template_callback]
|
||||||
fn handle_copy_hostname(&self, button: &Button) {
|
fn handle_copy_hostname(&self, button: &Button) {
|
||||||
if let Ok(hostname) = hostname::get() {
|
if let Ok(hostname) = hostname::get() {
|
||||||
let prev_icon = button.icon_name().unwrap();
|
|
||||||
let display = gdk::Display::default().unwrap();
|
let display = gdk::Display::default().unwrap();
|
||||||
let clipboard = display.clipboard();
|
let clipboard = display.clipboard();
|
||||||
clipboard.set_text(hostname.to_str().expect("hostname: invalid utf8"));
|
clipboard.set_text(hostname.to_str().expect("hostname: invalid utf8"));
|
||||||
@@ -75,7 +74,7 @@ impl Window {
|
|||||||
button.set_css_classes(&["success"]);
|
button.set_css_classes(&["success"]);
|
||||||
glib::spawn_future_local(clone!(@weak button => async move {
|
glib::spawn_future_local(clone!(@weak button => async move {
|
||||||
glib::timeout_future_seconds(1).await;
|
glib::timeout_future_seconds(1).await;
|
||||||
button.set_icon_name(&prev_icon);
|
button.set_icon_name("edit-copy-symbolic");
|
||||||
button.set_css_classes(&[]);
|
button.set_css_classes(&[]);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user