misc: Be consistent for setting the key binding to close dialogs

This commit is contained in:
Kévin Commaille 2023-11-26 14:46:59 +01:00
parent 654ef1b4e6
commit a4bd482e8c
No known key found for this signature in database
GPG Key ID: 29A48C1F03620416
6 changed files with 15 additions and 27 deletions

View File

@ -24,10 +24,10 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);
klass.add_binding_signal(
klass.add_binding_action(
gdk::Key::Escape,
gdk::ModifierType::empty(),
"close-request",
"window.close",
None,
);
}

View File

@ -30,6 +30,13 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);
klass.add_binding_action(
gdk::Key::Escape,
gdk::ModifierType::empty(),
"window.close",
None,
);
klass.install_action("attachment-dialog.send", None, move |window, _, _| {
window.imp().send.set(true);
window.emit_by_name::<()>("send", &[]);

View File

@ -35,15 +35,5 @@
</property>
</object>
</property>
<child>
<object class="GtkShortcutController">
<child>
<object class="GtkShortcut">
<property name="trigger">Escape</property>
<property name="action">action(window.close)</property>
</object>
</child>
</object>
</child>
</template>
</interface>

View File

@ -42,13 +42,10 @@ mod imp {
Self::bind_template(klass);
Self::Type::bind_template_callbacks(klass);
klass.add_binding(
klass.add_binding_action(
gdk::Key::Escape,
gdk::ModifierType::empty(),
|obj, _| {
obj.close();
true
},
"window.close",
None,
);
}

View File

@ -31,13 +31,10 @@ mod imp {
Self::bind_template(klass);
Self::Type::bind_template_callbacks(klass);
klass.add_binding(
klass.add_binding_action(
gdk::Key::Escape,
gdk::ModifierType::empty(),
|obj, _| {
obj.close();
true
},
"window.close",
None,
);
}

View File

@ -65,13 +65,10 @@ mod imp {
Self::bind_template(klass);
Self::Type::bind_template_callbacks(klass);
klass.add_binding(
klass.add_binding_action(
gdk::Key::Escape,
gdk::ModifierType::empty(),
|obj, _| {
obj.close();
true
},
"window.close",
None,
);
}