mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
remove auto-selection for the first child
This commit is contained in:
parent
5723d753c3
commit
a437b9b7a2
1 changed files with 11 additions and 4 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue