Allow description to be copied in properties dialog

This commit is contained in:
heliguy
2024-04-02 05:31:14 -04:00
parent 7543180a86
commit 7e03412bd1
2 changed files with 23 additions and 14 deletions

View File

@@ -39,29 +39,31 @@ template $PropertiesWindow: Adw.Dialog {
] ]
} }
Button { Label name {
margin-top: 6; wrap: true;
styles [ styles [
"title-1", "title-1"
"flat"
] ]
Label name {
wrap: true;
}
} }
Button { Button description_button {
sensitive: true;
styles [ styles [
"title-4", "title-4",
"flat" "flat"
] ]
Label description { Box {
wrap: true; spacing: 12;
Label description {
halign: start;
wrap: true;
hexpand: true;
}
Image {
icon-name: "edit-copy-symbolic";
}
} }
} }

View File

@@ -30,8 +30,9 @@ class PropertiesWindow(Adw.Dialog):
eol_app_banner = Gtk.Template.Child() eol_app_banner = Gtk.Template.Child()
eol_runtime_banner = Gtk.Template.Child() eol_runtime_banner = Gtk.Template.Child()
mask_banner = Gtk.Template.Child() mask_banner = Gtk.Template.Child()
description = Gtk.Template.Child()
name = 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): def copy_item(self, to_copy, to_toast=None):
self.get_clipboard().set(to_copy) 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) self.size = self.my_utils.get_size_with_format(self.user_data_path)
def generate_upper(self): 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) image = self.my_utils.find_app_icon(self.app_id)
self.runtime.set_subtitle(self.current_flatpak[13]) self.runtime.set_subtitle(self.current_flatpak[13])
if image.get_paintable() == None: if image.get_paintable() == None: