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) {
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
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.
/* 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. */
/* 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*