mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
add shortcut controller for send action
This commit is contained in:
parent
91c0585835
commit
62d48015ad
1 changed files with 22 additions and 2 deletions
|
|
@ -4,13 +4,14 @@ mod title;
|
|||
|
||||
use control::Control;
|
||||
use form::Form;
|
||||
use sourceview::prelude::ActionExt;
|
||||
use title::Title;
|
||||
|
||||
use super::ItemAction;
|
||||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
glib::{uuid_string_random, Uri, UriHideFlags},
|
||||
prelude::BoxExt,
|
||||
prelude::{BoxExt, WidgetExt},
|
||||
Box, Label, Orientation, TextView,
|
||||
};
|
||||
use std::rc::Rc;
|
||||
|
|
@ -92,7 +93,26 @@ impl Response for Box {
|
|||
}
|
||||
});
|
||||
|
||||
// Return activated `Self`
|
||||
form.add_controller({
|
||||
const SHORTCUT: &str = "<Primary>Return"; // @TODO optional
|
||||
/*control
|
||||
.send
|
||||
.set_tooltip_text(Some(&format!("Shortcut: {SHORTCUT}")));*/
|
||||
let c = gtk::ShortcutController::new();
|
||||
c.add_shortcut(
|
||||
gtk::Shortcut::builder()
|
||||
.trigger(>k::ShortcutTrigger::parse_string(SHORTCUT).unwrap())
|
||||
.action(>k::CallbackAction::new(move |_, _| {
|
||||
if control.send.is_sensitive() {
|
||||
action_send.activate(None);
|
||||
}
|
||||
gtk::glib::Propagation::Stop
|
||||
}))
|
||||
.build(),
|
||||
);
|
||||
c
|
||||
});
|
||||
|
||||
g_box
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue