aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui')
-rw-r--r--main/src/ui/add_conversation/conference_details_fragment.vala9
-rw-r--r--main/src/ui/manage_accounts/dialog.vala4
-rw-r--r--main/src/ui/util/data_forms.vala14
-rw-r--r--main/src/ui/util/label_hybrid.vala17
4 files changed, 15 insertions, 29 deletions
diff --git a/main/src/ui/add_conversation/conference_details_fragment.vala b/main/src/ui/add_conversation/conference_details_fragment.vala
index 83d5b507..11374032 100644
--- a/main/src/ui/add_conversation/conference_details_fragment.vala
+++ b/main/src/ui/add_conversation/conference_details_fragment.vala
@@ -110,13 +110,8 @@ protected class ConferenceDetailsFragment : Box {
// nick_entry.key_release_event.connect(on_nick_key_release_event);
// password_entry.key_release_event.connect(on_password_key_release_event);
- var jid_entry_controller = new EventControllerKey();
- 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);
+ jid_entry.changed.connect(() => { check_if_done(); });
+ nick_entry.changed.connect(() => { check_if_done(); });
check_if_done();
diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala
index efeff046..0a37b052 100644
--- a/main/src/ui/manage_accounts/dialog.vala
+++ b/main/src/ui/manage_accounts/dialog.vala
@@ -42,8 +42,8 @@ public class Dialog : Gtk.Dialog {
if (selected_account != null) remove_account(account_row);
});
image_button.clicked.connect(show_select_avatar);
-// alias_hybrid.entry.key_release_event.connect(() => { selected_account.alias = alias_hybrid.text; return false; });
-// password_hybrid.entry.key_release_event.connect(() => { selected_account.password = password_hybrid.text; return false; });
+ alias_hybrid.entry.changed.connect(() => { selected_account.alias = alias_hybrid.text; });
+ password_hybrid.entry.changed.connect(() => { selected_account.password = password_hybrid.text; });
Util.LabelHybridGroup label_hybrid_group = new Util.LabelHybridGroup();
label_hybrid_group.add(alias_hybrid);
diff --git a/main/src/ui/util/data_forms.vala b/main/src/ui/util/data_forms.vala
index af8789a7..1f598025 100644
--- a/main/src/ui/util/data_forms.vala
+++ b/main/src/ui/util/data_forms.vala
@@ -35,21 +35,13 @@ public static Widget? get_data_form_field_widget(DataForms.DataForm.Field field)
return null;
case DataForms.DataForm.Type.TEXT_PRIVATE:
DataForms.DataForm.TextPrivateField text_private_field = field as DataForms.DataForm.TextPrivateField;
- Entry entry = new Entry() { text=text_private_field.value ?? "", valign=Align.CENTER, visibility=false };
- var entry_key_events = new EventControllerKey();
- entry_key_events.key_released.connect(() => {
- text_private_field.value = entry.text;
- });
- entry.add_controller(entry_key_events);
+ PasswordEntry entry = new PasswordEntry() { text=text_private_field.value ?? "", valign=Align.CENTER };
+ entry.changed.connect(() => { text_private_field.value = entry.text; });
return entry;
case DataForms.DataForm.Type.TEXT_SINGLE:
DataForms.DataForm.TextSingleField text_single_field = field as DataForms.DataForm.TextSingleField;
Entry entry = new Entry() { text=text_single_field.value ?? "", valign=Align.CENTER };
- var entry_key_events = new EventControllerKey();
- entry_key_events.key_released.connect(() => {
- text_single_field.value = entry.text;
- });
- entry.add_controller(entry_key_events);
+ entry.changed.connect(() => { text_single_field.value = entry.text; });
return entry;
default:
return null;
diff --git a/main/src/ui/util/label_hybrid.vala b/main/src/ui/util/label_hybrid.vala
index 53f0fbca..f426de7e 100644
--- a/main/src/ui/util/label_hybrid.vala
+++ b/main/src/ui/util/label_hybrid.vala
@@ -40,8 +40,8 @@ public class EntryLabelHybrid : LabelHybrid {
public string text {
get { return entry.text; }
set {
- entry.text = value;
- set_label_label(value);
+ entry.text = value.dup();
+ update_label();
}
}
@@ -79,22 +79,21 @@ public class EntryLabelHybrid : LabelHybrid {
if (e == null) return;
entry = e;
base.init(entry);
- set_label_label(entry.text);
+ update_label();
var key_events = new EventControllerKey();
key_events.key_released.connect(on_key_released);
entry.add_controller(key_events);
+ entry.changed.connect(update_label);
var focus_events = new EventControllerFocus();
- focus_events.leave.connect(on_focus_leave);
+ focus_events.leave.connect(update_label);
entry.add_controller(focus_events);
}
private void on_key_released(uint keyval) {
if (keyval == Gdk.Key.Return) {
show_label();
- } else {
- set_label_label(entry.text);
}
}
@@ -102,12 +101,12 @@ public class EntryLabelHybrid : LabelHybrid {
show_label();
}
- private void set_label_label(string value) {
+ private void update_label() {
if (visibility) {
- label.label = value;
+ label.label = entry.text;
} else {
string filler = "";
- for (int i = 0; i < value.length; i++) filler += entry.get_invisible_char().to_string();
+ for (int i = 0; i < entry.text.length; i++) filler += entry.get_invisible_char().to_string();
label.label = filler;
}
}