aboutsummaryrefslogtreecommitdiffstats
path: root/capplet/settings/mail-account-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'capplet/settings/mail-account-view.c')
-rw-r--r--capplet/settings/mail-account-view.c89
1 files changed, 65 insertions, 24 deletions
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c
index e97abdc6dc..413f755d66 100644
--- a/capplet/settings/mail-account-view.c
+++ b/capplet/settings/mail-account-view.c
@@ -30,6 +30,7 @@
#include "mail-view.h"
#include "e-util/e-config.h"
#include "mail/mail-config.h"
+#include "mail/mail-session.h"
#include "mail-guess-servers.h"
struct _MailAccountViewPrivate {
@@ -47,6 +48,7 @@ enum {
ERROR_NO_FULLNAME = 1,
ERROR_NO_EMAIL = 2,
ERROR_INVALID_EMAIL = 3,
+ ERROR_NO_PASSWORD = 4,
};
struct _dialog_errors {
@@ -56,6 +58,7 @@ struct _dialog_errors {
{ ERROR_NO_FULLNAME, N_("Please enter your full name.") },
{ ERROR_NO_EMAIL, N_("Please enter your email address.") },
{ ERROR_INVALID_EMAIL, N_("The email address you have entered is invalid.") },
+ { ERROR_NO_PASSWORD, N_("Please enter your password.") }
};
static guint signals[LAST_SIGNAL] = { 0 };
@@ -136,11 +139,15 @@ validate_identity (MailAccountView *view)
gchar *user = (gchar *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_NAME);
gchar *email = (gchar *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_ADDRESS);
gchar *tmp;
+ const gchar *pwd = gtk_entry_get_text ((GtkEntry *)view->password);
if (!user || !*user)
return ERROR_NO_FULLNAME;
if (!email || !*email)
return ERROR_NO_EMAIL;
+ if (!pwd || !*pwd)
+ return ERROR_NO_PASSWORD;
+
tmp = strchr(email, '@');
if (!tmp || tmp[1] == 0)
return ERROR_INVALID_EMAIL;
@@ -202,11 +209,17 @@ create_review (MailAccountView *view)
gtk_table_attach ((GtkTable *)table, box, 1, 2, 2, 3, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
label = gtk_label_new (NULL);
- gtk_label_set_markup ((GtkLabel *)label, _("<span size=\"large\" weight=\"bold\">Receiving details:</span>"));
+ gtk_label_set_markup ((GtkLabel *)label, _("<span size=\"large\" weight=\"bold\">Details:</span>"));
gtk_widget_show (label);
PACK_BOXF(label);
gtk_table_attach ((GtkTable *)table, box, 0, 1, 3, 4, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ label = gtk_label_new (NULL);
+ gtk_label_set_markup ((GtkLabel *)label, _("<span size=\"large\" weight=\"bold\">Receiving</span>"));
+ gtk_widget_show (label);
+ PACK_BOXF(label);
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 3, 4, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
label = gtk_label_new (_("Server type:"));
gtk_widget_show (label);
PACK_BOX(label);
@@ -250,47 +263,31 @@ create_review (MailAccountView *view)
return NULL;
label = gtk_label_new (NULL);
- gtk_label_set_markup ((GtkLabel *)label, _("<span size=\"large\" weight=\"bold\">Sending details:</span>"));
+ gtk_label_set_markup ((GtkLabel *)label, _("<span size=\"large\" weight=\"bold\">Sending</span>"));
gtk_widget_show (label);
PACK_BOXF(label);
- gtk_table_attach ((GtkTable *)table, box, 0, 1, 8, 9, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ gtk_table_attach ((GtkTable *)table, box, 2, 3, 3, 4, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
- label = gtk_label_new (_("Server type:"));
- gtk_widget_show (label);
- PACK_BOX(label);
- gtk_table_attach ((GtkTable *)table, box, 0, 1, 9, 10, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
entry = gtk_label_new (url->protocol);
gtk_widget_show(entry);
PACK_BOX(entry)
- gtk_table_attach ((GtkTable *)table, box, 1, 2, 9, 10, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ gtk_table_attach ((GtkTable *)table, box, 2, 3, 4, 5, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
- label = gtk_label_new (_("Server address:"));
- gtk_widget_show (label);
- PACK_BOX(label);
- gtk_table_attach ((GtkTable *)table, box, 0, 1, 10, 11, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
entry = gtk_label_new (url->host);
gtk_widget_show(entry);
PACK_BOX(entry);
- gtk_table_attach ((GtkTable *)table, box, 1, 2, 10, 11, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ gtk_table_attach ((GtkTable *)table, box, 2, 3, 5, 6, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
- label = gtk_label_new (_("Username:"));
- gtk_widget_show (label);
- PACK_BOX(label);
- gtk_table_attach ((GtkTable *)table, box, 0, 1, 11, 12, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
entry = gtk_label_new (url->user);
gtk_widget_show(entry);
PACK_BOX(entry);
- gtk_table_attach ((GtkTable *)table, box, 1, 2, 11, 12, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ gtk_table_attach ((GtkTable *)table, box, 2, 3, 6, 7, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
- label = gtk_label_new (_("Use encryption:"));
- gtk_widget_show (label);
- PACK_BOX(label);
- gtk_table_attach ((GtkTable *)table, box, 0, 1, 12, 13, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
enc = (gchar *)camel_url_get_param(url, "use_ssl");
entry = gtk_label_new (enc ? enc : _("never"));
gtk_widget_show(entry);
PACK_BOX(entry);
- gtk_table_attach ((GtkTable *)table, box, 1, 2, 12, 13, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ gtk_table_attach ((GtkTable *)table, box, 2, 3, 7, 8, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
/*
label = gtk_label_new (_("Organization:"));
@@ -378,6 +375,19 @@ mav_next_pressed (GtkButton *button, MailAccountView *mav)
g_free(uri);
camel_url_free(url);
}
+
+ if (!mav->original) {
+ EAccount *account = em_account_editor_get_modified_account(mav->edit);
+ CamelURL *aurl;
+ char *surl;
+ /* Save the password ahead of time */
+ aurl = camel_url_new (account->source->url, NULL);
+ surl = camel_url_to_string(aurl, CAMEL_URL_HIDE_ALL);
+ mail_session_add_password (surl, gtk_entry_get_text((GtkEntry *)mav->password));
+
+ camel_url_free(aurl);
+ g_free(surl);
+ }
em_account_editor_commit (mav->edit);
g_signal_emit (mav, signals[VIEW_CLOSE], 0);
return;
@@ -509,6 +519,9 @@ mav_construct_page(MailAccountView *view, MAVPageType type)
gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 0);
}
page->next = gtk_button_new ();
+ gtk_widget_set_can_default (page->next, TRUE);
+ g_signal_connect (page->next, "hierarchy-changed",
+ G_CALLBACK (gtk_widget_grab_default), NULL);
gtk_container_add ((GtkContainer *)page->next, box);
gtk_widget_show_all(page->next);
g_signal_connect(page->next, "clicked", G_CALLBACK(mav_next_pressed), view);
@@ -586,9 +599,16 @@ emae_check_servers (const gchar *email)
}
static void
+next_page (GtkWidget *entry, MailAccountView *mav)
+{
+ mav_next_pressed (NULL, mav);
+}
+
+static void
mail_account_view_construct (MailAccountView *view)
{
gint i;
+ EShell *shell;
view->scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy ((GtkScrolledWindow *)view->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -616,8 +636,29 @@ mail_account_view_construct (MailAccountView *view)
em_account_editor_check (view->edit, mail_account_pages[0].path);
view->pages[0]->done = TRUE;
- if (e_shell_get_express_mode (e_shell_get_default ()))
+ shell = e_shell_get_default ();
+ if (!shell || e_shell_get_express_mode (shell)) {
+ GtkWidget *table = em_account_editor_get_widget (view->edit, "identity_required_table");
+ GtkWidget *label, *pwd;
gtk_widget_hide (em_account_editor_get_widget (view->edit, "identity_optional_frame"));
+
+ if (!view->original) {
+ label = gtk_label_new (_("Password:"));
+ pwd = gtk_entry_new ();
+ gtk_entry_set_visibility ((GtkEntry *)pwd, FALSE);
+/* gtk_entry_set_activates_default ((GtkEntry *)pwd, TRUE); */
+ g_signal_connect (pwd, "activate", G_CALLBACK (next_page), view);
+ gtk_widget_show(label);
+ gtk_widget_show(pwd);
+ gtk_table_attach ((GtkTable *)table, label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
+ gtk_table_attach ((GtkTable *)table, pwd, 1, 2, 2, 3, GTK_FILL|GTK_EXPAND, 0, 0, 0);
+
+ view->password = pwd;
+ }
+ }
+
+ /* assume the full name is known from the system */
+ gtk_widget_grab_focus (em_account_editor_get_widget (view->edit, "identity_address"));
}
MailAccountView *