[geary/wip/714104-refine-account-dialog: 68/69] Add an activated signal to Validator component



commit 9764d44bb1e6a34df8e9e2f4391688dea5a4b8c0
Author: Michael Gratton <mike vee net>
Date:   Fri Nov 30 23:42:26 2018 +1100

    Add an activated signal to Validator component
    
    This will fire when the user has activated the entry and validation
    has completed, allowing use sites to hook up one place when waiting for
    asyc validation (e.g. host name validation) to occur.

 src/client/components/components-validator.vala | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/client/components/components-validator.vala b/src/client/components/components-validator.vala
index ee500a59..9cc6d7a3 100644
--- a/src/client/components/components-validator.vala
+++ b/src/client/components/components-validator.vala
@@ -105,6 +105,9 @@ public class Components.Validator : GLib.Object {
     /** Fired when the validation state changes. */
     public signal void state_changed(Trigger reason, Validity prev_state);
 
+    /** Fired when target entry is activated and validation completes. */
+    public signal void activated();
+
 
     public Validator(Gtk.Entry target) {
         this.target = target;
@@ -204,6 +207,10 @@ public class Components.Validator : GLib.Object {
                 this.ui_update_timer.start();
             }
         }
+
+        if (reason == Trigger.ACTIVATED && new_state != Validity.IN_PROGRESS) {
+            activated();
+        }
     }
 
     private void validate_entry(Trigger reason) {
@@ -340,7 +347,7 @@ public class Components.NetworkAddressValidator : Validator {
     private GLib.Cancellable? cancellable = null;
 
 
-    public NetworkAddressValidator(Gtk.Entry target, uint16 default_port) {
+    public NetworkAddressValidator(Gtk.Entry target, uint16 default_port = 0) {
         base(target);
         this.default_port = default_port;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]