* changes to use either maemo-provider-data.keyfile or modest-provider-data.keyfile
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Sat, 10 Nov 2007 15:27:22 +0000 (15:27 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Sat, 10 Nov 2007 15:27:22 +0000 (15:27 +0000)
  (decide at runtime); this depends on the changes done in modest-providers-data
* include maemo-provider-data in modest, no more separate maemo-providers-data package
* check for DISPLAY to give a better error message at startup
* inform user if 'showui' is not provided

pmo-trunk-r3693

src/maemo/easysetup/Makefile.am
src/maemo/easysetup/maemo-provider-data.keyfile [new file with mode: 0644]
src/maemo/easysetup/modest-easysetup-wizard.c
src/maemo/modest-maemo-utils.c
src/maemo/modest-platform.c
src/modest-defs.h
src/modest-main.c

index 2ee68a9..0840ba4 100644 (file)
@@ -61,10 +61,16 @@ LDADD = \
        $(MODEST_GSTUFF_LIBS) \
        $(MODEST_PLATFORM_LIBS)
 
-# mcc_mapping will in future be provided by the operator-wizard-settings package:
+# mcc_mapping may be provided by the operator-wizard-settings package:
+# the one here is a copy, as that package is not available in chinook
 MMC_MAPPING_FILE=mcc_mapping
 mmccmappingdir=$(datadir)/modest/provider-data
 mmccmapping_DATA = $(MMC_MAPPING_FILE)
 
+PROVIDER_DATA_FILE=maemo-provider-data.keyfile
+providerdatadir=$(datadir)/modest/provider-data
+providerdata_DATA = $(PROVIDER_DATA_FILE)
+
 EXTRA_DIST=\
-       $(MMC_MAPPING_FILE)
+       $(MMC_MAPPING_FILE)    \
+       $(PROVIDER_DATA_FILE)
diff --git a/src/maemo/easysetup/maemo-provider-data.keyfile b/src/maemo/easysetup/maemo-provider-data.keyfile
new file mode 100644 (file)
index 0000000..a82c909
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# This file is part of maemo-providers-data
+#
+[aim.com]
+Name=AIM
+MCC=0
+Domain=aim.com
+OutgoingMailServer=smtp.aim.com
+IncomingMailServer=imap.aim.com
+IncomingSecurity=0
+MailboxType=imap
+[aol.com]
+Name=AOL
+MCC=0
+Domain=aol.com
+OutgoingMailServer=smtp.aol.com
+IncomingMailServer=imap.aol.com
+IncomingSecurity=0
+MailboxType=imap
+[gmail.com]
+Name=Gmail
+MCC=0
+Domain=gmail.com
+OutgoingMailServer=smtp.gmail.com
+SecureSmtp=true
+IncomingMailServer=pop.gmail.com
+IncomingSecurity=2
+MailboxType=pop
+[lycos.com]
+Name=Lycos Mail
+MCC=0
+Domain=lcyos.com
+OutgoingMailServer=smtp.mail.lycos.com
+IncomingMailServer=pop.mail.lycos.com
+IncomingSecurity=0
+MailboxType=pop
+[hotmail.com]
+Name=Hotmail
+MCC=0
+Domain=hotmail.com
+OutgoingMailServer=mail.hotmail.com
+IncomingMailServer=smtp.hotmail.com
+IncomingSecurity=0
+MailboxType=pop
+[yahoo.com]
+Name=Yahoo Mail Plus
+MCC=0
+Domain=yahoo.com
+OutgoingMailServer=smtp.mail.yahoo.com
+IncomingMailServer=pop.mail.yahoo.com
+IncomingSecurity=0
+MailboxType=pop
+[TinymailImap]
+Name=TinymailIMAP
+MCC=206
+Domain=tinymail.org
+IncomingMailServer=imap1.tinymail.org
+IncomingSecurity=0
+MailboxType=imap
+[TinymailPop]
+Name=TinymailPOP
+MCC=206
+Domain=tinymail.org
+IncomingMailServer=imap1.tinymail.org
+IncomingSecurity=0
+MailboxType=pop
+
index bbee589..26a86ee 100644 (file)
@@ -1104,7 +1104,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,7 +1141,8 @@ 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);
        }
 
        g_object_unref (idle_data->dialog);
@@ -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;
 }
index 656202d..47d980e 100644 (file)
@@ -692,8 +692,8 @@ modest_maemo_open_mcc_mapping_file (void)
        FILE* result;
        
        const gchar* path;
-       const gchar* path1 = MODEST_OPERATOR_WIZARD_PROVIDER_DATA_DIR;
-       const gchar* path2 = MODEST_PROVIDER_DATA_DIR;
+       const gchar* path1 = MODEST_OPERATOR_WIZARD_MCC_MAPPING;
+       const gchar* path2 = MODEST_MCC_MAPPING;
        
        if (access(path1, R_OK) == 0) 
                path = path1;
index 8f38a5a..9b1fdb7 100644 (file)
@@ -92,12 +92,13 @@ check_required_files (void)
                return FALSE;
        } else 
                fclose (mcc_file);
-
-       if (access (MODEST_PROVIDERS_DATA_PATH, R_OK) != 0) {
+       
+       if (access(MODEST_PROVIDER_DATA_FILE, R_OK) != 0 &&
+           access(MODEST_MAEMO_PROVIDER_DATA_FILE, R_OK) != 0) {
                g_printerr ("modest: cannot find providers data\n");
                return FALSE;
        }
-
+       
        return TRUE;
 }
 
index d43983b..06c63ce 100644 (file)
 #define MODEST_CONF_NAMESPACE          "/apps/modest"
 
 /* the mapping files, there are two possibilities; used in modest_maemo_open_mcc_mapping_file */
-#define MODEST_PROVIDER_DATA_DIR                 PREFIX "/share/modest/provider-data/mcc_mapping"
-#define MODEST_OPERATOR_WIZARD_PROVIDER_DATA_DIR "/usr/share/operator-wizard/mcc_mapping"
+#define MODEST_MCC_MAPPING                 PREFIX "/share/modest/provider-data/mcc_mapping"
+#define MODEST_OPERATOR_WIZARD_MCC_MAPPING "/usr/share/operator-wizard/mcc_mapping"
 
+#define MODEST_PROVIDER_DATA_FILE         PREFIX "/share/modest/provider-data/modest-provider-data.keyfile"  
+#define MODEST_MAEMO_PROVIDER_DATA_FILE          PREFIX "/share/modest/provider-data/maemo-provider-data.keyfile"  
 
 /* configuration key definitions for modest */
 #define MODEST_ACCOUNT_NAMESPACE         MODEST_CONF_NAMESPACE "/accounts"
index ebfe628..9278fab 100644 (file)
@@ -90,6 +90,11 @@ main (int argc, char *argv[])
                if (strcmp (argv[1], "showui") == 0)
                        show_ui_without_top_application_method = TRUE;
        }
+
+       if (!show_ui_without_top_application_method) {
+               g_print ("modest: not showing UI\n");
+               g_print ("modest: use 'modest showui' to start with UI\n");
+       }       
                
        if (!g_thread_supported())
                g_thread_init (NULL);
@@ -97,6 +102,12 @@ main (int argc, char *argv[])
        gdk_threads_init ();
        gdk_threads_enter ();
 
+       if (!getenv("DISPLAY")) {
+               g_printerr ("modest: DISPLAY env variable is not set\n");
+               retval = 1;
+               goto cleanup;
+       }
+       
        if (!gtk_init_check (&argc, &argv)) {
                g_printerr ("modest: failed to initialize gtk\n");
                retval = 1;