mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
delegate history_snap action to protocol driver implementation
This commit is contained in:
parent
68b3119bb1
commit
33d5d414ac
16 changed files with 124 additions and 147 deletions
|
|
@ -32,30 +32,25 @@ impl Load {
|
|||
|
||||
/// Emit [activate](https://docs.gtk.org/gio/signal.SimpleAction.activate.html) signal
|
||||
/// with formatted for this action [Variant](https://docs.gtk.org/glib/struct.Variant.html) value
|
||||
pub fn activate(&self, request: Option<&str>, is_history: bool) {
|
||||
self.simple_action.activate(Some(
|
||||
&(request.unwrap_or_default(), is_history).to_variant(),
|
||||
));
|
||||
pub fn activate(&self, request: Option<&str>) {
|
||||
self.simple_action
|
||||
.activate(Some(&(request.unwrap_or_default()).to_variant()));
|
||||
}
|
||||
|
||||
// Events
|
||||
|
||||
/// Define callback function for
|
||||
/// [SimpleAction::activate](https://docs.gtk.org/gio/signal.SimpleAction.activate.html) signal
|
||||
pub fn connect_activate(&self, callback: impl Fn(Option<GString>, bool) + 'static) {
|
||||
pub fn connect_activate(&self, callback: impl Fn(Option<GString>) + 'static) {
|
||||
self.simple_action.connect_activate(move |_, this| {
|
||||
let (request, is_history) = this
|
||||
.expect("Expected (`request`,`is_history`) variant")
|
||||
.get::<(String, bool)>()
|
||||
.expect("Parameter type does not match (`String`,`bool`) tuple");
|
||||
|
||||
callback(
|
||||
match request.is_empty() {
|
||||
true => None,
|
||||
false => Some(request.into()),
|
||||
},
|
||||
is_history,
|
||||
)
|
||||
let request = this
|
||||
.expect("Expected `request` variant")
|
||||
.get::<String>()
|
||||
.expect("Parameter type does not match `String`");
|
||||
callback(match request.is_empty() {
|
||||
true => None,
|
||||
false => Some(request.into()),
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue