summaryrefslogtreecommitdiff
path: root/src/dialogs/MultiTextEntryDialog.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-05-01 14:34:32 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-05-01 14:34:32 +0200
commit49120f48474fc8fdc2448c75d961bc238213cfac (patch)
tree05bcdb95d65a807cf0f1ffffd066c09074b5cf56 /src/dialogs/MultiTextEntryDialog.vala
parent2492891f112caac6076ce49721d9d5d78a152c3a (diff)
New upstream version 0.28.2upstream/0.28.2
Diffstat (limited to 'src/dialogs/MultiTextEntryDialog.vala')
-rw-r--r--src/dialogs/MultiTextEntryDialog.vala43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/dialogs/MultiTextEntryDialog.vala b/src/dialogs/MultiTextEntryDialog.vala
new file mode 100644
index 0000000..42e5318
--- /dev/null
+++ b/src/dialogs/MultiTextEntryDialog.vala
@@ -0,0 +1,43 @@
+/* Copyright 2016 Software Freedom Conservancy Inc.
+ * Copyright 2017 Jens Georg <mail@jensge.org>
+ *
+ * This software is licensed under the GNU LGPL (version 2.1 or later).
+ * See the COPYING file in this distribution.
+ */
+
+[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 Gtk.TextView entry;
+
+ public MultiTextEntryDialog() {
+ Object (use_header_bar: Resources.use_header_bar());
+ }
+
+ public void setup(OnModifyValidateType? modify_validate, string title, string label, string? initial_text) {
+ set_title(title);
+ set_parent_window(AppWindow.get_instance().get_parent_window());
+ set_transient_for(AppWindow.get_instance());
+ on_modify_validate = modify_validate;
+
+ entry.buffer.text = (initial_text != null ? initial_text : "");
+
+ entry.grab_focus();
+ }
+
+ public string? execute() {
+ string? text = null;
+
+ show_all();
+
+ if (run() == Gtk.ResponseType.OK)
+ text = entry.buffer.text;
+
+ destroy();
+
+ return text;
+ }
+}