From 7e03412bd18a4774558f74f5254bce6c20232e8f Mon Sep 17 00:00:00 2001 From: heliguy Date: Tue, 2 Apr 2024 05:31:14 -0400 Subject: [PATCH] Allow description to be copied in properties dialog --- data/ui/properties.blp | 28 +++++++++++++++------------- src/properties_window.py | 9 ++++++++- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/data/ui/properties.blp b/data/ui/properties.blp index a286b13..f6255b8 100644 --- a/data/ui/properties.blp +++ b/data/ui/properties.blp @@ -39,29 +39,31 @@ template $PropertiesWindow: Adw.Dialog { ] } - Button { - margin-top: 6; + Label name { + wrap: true; styles [ - "title-1", - "flat" + "title-1" ] - - Label name { - wrap: true; - } } - Button { - sensitive: true; - + Button description_button { styles [ "title-4", "flat" ] - Label description { - wrap: true; + Box { + spacing: 12; + + Label description { + halign: start; + wrap: true; + hexpand: true; + } + Image { + icon-name: "edit-copy-symbolic"; + } } } diff --git a/src/properties_window.py b/src/properties_window.py index c533909..e994e7a 100644 --- a/src/properties_window.py +++ b/src/properties_window.py @@ -30,8 +30,9 @@ class PropertiesWindow(Adw.Dialog): eol_app_banner = Gtk.Template.Child() eol_runtime_banner = Gtk.Template.Child() mask_banner = Gtk.Template.Child() - description = Gtk.Template.Child() name = Gtk.Template.Child() + description = Gtk.Template.Child() + description_button = Gtk.Template.Child() def copy_item(self, to_copy, to_toast=None): self.get_clipboard().set(to_copy) @@ -62,6 +63,12 @@ class PropertiesWindow(Adw.Dialog): self.size = self.my_utils.get_size_with_format(self.user_data_path) def generate_upper(self): + self.description_button.connect( + "clicked", + lambda *_a: self.copy_item( + self.description.get_label(), _("Description") + ) + ) image = self.my_utils.find_app_icon(self.app_id) self.runtime.set_subtitle(self.current_flatpak[13]) if image.get_paintable() == None: