mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 01:00:02 +00:00
move connect_icon_release
to constructor
This commit is contained in:
parent
f8112a8d24
commit
e58a2a3a90
@ -9,8 +9,7 @@ use tag::Tag;
|
||||
|
||||
use gtk::{
|
||||
prelude::{BoxExt, ButtonExt, CheckButtonExt, EditableExt, EntryExt, TextBufferExt, WidgetExt},
|
||||
Box, Button, Entry, EntryIconPosition, Orientation, TextBuffer, TextIter, TextSearchFlags,
|
||||
TextTag,
|
||||
Box, Button, Entry, Orientation, TextBuffer, TextIter, TextSearchFlags, TextTag,
|
||||
};
|
||||
use std::{cell::Cell, rc::Rc};
|
||||
|
||||
@ -84,11 +83,6 @@ impl Find {
|
||||
}
|
||||
});
|
||||
|
||||
entry.connect_icon_release(move |this, position| match position {
|
||||
EntryIconPosition::Secondary => this.delete_text(0, -1),
|
||||
_ => todo!(), // unexpected
|
||||
});
|
||||
|
||||
match_case.connect_toggled({
|
||||
let entry = entry.clone();
|
||||
let found_tag = tag.found.clone();
|
||||
|
@ -1,8 +1,12 @@
|
||||
use super::MARGIN;
|
||||
use gtk::Entry;
|
||||
use gtk::{
|
||||
prelude::{EditableExt, EntryExt},
|
||||
Entry, EntryIconPosition,
|
||||
};
|
||||
|
||||
pub fn new() -> Entry {
|
||||
Entry::builder()
|
||||
// Init widget
|
||||
let entry = Entry::builder()
|
||||
.hexpand(true)
|
||||
.margin_bottom(MARGIN)
|
||||
.margin_end(MARGIN)
|
||||
@ -12,5 +16,14 @@ pub fn new() -> Entry {
|
||||
.primary_icon_activatable(false)
|
||||
.primary_icon_sensitive(false)
|
||||
.primary_icon_name("system-search-symbolic")
|
||||
.build()
|
||||
.build();
|
||||
|
||||
// Connect events
|
||||
entry.connect_icon_release(|this, position| match position {
|
||||
EntryIconPosition::Secondary => this.delete_text(0, -1),
|
||||
_ => todo!(), // unexpected
|
||||
});
|
||||
|
||||
// Done
|
||||
entry
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user