remove auto-selection for the first child

This commit is contained in:
yggverse 2025-02-06 21:43:43 +02:00
parent 5723d753c3
commit a437b9b7a2

View file

@ -5,7 +5,9 @@ pub trait Mime {
impl Mime for gtk::Entry { impl Mime for gtk::Entry {
fn mime(text: &str) -> Self { fn mime(text: &str) -> Self {
use gtk::prelude::EditableExt; use gtk::prelude::{EditableExt, WidgetExt};
use std::time::Duration;
const TEXT: &str = "Content type (MIME)"; const TEXT: &str = "Content type (MIME)";
let mime = gtk::Entry::builder() let mime = gtk::Entry::builder()
@ -15,10 +17,15 @@ impl Mime for gtk::Entry {
//.tooltip_text(TEXT) //.tooltip_text(TEXT)
.build(); .build();
mime.connect_changed(|this| { mime.connect_realize(|this| {
this.validate(); gtk::glib::timeout_add_local_once(Duration::from_millis(100), {
let this = this.clone();
move || {
this.select_region(0, 0);
}
}); // remove auto-selection for the first child @TODO unstable
}); });
mime.connect_changed(|this| this.validate());
mime mime
} }