summaryrefslogtreecommitdiff
path: root/src/dialogs
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-12-17 19:58:25 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-12-17 19:58:25 +0100
commit4cb46f4de4b881e5b1f65af017dca6f3917e55e5 (patch)
treefb359e210d2d9c30f5ad36a447ea29b62ae9bb56 /src/dialogs
parent841f952294b349b2b8e2afb5305ce34a3b59bb4b (diff)
parentf5a0cee8ccecc7b6c6c2d8e9fb6f6eecd53531fe (diff)
Update upstream source from tag 'upstream/0.32.4'
Update to upstream version '0.32.4' with Debian dir 51798a6af1c9b7e48f979c020d72f3c5ddd964a6
Diffstat (limited to 'src/dialogs')
-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) {