* Revert changes made in r3868. We have a better solution now
[modest] / src / maemo / easysetup / modest-easysetup-country-combo-box.c
index dae85b6..7005569 100644 (file)
@@ -159,7 +159,7 @@ static int
 parse_mcc_mapping_line (const char* line,  char** country)
 {
        int i, j;
-       static char* mcc="123";  /* the mcc code, always 3 bytes*/
+       char mcc[3];  /* the mcc code, always 3 bytes*/
        static char my_country[128];
 
        if (!line) {
@@ -183,7 +183,8 @@ parse_mcc_mapping_line (const char* line,  char** country)
        mcc[2] = line[2];
        
        *country = my_country;
-       return effective_mcc (atoi(mcc));
+
+       return effective_mcc ((int) strtol ((const char*)mcc, NULL, 10));
 }
 
 /** Note that the mcc_mapping file is installed 
@@ -246,6 +247,13 @@ static void
 easysetup_country_combo_box_init (EasysetupCountryComboBox *self)
 {
        EasysetupCountryComboBoxPrivate *priv = COUNTRY_COMBO_BOX_GET_PRIVATE (self);
+       priv->model = NULL;
+}
+
+void
+easysetup_country_combo_box_load_data(EasysetupCountryComboBox *self)
+{
+       EasysetupCountryComboBoxPrivate *priv = COUNTRY_COMBO_BOX_GET_PRIVATE (self);
 
        /* Create a tree model for the combo box,
         * with a string for the name, and an int for the MCC ID.
@@ -255,7 +263,6 @@ easysetup_country_combo_box_init (EasysetupCountryComboBox *self)
        
        /* Setup the combo box: */
        GtkComboBox *combobox = GTK_COMBO_BOX (self);
-       gtk_combo_box_set_model (combobox, priv->model);
        
        /* Country column:
         * The ID model column in not shown in the view. */
@@ -271,6 +278,8 @@ easysetup_country_combo_box_init (EasysetupCountryComboBox *self)
        
        /* Fill the model with rows: */
        load_from_file (self);
+       /* Set this _after_ loading from file, it makes loading faster */
+       gtk_combo_box_set_model (combobox, priv->model);
 }
 
 EasysetupCountryComboBox*