2007-04-29 Murray Cumming <murrayc@murrayc.com>
[modest] / src / maemo / easysetup / modest-easysetup-country-combo-box.c
index 7eed707..5f15bd9 100644 (file)
 
 #include <libintl.h> /* For dgettext(). */
 
+/* Include config.h so that _() works: */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 G_DEFINE_TYPE (EasysetupCountryComboBox, easysetup_country_combo_box, GTK_TYPE_COMBO_BOX);
 
 #define COUNTRY_COMBO_BOX_GET_PRIVATE(o) \
@@ -146,10 +151,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 = PROVIDER_DATA_DIR "/mcc_mapping";
+       FILE *file = fopen(filepath, "r");
        if (!file)
        {
-               g_warning("Could not open mcc_mapping file.\n");
+               const gchar* filepath_hack = HACK_TOP_SRCDIR "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;
        }