2007-04-03 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Tue, 3 Apr 2007 15:51:37 +0000 (15:51 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Tue, 3 Apr 2007 15:51:37 +0000 (15:51 +0000)
* src/maemo/easysetup/modest-easysetup-country-combo-box.c:
        (load_from_file):
        * src/maemo/easysetup/modest-easysetup-wizard.c:
        (modest_easysetup_wizard_dialog_init):
        * src/maemo/easysetup/modest-presets.c: (modest_presets_new):
        Use realistic paths (though they should use  generically) to the
        mcc_mapping and provider-data.keyfile files which might work when they
        are installed by the future version of the operator-wizard package,
        and then fallback to paths in our source code, with an explanatory
        warning.

pmo-trunk-r1494

ChangeLog2
src/maemo/easysetup/modest-easysetup-country-combo-box.c
src/maemo/easysetup/modest-easysetup-wizard.c
src/maemo/easysetup/modest-presets.c

index 1cde256..c34ad7d 100644 (file)
@@ -1,5 +1,18 @@
 2007-04-03  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/maemo/easysetup/modest-easysetup-country-combo-box.c:
+       (load_from_file):
+       * src/maemo/easysetup/modest-easysetup-wizard.c:
+       (modest_easysetup_wizard_dialog_init):
+       * src/maemo/easysetup/modest-presets.c: (modest_presets_new): 
+       Use realistic paths (though they should use $prefix generically) to the 
+       mcc_mapping and provider-data.keyfile files which might work when they 
+       are installed by the future version of the operator-wizard package, 
+       and then fallback to paths in our source code, with an explanatory 
+       warning.
+
+2007-04-03  Murray Cumming  <murrayc@murrayc.com>
+
        * configure.ac:
        * src/Makefile.am:
        * src/maemo/Makefile.am:
index 7eed707..3b69935 100644 (file)
@@ -146,10 +146,18 @@ static void load_from_file (EasysetupCountryComboBox *self)
        EasysetupCountryComboBoxPrivate *priv = COUNTRY_COMBO_BOX_GET_PRIVATE (self);
        
        /* Load the file one line at a time: */
-       FILE *file = fopen("mcc_mapping", "r");
+       const gchar* filepath = "/usr/share/operator-wizard/mcc_mapping";
+       FILE *file = fopen(filepath, "r");
        if (!file)
        {
-               g_warning("Could not open mcc_mapping file.\n");
+               const gchar* filepath_hack = "./src/maemo/easysetup/mcc_mapping";
+               g_warning ("Could not locate the official mcc_mapping countries list file from %s, "
+                       "so attempting to load it instead from %s", filepath, filepath_hack);
+               file = fopen(filepath_hack, "r");
+       }
+       
+       if (!file) {
+               g_warning("Could not open mcc_mapping file");
                return;
        }
 
index 008a064..3b4d499 100644 (file)
@@ -671,8 +671,20 @@ modest_easysetup_wizard_dialog_init (ModestEasysetupWizardDialog *self)
 
        /* Read in the information about known service providers: */
        ModestEasysetupWizardDialogPrivate *priv = WIZARD_DIALOG_GET_PRIVATE (self);
-       priv->presets = modest_presets_new ("provider-data-test.keyfile"); /* TODO: the actual filepath. */
-
+       
+       const gchar* filepath = "/usr/share/operator-wizard/provider-data.keyfile";
+       priv->presets = modest_presets_new (filepath); /* TODO: the actual filepath. */
+       if (!(priv->presets))
+       {
+               const gchar* filepath_hack = "./src/maemo/easysetup/provider-data-test.keyfile";
+               g_warning ("Could not locate the official provider data keyfile from %s, "
+                       "so attempting to load it instead from %s", filepath, filepath_hack);
+               priv->presets = modest_presets_new (filepath_hack); /* TODO: the actual filepath. */
+       }
+       
+       g_assert(priv->presets);
+       
+       
        /* Create the account manager object, 
         * so we can check for existing accounts,
         * and create new accounts: */
index 8d4e001..bea2069 100644 (file)
@@ -91,7 +91,7 @@ modest_presets_new (const gchar *presetfile)
 
        if (!g_key_file_load_from_file (presets->keyfile, presetfile,
                                        G_KEY_FILE_NONE, &err)) {
-               g_printerr ("modest: cannot open keyfile: %s\n",
+               g_printerr ("modest: cannot open keyfile from %s:\n  %s\n", presetfile,
                            err ? err->message : "unknown reason");
                g_error_free (err);
                g_free (presets);