+ g_free (server_name);
+ server_name = NULL;
+
+ /* username: */
+ gchar *initial_username = modest_server_account_get_username (
+ modest_runtime_get_account_mgr(), server_account_name);
+
+ GtkWidget *entry_username = gtk_entry_new ();
+ if (initial_username)
+ gtk_entry_set_text (GTK_ENTRY (entry_username), initial_username);
+ /* Dim this if a connection has ever succeeded with this username,
+ * as per the UI spec: */
+ const gboolean username_known =
+ modest_server_account_get_username_has_succeeded(
+ modest_runtime_get_account_mgr(), server_account_name);
+ gtk_widget_set_sensitive (entry_username, !username_known);
+
+#ifdef MODEST_PLATFORM_MAEMO
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry_username), HILDON_GTK_INPUT_MODE_FULL);
+
+ /* Create a size group to be used by all captions.
+ * Note that HildonCaption does not create a default size group if we do not specify one.
+ * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
+ GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ GtkWidget *caption = hildon_caption_new (sizegroup,
+ _("mail_fi_username"), entry_username, NULL, HILDON_CAPTION_MANDATORY);
+ gtk_widget_show (entry_username);
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), caption,
+ FALSE, FALSE, MODEST_MARGIN_HALF);
+ gtk_widget_show (caption);
+#else
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), entry_username,
+ TRUE, FALSE, 0);
+#endif /* MODEST_PLATFORM_MAEMO */
+
+ /* password: */
+ GtkWidget *entry_password = gtk_entry_new ();
+ gtk_entry_set_visibility (GTK_ENTRY(entry_password), FALSE);
+ /* gtk_entry_set_invisible_char (GTK_ENTRY(entry_password), "*"); */
+
+#ifdef MODEST_PLATFORM_MAEMO
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry_password),
+ HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
+
+ caption = hildon_caption_new (sizegroup,
+ _("mail_fi_password"), entry_password, NULL, HILDON_CAPTION_MANDATORY);
+ gtk_widget_show (entry_password);
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), caption,
+ FALSE, FALSE, MODEST_MARGIN_HALF);
+ gtk_widget_show (caption);
+ g_object_unref (sizegroup);
+#else
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), entry_password,
+ TRUE, FALSE, 0);
+#endif /* MODEST_PLATFORM_MAEMO */
+
+/* This is not in the Maemo UI spec: