static void
on_caption_entry_changed (GtkEditable *editable, gpointer user_data)
{
- ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
- g_assert(self);
+ ModestEasysetupWizardDialog *self;
+ gboolean mandatory, empty;
+ ModestEasysetupWizardDialogPrivate *priv;
+
+ g_return_if_fail (user_data);
+
+ self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
+ priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
+
invoke_enable_buttons_vfunc(self);
+
+ empty = !g_utf8_collate (gtk_entry_get_text (GTK_ENTRY (editable)), "");
+ mandatory = ((GtkWidget *) editable == priv->entry_account_title) ||
+ ((GtkWidget *) editable == priv->entry_user_username) ||
+ ((GtkWidget *) editable == priv->entry_user_email);
+
+ /* Show a banner & get focus */
+ if (empty && mandatory) {
+ modest_platform_information_banner ((GtkWidget *) editable, NULL,
+ _CS("ckct_ib_enter_some_text"));
+ gtk_widget_grab_focus (GTK_WIDGET (editable));
+ }
}
static void
return GTK_WIDGET (box);
}
+static void
+on_user_username_changed(GtkWidget* widget, ModestEasysetupWizardDialog *self)
+{
+ ModestEasysetupWizardDialogPrivate* priv;
+ gchar* provider_id = NULL;
+ EasysetupProviderComboBox *combo;
+
+ priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
+
+ /* Work out the user email address */
+ combo = EASYSETUP_PROVIDER_COMBO_BOX (priv->combo_account_serviceprovider);
+ provider_id = easysetup_provider_combo_box_get_active_provider_id (combo);
+
+ if (provider_id) {
+ gchar *email_address;
+ gchar *domain_name = modest_presets_get_domain (priv->presets, provider_id);
+
+ email_address = g_strdup_printf ("%s@%s",
+ gtk_entry_get_text (GTK_ENTRY (priv->entry_user_username)),
+ domain_name);
+
+ /* Update the email address */
+ gtk_entry_set_text (GTK_ENTRY (priv->entry_user_email), email_address);
+
+ g_free (email_address);
+ g_free (domain_name);
+ g_free (provider_id);
+ }
+
+ /* Update state */
+ on_easysetup_changed(widget, self);
+}
+
static GtkWidget*
create_page_user_details (ModestEasysetupWizardDialog *self)
{
gtk_widget_show (priv->entry_user_username);
gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
g_signal_connect(G_OBJECT(priv->entry_user_username), "changed",
- G_CALLBACK(on_easysetup_changed), self);
+ G_CALLBACK(on_user_username_changed), self);
gtk_widget_show (caption);
/* Prevent the use of some characters in the username,
/* This is mostly copied from
* src/maemo/modest-account-settings-dialog.c */
if (priv->dirty) {
- GtkDialog *dialog = GTK_DIALOG (hildon_note_new_confirmation (GTK_WINDOW (self),
- _("imum_nc_wizard_confirm_lose_changes")));
- /* TODO: These button names will be ambiguous, and not
- * specified in the UI specification. */
+ gint dialog_response;
+ GtkWidget *dialog;
- const gint dialog_response = gtk_dialog_run (dialog);
+ dialog = hildon_note_new_confirmation ((GtkWindow *) self,
+ _("imum_nc_wizard_confirm_lose_changes"));
+
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ (GtkWindow *) dialog,
+ (GtkWindow *) wizard_dialog);
+
+ dialog_response = gtk_dialog_run ((GtkDialog *) dialog);
gtk_widget_destroy (GTK_WIDGET (dialog));
if (dialog_response != GTK_RESPONSE_OK) {
const gchar* path = NULL;
const gchar* path1 = MODEST_PROVIDER_DATA_FILE;
- const gchar* path2 = MODEST_MAEMO_PROVIDER_DATA_FILE;
+ const gchar* path2 = MODEST_FALLBACK_PROVIDER_DATA_FILE;
if (access(path1, R_OK) == 0)
path = path1;
/* Aavoid a clash with an existing display name: */
const gboolean name_in_use = modest_account_mgr_account_with_display_name_exists (
priv->account_manager, account_title);
+ g_free (account_title);
if (name_in_use) {
/* Warn the user via a dialog: */
{
ModestEasysetupWizardDialogPrivate *priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
guint special_port;
- gchar *provider_id;
+ gchar *provider_id = NULL;
gchar* display_name;
const gchar *username, *password;
gchar *store_hostname, *transport_hostname;
"but it's not a ModestAccountProtocol");
}
+ g_free (provider_id);
return;
}
display_name = get_entered_account_title (self);
modest_account_settings_set_display_name (priv->settings, display_name);
g_free (display_name);
+ g_free (provider_id);
}