summaryrefslogtreecommitdiff
path: root/src/dialogs/MultiTextEntryDialog.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-12-29 18:43:43 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-12-29 18:43:43 +0100
commit14bc7db2e07c5d1ccfb4d723c9dba395e6c93171 (patch)
tree7b00861348dedd18d3651537128bbe783dab364c /src/dialogs/MultiTextEntryDialog.vala
parent1bf62485f701b52ae27433e3570ac24cd7da886f (diff)
parent67d142325abb0d9345baef77f00a047a7dc1eca3 (diff)
Merge branch 'release/debian/0.32.4-1'debian/0.32.4-1
Diffstat (limited to 'src/dialogs/MultiTextEntryDialog.vala')
-rw-r--r--src/dialogs/MultiTextEntryDialog.vala22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/dialogs/MultiTextEntryDialog.vala b/src/dialogs/MultiTextEntryDialog.vala
index ddbd59b..097dabf 100644
--- a/src/dialogs/MultiTextEntryDialog.vala
+++ b/src/dialogs/MultiTextEntryDialog.vala
@@ -5,16 +5,36 @@
* See the COPYING file in this distribution.
*/
+ class DismissableTextView : Gtk.TextView {
+ public signal void edit_done();
+
+ public override bool key_press_event(Gdk.EventKey ev) {
+ if (!(Gdk.ModifierType.CONTROL_MASK in ev.state)) {
+ return base.key_press_event(ev);
+ }
+
+ if (Gdk.keyval_name(ev.keyval) == "KP_Enter" ||
+ Gdk.keyval_name(ev.keyval) == "Return") {
+ edit_done();
+ return true;
+ }
+
+ return base.key_press_event(ev);
+ }
+ }
+
[GtkTemplate (ui = "/org/gnome/Shotwell/ui/multitextentrydialog.ui")]
public class MultiTextEntryDialog : Gtk.Dialog {
public delegate bool OnModifyValidateType(string text);
private unowned OnModifyValidateType on_modify_validate;
[GtkChild]
- private unowned Gtk.TextView entry;
+ private unowned DismissableTextView entry;
public MultiTextEntryDialog() {
Object (use_header_bar: Resources.use_header_bar());
+
+ entry.edit_done.connect(() => {response(Gtk.ResponseType.OK);});
}
public void setup(OnModifyValidateType? modify_validate, string title, string label, string? initial_text) {