Index: cityrep.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/cityrep.c,v retrieving revision 1.58 diff -u -r1.58 cityrep.c --- cityrep.c 2002/04/09 15:16:20 1.58 +++ cityrep.c 2002/06/09 18:56:42 @@ -1264,18 +1264,16 @@ char buf [NUM_CREPORT_COLS][64]; int i; struct city_report_spec *spec; - + if(delay_report_update) return; if(!city_dialog_shell) return; - for (i=0, spec=city_report_specs;ishow); } - if((i=gtk_clist_find_row_from_data(GTK_CLIST(city_list), pcity))!=-1) { -#if 1 + if((i=gtk_clist_find_row_from_data(GTK_CLIST(city_list), pcity))!=-1) { /* This method avoids removing and re-adding the entry, because that seemed to cause problems in some cases, when the list is sorted by one of the columns. Doing "Popup" for the top @@ -1284,37 +1282,33 @@ multiple cities have the same string value in the column being sorted by. -- dwp */ - int j; + char *s; + int j, n; + bool sort; + + n = GTK_CLIST(city_list)->sort_column; + + gtk_clist_get_text(GTK_CLIST(city_list), i, n, &s); get_city_text(pcity, row, sizeof(buf[0])); + + sort = (strcmp(s, row[n]) != 0); + gtk_clist_freeze(GTK_CLIST(city_list)); + for (j=0; jselection, - GINT_TO_POINTER(i)); - - gtk_clist_get_text(GTK_CLIST(city_list),i,0,&text); - get_city_text(pcity, row, sizeof(buf[0])); + if (sort) { + gtk_clist_sort(GTK_CLIST(city_list)); + } - gtk_clist_freeze(GTK_CLIST(city_list)); - gtk_clist_remove(GTK_CLIST(city_list),i); - i=gtk_clist_append(GTK_CLIST(city_list),row); - gtk_clist_set_row_data (GTK_CLIST(city_list), i, pcity); - if (selected) - gtk_clist_select_row(GTK_CLIST(city_list), i, -1); gtk_clist_thaw(GTK_CLIST(city_list)); gtk_widget_show_all(city_list); -#endif } - else + else { city_report_dialog_update(); + } } /****************************************************************