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.
This commit is contained in:
parent
4691dc4e25
commit
9764d44bb1
1 changed files with 8 additions and 1 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue