Fix channel join button not getting sensitive

This commit is contained in:
fiaxh 2022-10-03 19:14:45 +02:00
parent 146af31524
commit 21ab48e09a

View file

@ -12,17 +12,7 @@ protected class ConferenceDetailsFragment : Box {
public signal void joined(); public signal void joined();
public bool done { public bool done { get; private set; }
get {
try {
Jid parsed_jid = new Jid(jid);
return parsed_jid.localpart != null && parsed_jid.resourcepart == null && nick != null;
} catch (InvalidJidError e) {
return false;
}
}
private set {}
}
public Account account { public Account account {
owned get { return account_combobox.selected; } owned get { return account_combobox.selected; }
@ -118,8 +108,14 @@ protected class ConferenceDetailsFragment : Box {
// nick_entry.key_release_event.connect(on_nick_key_release_event); // nick_entry.key_release_event.connect(on_nick_key_release_event);
// password_entry.key_release_event.connect(on_password_key_release_event); // password_entry.key_release_event.connect(on_password_key_release_event);
// jid_entry.key_release_event.connect(() => { done = true; return false; }); // just for notifying var jid_entry_controller = new EventControllerKey();
// nick_entry.key_release_event.connect(() => { done = true; return false; }); jid_entry_controller.key_released.connect(() => { check_if_done(); });
jid_entry.add_controller(jid_entry_controller);
var nick_entry_controller = new EventControllerKey();
nick_entry_controller.key_released.connect(() => { check_if_done(); });
nick_entry.add_controller(nick_entry_controller);
notification_button.clicked.connect(() => { notification_revealer.set_reveal_child(false); }); notification_button.clicked.connect(() => { notification_revealer.set_reveal_child(false); });
@ -195,6 +191,15 @@ protected class ConferenceDetailsFragment : Box {
notification_revealer.set_reveal_child(true); notification_revealer.set_reveal_child(true);
} }
private void check_if_done() {
try {
Jid parsed_jid = new Jid(jid);
done = parsed_jid.localpart != null && parsed_jid.resourcepart == null && nick != null;
} catch (InvalidJidError e) {
done = false;
}
}
// private bool on_jid_key_release_event(EventKey event) { // private bool on_jid_key_release_event(EventKey event) {
// jid_label.label = jid_entry.text; // jid_label.label = jid_entry.text;
// if (event.keyval == Key.Return) jid_stack.set_visible_child_name("label"); // if (event.keyval == Key.Return) jid_stack.set_visible_child_name("label");