Commit 02880e1d authored by Eric Gregory's avatar Eric Gregory

Closes #6288 Focus issues in account add/edit/welcome screens

parent c1903621
...@@ -166,6 +166,8 @@ public class AddEditPage : Gtk.Box { ...@@ -166,6 +166,8 @@ public class AddEditPage : Gtk.Box {
private Geary.Engine.ValidationResult last_validation_result = Geary.Engine.ValidationResult.OK; private Geary.Engine.ValidationResult last_validation_result = Geary.Engine.ValidationResult.OK;
private bool first_ui_update = true;
public signal void info_changed(); public signal void info_changed();
public signal void size_changed(); public signal void size_changed();
...@@ -259,8 +261,8 @@ public class AddEditPage : Gtk.Box { ...@@ -259,8 +261,8 @@ public class AddEditPage : Gtk.Box {
entry_nickname.insert_text.connect(on_nickname_insert_text); entry_nickname.insert_text.connect(on_nickname_insert_text);
// Shows/hides settings. // Reset the "first update" flag when the window is mapped.
update_ui(); map.connect(() => { first_ui_update = true; });
} }
// Sets the account information to display on this page. // Sets the account information to display on this page.
...@@ -340,11 +342,6 @@ public class AddEditPage : Gtk.Box { ...@@ -340,11 +342,6 @@ public class AddEditPage : Gtk.Box {
set_validation_result(result); set_validation_result(result);
set_storage_length(prefetch_period_days); set_storage_length(prefetch_period_days);
if (Geary.String.is_empty(real_name))
entry_real_name.grab_focus();
else
entry_email.grab_focus();
} }
public void set_validation_result(Geary.Engine.ValidationResult result) { public void set_validation_result(Geary.Engine.ValidationResult result) {
...@@ -641,6 +638,27 @@ public class AddEditPage : Gtk.Box { ...@@ -641,6 +638,27 @@ public class AddEditPage : Gtk.Box {
} }
size_changed(); size_changed();
// Set initial field focus.
// This has to be done here because the window isn't completely setup until the first time
// this method runs.
if (first_ui_update && parent.get_visible()) {
if (mode == PageMode.EDIT) {
if (get_service_provider() != Geary.ServiceProvider.OTHER)
entry_password.grab_focus();
else
entry_imap_password.grab_focus();
} else {
if (Geary.String.is_empty(real_name))
entry_real_name.grab_focus();
else if (mode == PageMode.ADD)
entry_nickname.grab_focus();
else
entry_email.grab_focus();
}
first_ui_update = false;
}
} }
public Geary.ServiceProvider get_service_provider() { public Geary.ServiceProvider get_service_provider() {
......
...@@ -64,5 +64,10 @@ public class LoginDialog : Gtk.Dialog { ...@@ -64,5 +64,10 @@ public class LoginDialog : Gtk.Dialog {
cancel_button.sensitive = !visible; cancel_button.sensitive = !visible;
on_info_changed(); // sets OK button sensitivity on_info_changed(); // sets OK button sensitivity
} }
public override void show() {
page.update_ui();
base.show();
}
} }
...@@ -188,6 +188,7 @@ ...@@ -188,6 +188,7 @@
<object class="GtkEntry" id="entry: real_name"> <object class="GtkEntry" id="entry: real_name">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="invisible_char"></property> <property name="invisible_char"></property>
<property name="activates_default">True</property> <property name="activates_default">True</property>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment