mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
activate download chooser by default on widget release
This commit is contained in:
parent
61e3a46d9d
commit
e2acfa0bcd
@ -43,7 +43,7 @@ pub fn new(
|
|||||||
let action = Rc::new(Action::new()); // public callback API
|
let action = Rc::new(Action::new()); // public callback API
|
||||||
|
|
||||||
let cancel = Rc::new(Cancel::new());
|
let cancel = Rc::new(Cancel::new());
|
||||||
let choose = Rc::new(Choose::new());
|
let choose = Rc::new(Choose::new(true)); // @TODO optional `is_activate_on_release` value
|
||||||
let open = Rc::new(Open::new());
|
let open = Rc::new(Open::new());
|
||||||
let progress = Rc::new(Progress::new());
|
let progress = Rc::new(Progress::new());
|
||||||
let status = Rc::new(Status::new());
|
let status = Rc::new(Status::new());
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
use gtk::{glib::SignalHandlerId, prelude::ButtonExt, Align, Button};
|
use gtk::{
|
||||||
|
glib::SignalHandlerId,
|
||||||
|
prelude::{ButtonExt, WidgetExt},
|
||||||
|
Align, Button,
|
||||||
|
};
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
|
|
||||||
@ -16,15 +20,21 @@ impl Choose {
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
/// Create new `Self`
|
/// Create new `Self`
|
||||||
pub fn new() -> Self {
|
pub fn new(is_activate_on_release: bool) -> Self {
|
||||||
Self {
|
let button = Button::builder()
|
||||||
button: Button::builder()
|
|
||||||
.css_classes(CSS_CLASSES)
|
.css_classes(CSS_CLASSES)
|
||||||
.halign(Align::Center)
|
.halign(Align::Center)
|
||||||
.label(LABEL)
|
.label(LABEL)
|
||||||
.margin_top(MARGIN)
|
.margin_top(MARGIN)
|
||||||
.build(),
|
.build();
|
||||||
|
|
||||||
|
if is_activate_on_release {
|
||||||
|
button.connect_realize(|this| {
|
||||||
|
this.activate();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Self { button }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user