Use dropdown box rather than radio buttons in account creation dialog: Closes #5718
This commit is contained in:
parent
b6c50c2aae
commit
aa238701c4
2 changed files with 162 additions and 195 deletions
|
|
@ -6,6 +6,13 @@
|
|||
|
||||
// Displays a dialog for collecting the user's login data.
|
||||
public class LoginDialog {
|
||||
// these are tied to the values in the Glade file
|
||||
private enum Encryption {
|
||||
NONE = 0,
|
||||
SSL = 1,
|
||||
STARTTLS = 2
|
||||
}
|
||||
|
||||
private Gtk.Dialog dialog;
|
||||
private Gtk.Entry entry_email;
|
||||
private Gtk.Label label_password;
|
||||
|
|
@ -22,9 +29,7 @@ public class LoginDialog {
|
|||
private Gtk.Entry entry_imap_username;
|
||||
private Gtk.Entry entry_imap_password;
|
||||
private Gtk.CheckButton check_imap_remember_password;
|
||||
private Gtk.RadioButton radio_imap_none;
|
||||
private Gtk.RadioButton radio_imap_ssl;
|
||||
private Gtk.RadioButton radio_imap_starttls;
|
||||
private Gtk.ComboBox combo_imap_encryption;
|
||||
|
||||
// SMTP info widgets
|
||||
private Gtk.Entry entry_smtp_host;
|
||||
|
|
@ -32,9 +37,7 @@ public class LoginDialog {
|
|||
private Gtk.Entry entry_smtp_username;
|
||||
private Gtk.Entry entry_smtp_password;
|
||||
private Gtk.CheckButton check_smtp_remember_password;
|
||||
private Gtk.RadioButton radio_smtp_none;
|
||||
private Gtk.RadioButton radio_smtp_ssl;
|
||||
private Gtk.RadioButton radio_smtp_starttls;
|
||||
private Gtk.ComboBox combo_smtp_encryption;
|
||||
|
||||
private Gtk.Button ok_button;
|
||||
|
||||
|
|
@ -104,9 +107,7 @@ public class LoginDialog {
|
|||
entry_imap_username = builder.get_object("entry: imap username") as Gtk.Entry;
|
||||
entry_imap_password = builder.get_object("entry: imap password") as Gtk.Entry;
|
||||
check_imap_remember_password = builder.get_object("check: imap remember_password") as Gtk.CheckButton;
|
||||
radio_imap_none = builder.get_object("radio: imap none") as Gtk.RadioButton;
|
||||
radio_imap_ssl = builder.get_object("radio: imap ssl") as Gtk.RadioButton;
|
||||
radio_imap_starttls = builder.get_object("radio: imap starttls") as Gtk.RadioButton;
|
||||
combo_imap_encryption = builder.get_object("combo: imap encryption") as Gtk.ComboBox;
|
||||
|
||||
// SMTP info widgets.
|
||||
entry_smtp_host = builder.get_object("entry: smtp host") as Gtk.Entry;
|
||||
|
|
@ -114,9 +115,7 @@ public class LoginDialog {
|
|||
entry_smtp_username = builder.get_object("entry: smtp username") as Gtk.Entry;
|
||||
entry_smtp_password = builder.get_object("entry: smtp password") as Gtk.Entry;
|
||||
check_smtp_remember_password = builder.get_object("check: smtp remember_password") as Gtk.CheckButton;
|
||||
radio_smtp_none = builder.get_object("radio: smtp none") as Gtk.RadioButton;
|
||||
radio_smtp_ssl = builder.get_object("radio: smtp ssl") as Gtk.RadioButton;
|
||||
radio_smtp_starttls = builder.get_object("radio: smtp starttls") as Gtk.RadioButton;
|
||||
combo_smtp_encryption = builder.get_object("combo: smtp encryption") as Gtk.ComboBox;
|
||||
|
||||
combo_service.changed.connect(on_service_changed);
|
||||
|
||||
|
|
@ -143,9 +142,12 @@ public class LoginDialog {
|
|||
entry_imap_username.set_text(initial_imap_username ?? "");
|
||||
entry_imap_password.set_text(initial_imap_password ?? "");
|
||||
check_imap_remember_password.active = initial_imap_remember_password;
|
||||
radio_imap_none.active = true;
|
||||
radio_imap_ssl.active = initial_default_imap_ssl;
|
||||
radio_imap_starttls.active = initial_default_imap_starttls;
|
||||
if (initial_default_imap_ssl)
|
||||
combo_imap_encryption.active = Encryption.SSL;
|
||||
else if (initial_default_imap_starttls)
|
||||
combo_imap_encryption.active = Encryption.STARTTLS;
|
||||
else
|
||||
combo_imap_encryption.active = Encryption.NONE;
|
||||
|
||||
// Set defaults for SMTP info
|
||||
entry_smtp_host.set_text(initial_default_smtp_host ?? "");
|
||||
|
|
@ -153,9 +155,12 @@ public class LoginDialog {
|
|||
entry_smtp_username.set_text(initial_smtp_username ?? "");
|
||||
entry_smtp_password.set_text(initial_smtp_password ?? "");
|
||||
check_smtp_remember_password.active = initial_smtp_remember_password;
|
||||
radio_smtp_none.active = true;
|
||||
radio_smtp_ssl.active = initial_default_smtp_ssl;
|
||||
radio_smtp_starttls.active = initial_default_smtp_starttls;
|
||||
if (initial_default_smtp_ssl)
|
||||
combo_smtp_encryption.active = Encryption.SSL;
|
||||
else if (initial_default_smtp_starttls)
|
||||
combo_smtp_encryption.active = Encryption.STARTTLS;
|
||||
else
|
||||
combo_smtp_encryption.active = Encryption.NONE;
|
||||
|
||||
if (Geary.String.is_empty(entry_real_name.text))
|
||||
entry_real_name.grab_focus();
|
||||
|
|
@ -180,13 +185,8 @@ public class LoginDialog {
|
|||
entry_password.changed.connect(on_password_changed);
|
||||
check_remember_password.toggled.connect(on_remember_password_toggled);
|
||||
|
||||
radio_imap_none.toggled.connect(on_radio_imap_toggled);
|
||||
radio_imap_ssl.toggled.connect(on_radio_imap_toggled);
|
||||
radio_imap_starttls.toggled.connect(on_radio_imap_toggled);
|
||||
|
||||
radio_smtp_none.toggled.connect(on_radio_smtp_toggled);
|
||||
radio_smtp_ssl.toggled.connect(on_radio_smtp_toggled);
|
||||
radio_smtp_starttls.toggled.connect(on_radio_smtp_toggled);
|
||||
combo_imap_encryption.changed.connect(on_imap_encryption_changed);
|
||||
combo_smtp_encryption.changed.connect(on_smtp_encryption_changed);
|
||||
|
||||
entry_imap_port.insert_text.connect(on_port_insert_text);
|
||||
entry_smtp_port.insert_text.connect(on_port_insert_text);
|
||||
|
|
@ -240,12 +240,12 @@ public class LoginDialog {
|
|||
account_information.service_provider = get_service_provider();
|
||||
account_information.default_imap_server_host = entry_imap_host.text.strip();
|
||||
account_information.default_imap_server_port = (uint16) int.parse(entry_imap_port.text.strip());
|
||||
account_information.default_imap_server_ssl = radio_imap_ssl.active;
|
||||
account_information.default_imap_server_starttls = radio_imap_starttls.active;
|
||||
account_information.default_imap_server_ssl = (combo_imap_encryption.active == Encryption.SSL);
|
||||
account_information.default_imap_server_starttls = (combo_imap_encryption.active == Encryption.STARTTLS);
|
||||
account_information.default_smtp_server_host = entry_smtp_host.text.strip();
|
||||
account_information.default_smtp_server_port = (uint16) int.parse(entry_smtp_port.text.strip());
|
||||
account_information.default_smtp_server_ssl = radio_smtp_ssl.active;
|
||||
account_information.default_smtp_server_starttls = radio_smtp_starttls.active;
|
||||
account_information.default_smtp_server_ssl = (combo_smtp_encryption.active == Encryption.SSL);
|
||||
account_information.default_smtp_server_starttls = (combo_smtp_encryption.active == Encryption.STARTTLS);
|
||||
|
||||
on_changed();
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ public class LoginDialog {
|
|||
}
|
||||
}
|
||||
|
||||
private void on_radio_imap_toggled() {
|
||||
private void on_imap_encryption_changed() {
|
||||
if (edited_imap_port)
|
||||
return;
|
||||
|
||||
|
|
@ -311,15 +311,18 @@ public class LoginDialog {
|
|||
}
|
||||
|
||||
private uint16 get_default_imap_port() {
|
||||
if (radio_imap_ssl.active)
|
||||
return Geary.Imap.ClientConnection.DEFAULT_PORT_SSL;
|
||||
if (radio_imap_starttls.active)
|
||||
return Geary.Imap.ClientConnection.DEFAULT_PORT;
|
||||
|
||||
return Geary.Imap.ClientConnection.DEFAULT_PORT;
|
||||
switch (combo_imap_encryption.active) {
|
||||
case Encryption.SSL:
|
||||
return Geary.Imap.ClientConnection.DEFAULT_PORT_SSL;
|
||||
|
||||
case Encryption.NONE:
|
||||
case Encryption.STARTTLS:
|
||||
default:
|
||||
return Geary.Imap.ClientConnection.DEFAULT_PORT;
|
||||
}
|
||||
}
|
||||
|
||||
private void on_radio_smtp_toggled() {
|
||||
private void on_smtp_encryption_changed() {
|
||||
if (edited_smtp_port)
|
||||
return;
|
||||
|
||||
|
|
@ -328,12 +331,17 @@ public class LoginDialog {
|
|||
}
|
||||
|
||||
private uint16 get_default_smtp_port() {
|
||||
if (radio_smtp_ssl.active)
|
||||
return Geary.Smtp.ClientConnection.DEFAULT_PORT_SSL;
|
||||
if (radio_smtp_starttls.active)
|
||||
return Geary.Smtp.ClientConnection.DEFAULT_PORT_STARTTLS;
|
||||
|
||||
return Geary.Smtp.ClientConnection.DEFAULT_PORT;
|
||||
switch (combo_smtp_encryption.active) {
|
||||
case Encryption.SSL:
|
||||
return Geary.Smtp.ClientConnection.DEFAULT_PORT_SSL;
|
||||
|
||||
case Encryption.STARTTLS:
|
||||
return Geary.Smtp.ClientConnection.DEFAULT_PORT_STARTTLS;
|
||||
|
||||
case Encryption.NONE:
|
||||
default:
|
||||
return Geary.Smtp.ClientConnection.DEFAULT_PORT;
|
||||
}
|
||||
}
|
||||
|
||||
private Geary.ServiceProvider get_service_provider() {
|
||||
|
|
|
|||
263
ui/login.glade
263
ui/login.glade
|
|
@ -339,129 +339,6 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radio: imap none">
|
||||
<property name="label" translatable="yes">_No encryption</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="margin_top">2</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radio: imap starttls">
|
||||
<property name="label" translatable="yes">STARTTLS a_uthentication</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radio: imap none</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radio: imap ssl">
|
||||
<property name="label" translatable="yes">SS_L/TLS encryption</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radio: imap none</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radio: smtp starttls">
|
||||
<property name="label" translatable="yes">STARTTLS aut_hentication</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.50999999046325684</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radio: smtp none</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">15</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radio: smtp ssl">
|
||||
<property name="label" translatable="yes">SSL/TLS encr_yption</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radio: smtp none</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">14</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radio: smtp none">
|
||||
<property name="label" translatable="yes">No encrypt_ion</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="margin_top">2</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">13</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label: smtp host">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -665,33 +542,6 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label: imap encryption">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -699,7 +549,10 @@
|
|||
<property name="margin_top">2</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="xpad">12</property>
|
||||
<property name="label" translatable="yes">Encryption:</property>
|
||||
<property name="label" translatable="yes">Encr_yption:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">combo: imap encryption</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
|
|
@ -715,7 +568,10 @@
|
|||
<property name="margin_top">2</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="xpad">12</property>
|
||||
<property name="label" translatable="yes">Encryption:</property>
|
||||
<property name="label" translatable="yes">Encrypt_ion:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">fill</property>
|
||||
<property name="mnemonic_widget">combo: smtp encryption</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
|
|
@ -724,6 +580,109 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="combo: imap encryption">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="active">1</property>
|
||||
<property name="entry_text_column">0</property>
|
||||
<property name="id_column">1</property>
|
||||
<items>
|
||||
<item translatable="yes">No encryption</item>
|
||||
<item translatable="yes">SSL/TLS encryption</item>
|
||||
<item translatable="yes">STARTTLS authentication</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="combo: smtp encryption">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="active">1</property>
|
||||
<property name="entry_text_column">0</property>
|
||||
<property name="id_column">1</property>
|
||||
<items>
|
||||
<item translatable="yes">No encryption</item>
|
||||
<item translatable="yes">SSL/TLS encryption</item>
|
||||
<item translatable="yes">STARTTLS encryption</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">13</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue