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.
This commit is contained in:
Christopher Davis 2022-07-01 13:08:14 -04:00
parent fadb6bfb9b
commit 689f975bf0
2 changed files with 12 additions and 0 deletions

View file

@ -16,6 +16,13 @@
<property name="flap"> <property name="flap">
<object class="GtkHeaderBar" id="headerbar"> <object class="GtkHeaderBar" id="headerbar">
<property name="show_title_buttons" bind-source="LpWindow" bind-property="fullscreened" bind-flags="sync-create|invert-boolean"/> <property name="show_title_buttons" bind-source="LpWindow" bind-property="fullscreened" bind-flags="sync-create|invert-boolean"/>
<child type="start">
<object class="GtkButton">
<property name="icon-name">edit-copy-symbolic</property>
<property name="action-name">win.copy</property>
<property name="tooltip-text">Copy to Clipboard</property>
</object>
</child>
<child type="end"> <child type="end">
<object class="GtkMenuButton" id="menu_button"> <object class="GtkMenuButton" id="menu_button">
<property name="icon-name">open-menu-symbolic</property> <property name="icon-name">open-menu-symbolic</property>

View file

@ -312,6 +312,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 {
self.show_toast(
&"Image copied to clipboard".to_string(),
adw::ToastPriority::High,
);
} }
} }