mirror of https://github.com/tstellar/bygfoot.git
Double entries for the country are gone. Still a small problem with country flags
This commit is contained in:
parent
149bda9d85
commit
1761a6148c
|
@ -46,7 +46,7 @@ void add_definitions_directory(const gchar *directory)
|
||||||
#endif
|
#endif
|
||||||
gchar **dir_split_up;
|
gchar **dir_split_up;
|
||||||
|
|
||||||
dir_split_up = g_strsplit_set (directory, "\\/", -1);
|
dir_split_up = g_strsplit_set (directory, G_DIR_SEPARATOR_S, -1);
|
||||||
if (strcmp(dir_split_up[g_strv_length(dir_split_up)-1],"definitions")==0)
|
if (strcmp(dir_split_up[g_strv_length(dir_split_up)-1],"definitions")==0)
|
||||||
{
|
{
|
||||||
root_definitions_directories = g_list_prepend (root_definitions_directories,
|
root_definitions_directories = g_list_prepend (root_definitions_directories,
|
||||||
|
|
|
@ -367,9 +367,12 @@ on_combo_country_changed (GtkComboBox *combobox,
|
||||||
gchar *buf = NULL;
|
gchar *buf = NULL;
|
||||||
|
|
||||||
gtk_combo_box_get_active_iter(combobox, &iter);
|
gtk_combo_box_get_active_iter(combobox, &iter);
|
||||||
|
if (!gtk_tree_model_iter_has_child (gtk_combo_box_get_model(combobox),
|
||||||
|
&iter))
|
||||||
|
{
|
||||||
gtk_tree_model_get(gtk_combo_box_get_model(combobox), &iter, 1, &buf, -1);
|
gtk_tree_model_get(gtk_combo_box_get_model(combobox), &iter, 1, &buf, -1);
|
||||||
|
|
||||||
misc_callback_show_team_list(GTK_WIDGET(combobox), buf);
|
misc_callback_show_team_list(GTK_WIDGET(combobox), buf);
|
||||||
|
}
|
||||||
g_free(buf);
|
g_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2657,13 +2657,14 @@ treeview_create_country_list(const GPtrArray *country_list)
|
||||||
// We then try to build a tree using "/ or \" as a separator
|
// We then try to build a tree using "/ or \" as a separator
|
||||||
// The list is already sorted, so we don't need to verify
|
// The list is already sorted, so we don't need to verify
|
||||||
current_country = g_strdup((gchar*)g_ptr_array_index(country_list, i));
|
current_country = g_strdup((gchar*)g_ptr_array_index(country_list, i));
|
||||||
if (g_str_has_prefix(current_country,"/")||g_str_has_prefix(current_country,"\\"))
|
if (g_str_has_prefix(current_country,G_DIR_SEPARATOR_S))
|
||||||
{
|
{
|
||||||
// Strip leading "\\"
|
// Strip leading directory delimiter
|
||||||
sprintf(current_country, "%.*s", strlen(current_country) - 1, ¤t_country[1]);
|
sprintf(current_country, "%.*s", strlen(current_country) - 1, ¤t_country[1]);
|
||||||
}
|
}
|
||||||
dir_split_up = g_strsplit_set (current_country, "\\/", -1);
|
dir_split_up = g_strsplit_set (current_country, G_DIR_SEPARATOR_S, -1);
|
||||||
for (j=0; j<g_strv_length(dir_split_up); j++)
|
// We only go up to the before last column
|
||||||
|
for (j=0; j<g_strv_length(dir_split_up)-1; j++)
|
||||||
{
|
{
|
||||||
create_new_line = FALSE;
|
create_new_line = FALSE;
|
||||||
// j is an element index. As indexes start from 0 we always
|
// j is an element index. As indexes start from 0 we always
|
||||||
|
@ -2692,13 +2693,18 @@ treeview_create_country_list(const GPtrArray *country_list)
|
||||||
{
|
{
|
||||||
gtk_tree_store_append(ls, (GtkTreeIter*)g_ptr_array_index(iterators,j), (GtkTreeIter*)g_ptr_array_index(iterators,j-1));
|
gtk_tree_store_append(ls, (GtkTreeIter*)g_ptr_array_index(iterators,j), (GtkTreeIter*)g_ptr_array_index(iterators,j-1));
|
||||||
}
|
}
|
||||||
|
// Clean out buf and buf2. Otherwise the previous entry will
|
||||||
|
// be used. Meaning: The flag for the previous country will be
|
||||||
|
// shown if no flag is found for this entry
|
||||||
|
sprintf(buf, "%s", "");
|
||||||
|
sprintf(buf2, "%s", "");
|
||||||
sscanf((gchar*)dir_split_up[j], "country_%[^.]%[.xml]",
|
sscanf((gchar*)dir_split_up[j], "country_%[^.]%[.xml]",
|
||||||
buf2, trash);
|
buf2, trash);
|
||||||
sprintf(buf, "flag_%s.png", buf2);
|
sprintf(buf, "flag_%s.png", buf2);
|
||||||
|
|
||||||
treeview_helper_insert_icon((GtkTreeModel*)ls, (GtkTreeIter*)g_ptr_array_index(iterators,j), 0, buf);
|
treeview_helper_insert_icon((GtkTreeModel*)ls, (GtkTreeIter*)g_ptr_array_index(iterators,j), 0, buf);
|
||||||
gtk_tree_store_set(ls, (GtkTreeIter*)g_ptr_array_index(iterators,j), 1,
|
gtk_tree_store_set(ls, (GtkTreeIter*)g_ptr_array_index(iterators,j),
|
||||||
(gchar*)dir_split_up[j], -1);
|
1, (gchar*)dir_split_up[j], -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_strfreev(dir_split_up);
|
g_strfreev(dir_split_up);
|
||||||
|
|
Loading…
Reference in New Issue