* change the example e-mail from first.last@provider.com => first.last@example.com
[modest] / src / maemo / easysetup / modest-easysetup-wizard.c
index bbee589..1ca45b0 100644 (file)
@@ -61,8 +61,6 @@
 #include <config.h>
 #endif
 
-#define EXAMPLE_EMAIL_ADDRESS "first.last@provider.com"
-
 G_DEFINE_TYPE (ModestEasysetupWizardDialog, modest_easysetup_wizard_dialog, MODEST_TYPE_WIZARD_DIALOG);
 
 #define WIZARD_DIALOG_GET_PRIVATE(o)                                   \
@@ -380,7 +378,7 @@ on_combo_account_serviceprovider (GtkComboBox *widget, gpointer user_data)
                domain_name = modest_presets_get_domain (priv->presets, provider_id);
        
        if(!domain_name)
-               domain_name = g_strdup (EXAMPLE_EMAIL_ADDRESS);
+               domain_name = g_strdup (MODEST_EXAMPLE_EMAIL_ADDRESS);
                
        if (self->entry_user_email)
                gtk_entry_set_text (GTK_ENTRY (self->entry_user_email), domain_name);
@@ -640,7 +638,7 @@ create_page_user_details (ModestEasysetupWizardDialog *self)
        hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_user_email), HILDON_GTK_INPUT_MODE_FULL);
        caption = create_caption_new_with_asterisk (self, sizegroup, 
                                                   _("mcen_li_emailsetup_email_address"), self->entry_user_email, NULL, HILDON_CAPTION_MANDATORY);
-       gtk_entry_set_text (GTK_ENTRY (self->entry_user_email), EXAMPLE_EMAIL_ADDRESS); /* Default text. */
+       gtk_entry_set_text (GTK_ENTRY (self->entry_user_email), MODEST_EXAMPLE_EMAIL_ADDRESS); /* Default text. */
        gtk_widget_show (self->entry_user_email);
        gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
        g_signal_connect(G_OBJECT(self->entry_user_email), "changed", 
@@ -1104,7 +1102,8 @@ on_response_before (ModestWizardDialog *wizard_dialog,
                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. */
+                       /* TODO: These button names will be ambiguous, and not
+                        * specified in the UI specification. */
 
                        const gint dialog_response = gtk_dialog_run (dialog);
                        self->combo_account_country = NULL;
@@ -1140,9 +1139,12 @@ presets_idle (gpointer userdata)
                gint mcc = easysetup_country_combo_box_get_active_country_mcc (
                        EASYSETUP_COUNTRY_COMBO_BOX (self->combo_account_country));
                easysetup_provider_combo_box_fill (
-                       EASYSETUP_PROVIDER_COMBO_BOX (self->combo_account_serviceprovider), priv->presets, mcc);
+                       EASYSETUP_PROVIDER_COMBO_BOX (self->combo_account_serviceprovider),
+                       priv->presets, mcc);
        }
 
+       priv->dirty = FALSE;
+
        g_object_unref (idle_data->dialog);
        g_free (idle_data);
 
@@ -1158,17 +1160,31 @@ presets_loader (gpointer userdata)
        ModestPresets *presets = NULL;
        IdleData *idle_data;
 
-       const gchar* filepath = MODEST_PROVIDERS_DATA_PATH; /* Defined in config.h */
-       presets = modest_presets_new (filepath);
-       if (!(presets)) {
-               g_warning ("Could not locate the official provider data keyfile from %s", filepath);
+       const gchar* path  = NULL;
+       const gchar* path1 = MODEST_PROVIDER_DATA_FILE;
+       const gchar* path2 = MODEST_MAEMO_PROVIDER_DATA_FILE;
+       
+       if (access(path1, R_OK) == 0) 
+               path = path1;
+       else if (access(path2, R_OK) == 0)
+               path = path2;
+       else {
+               g_warning ("%s: neither '%s' nor '%s' is a readable provider data file",
+                          __FUNCTION__, path1, path2);
+               return NULL;
        }
 
+       presets = modest_presets_new (path);
+       if (!presets) {
+               g_warning ("%s: failed to parse '%s'", __FUNCTION__, path);
+               return NULL;
+       }
+       
        idle_data = g_new0 (IdleData, 1);
        idle_data->dialog = self;
        idle_data->presets = presets;
-
-       g_idle_add (presets_idle, idle_data);
+       
+       g_idle_add (presets_idle, idle_data);   
 
        return NULL;
 }