From 864c5108ac228979a882c8db4f76ccc9b19bbd53 Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 12 Dec 2024 14:10:43 +0200 Subject: [PATCH] toggle button label on activate --- .../item/page/content/status/download/choose.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app/browser/window/tab/item/page/content/status/download/choose.rs b/src/app/browser/window/tab/item/page/content/status/download/choose.rs index a6cff78c..2757e156 100644 --- a/src/app/browser/window/tab/item/page/content/status/download/choose.rs +++ b/src/app/browser/window/tab/item/page/content/status/download/choose.rs @@ -7,7 +7,7 @@ use gtk::{ // Defaults const CSS_CLASSES: [&str; 1] = ["suggested-action"]; -const LABEL: &str = "Choose location.."; +const LABEL: (&str, &str) = ("Choose location..", "Awaiting for choose.."); const MARGIN: i32 = 16; /// Choose destination [File](https://docs.gtk.org/gio/iface.File.html) @@ -24,11 +24,23 @@ impl Choose { let button = Button::builder() .css_classes(CSS_CLASSES) .halign(Align::Center) - .label(LABEL) + .label(if is_activate_on_release { + LABEL.1 + } else { + LABEL.0 + }) .margin_top(MARGIN) .sensitive(!is_activate_on_release) .build(); + button.connect_sensitive_notify(|this| { + if this.is_sensitive() { + this.set_label(LABEL.0) + } else { + this.set_label(LABEL.1) + } + }); + if is_activate_on_release { button.connect_realize(|this| { this.activate();