Skip to content

Commit

Permalink
remove auto-selection for the first child
Browse files Browse the repository at this point in the history
  • Loading branch information
yggverse committed Feb 6, 2025
1 parent 5723d75 commit a437b9b
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ pub trait Mime {

impl Mime for gtk::Entry {
fn mime(text: &str) -> Self {
use gtk::prelude::EditableExt;
use gtk::prelude::{EditableExt, WidgetExt};
use std::time::Duration;

const TEXT: &str = "Content type (MIME)";

let mime = gtk::Entry::builder()
Expand All @@ -15,10 +17,15 @@ impl Mime for gtk::Entry {
//.tooltip_text(TEXT)
.build();

mime.connect_changed(|this| {
this.validate();
mime.connect_realize(|this| {
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
}

Expand Down

0 comments on commit a437b9b

Please sign in to comment.