From 689f975bf0975bc97cefa272b4097d4bec208d7b Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Fri, 1 Jul 2022 13:08:14 -0400 Subject: [PATCH] window: Add copy button to top left Allan Day's latest mockups put a copy button in the top left of the window. This commits adds the button and the toast along with it. --- data/gtk/window.ui | 7 +++++++ src/window.rs | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/data/gtk/window.ui b/data/gtk/window.ui index bf803d3..52db0f3 100644 --- a/data/gtk/window.ui +++ b/data/gtk/window.ui @@ -16,6 +16,13 @@ + + + edit-copy-symbolic + win.copy + Copy to Clipboard + + open-menu-symbolic diff --git a/src/window.rs b/src/window.rs index 95a6a28..827f89e 100644 --- a/src/window.rs +++ b/src/window.rs @@ -312,6 +312,11 @@ impl LpWindow { if let Err(e) = imp.image_view.copy() { log::error!("Failed to copy to clipboard: {}", e); + } else { + self.show_toast( + &"Image copied to clipboard".to_string(), + adw::ToastPriority::High, + ); } }