From: Richard Kettlewell Date: Sat, 14 Jun 2008 13:25:22 +0000 (+0100) Subject: Account choose_list_in_flight correctly. X-Git-Tag: 4.1~15^2~20 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/d848c36fc9de36897f18dd950288b57dfa1c0ca7 Account choose_list_in_flight correctly. --- diff --git a/disobedience/choose.c b/disobedience/choose.c index c30d712..1f316d7 100644 --- a/disobedience/choose.c +++ b/disobedience/choose.c @@ -171,9 +171,10 @@ static void choose_set_state(const char attribute((unused)) *event, static void choose_populate(GtkTreeRowReference *parent_ref, int nvec, char **vec, int isfile) { - if(!nvec) - return; const char *type = isfile ? "track" : "dir"; + //fprintf(stderr, "%d new children of type %s\n", nvec, type); + if(!nvec) + goto skip; /* Compute parent_* */ GtkTreeIter pit[1], *parent_it; GtkTreePath *parent_path; @@ -313,14 +314,17 @@ static void choose_populate(GtkTreeRowReference *parent_ref, * insertions pending, so that they don't have to keep track of how many * requests they've made. */ choose_inserted += inserted; +skip: if(--choose_list_in_flight == 0) { /* Notify interested parties that we inserted some tracks, AFTER making * sure that the row is properly expanded */ if(choose_inserted) { + //fprintf(stderr, "raising choose-inserted-tracks\n"); event_raise("choose-inserted-tracks", parent_it); choose_inserted = 0; } } + //fprintf(stderr, "choose_list_in_flight -> %d-\n", choose_list_in_flight); } static void choose_dirs_completed(void *v, @@ -392,6 +396,7 @@ static void choose_row_expanded(GtkTreeView attribute((unused)) *treeview, path)); /* The row references are destroyed in the _completed handlers. */ choose_list_in_flight += 2; + //fprintf(stderr, "choose_list_in_flight -> %d+\n", choose_list_in_flight); } /** @brief Create the choose tab */ @@ -476,6 +481,8 @@ GtkWidget *choose_widget(void) { /* Fill the root */ disorder_eclient_files(client, choose_files_completed, "", NULL, NULL); disorder_eclient_dirs(client, choose_dirs_completed, "", NULL, NULL); + choose_list_in_flight += 2; + //fprintf(stderr, "choose_list_in_flight -> %d+\n", choose_list_in_flight); /* Make the widget scrollable */ GtkWidget *scrolled = scroll_widget(choose_view);