Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions src/Dialogs/NewUserDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public class SwitchboardPlugUserAccounts.NewUserDialog : Granite.Dialog {

construct {
var accounttype_combobox = new Gtk.ComboBoxText ();
accounttype_combobox.append_text (_("Standard User"));
accounttype_combobox.append_text (_("Administrator"));
accounttype_combobox.append_text (_("Adult (Standard)"));
accounttype_combobox.append_text (_("Adult (Administrator)"));
accounttype_combobox.append_text (_("Child"));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we indicate below what age someone is a child? Does this depend on locale?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we're probably going to need a lot more explainer text in the end

accounttype_combobox.set_active (0);

var accounttype_label = new Granite.HeaderLabel (_("Account Type")) {
Expand All @@ -32,6 +33,24 @@ public class SwitchboardPlugUserAccounts.NewUserDialog : Granite.Dialog {
mnemonic_widget = realname_entry
};

var dob_datepicker = new Granite.DatePicker () {
// elementary Icons birthday
date = new DateTime.from_unix_utc (1190401200)
};

var dob_header = new Granite.HeaderLabel (_("Date of Birth")) {
secondary_text = _("Age and birthday are never shared. Age range is shared with apps to provide appropriate experiences."),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets a little tricky to say that "age and birthday are never shared" if the user uses an application the day their age bracket changes. This can be solved by using a small randomized offset that reduces the age value when exposing it to applications. But if this exists, explaining the age range has such offset and that the precise range is not shared is also helpful.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be better to wait to hash out the details of explainer text until the portal is more finalized. Please keep in mind this is only a draft and it is not marked ready for review

margin_top = 12
};

var dob_box = new Granite.Box (VERTICAL, HALF);
dob_box.append (dob_header);
dob_box.append (dob_datepicker);

var dob_revealer = new Gtk.Revealer () {
child = dob_box
};

username_entry = new Granite.ValidatedEntry ();

var username_label = new Granite.HeaderLabel (_("Username")) {
Expand All @@ -52,6 +71,7 @@ public class SwitchboardPlugUserAccounts.NewUserDialog : Granite.Dialog {
form_box.append (new ErrorRevealer ("."));
form_box.append (realname_label);
form_box.append (realname_entry);
form_box.append (dob_revealer);
form_box.append (new ErrorRevealer ("."));
form_box.append (username_label);
form_box.append (username_entry);
Expand Down Expand Up @@ -83,6 +103,10 @@ public class SwitchboardPlugUserAccounts.NewUserDialog : Granite.Dialog {
update_create_button ();
});

accounttype_combobox.changed.connect (() => {
dob_revealer.reveal_child = accounttype_combobox.active == 2;
});

response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.OK) {
string fullname = realname_entry.text;
Expand Down