From cab9a17c67dfcdb74eae9c40ef0ee5d8fb7a2ea1 Mon Sep 17 00:00:00 2001 From: Richard Kettlewell Date: Sat, 14 Jun 2008 15:42:13 +0100 Subject: [PATCH] choose_populate() always raise choose-more-tracks rather than only raising choose-inserted-tracks if it inserted new rows. The search auto-expansion logic depends on being notified after all the expansions it requested are completed, not just the ones that actually created new rows. --- disobedience/choose-search.c | 4 ++-- disobedience/choose.c | 13 +++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/disobedience/choose-search.c b/disobedience/choose-search.c index d12a343..96003e3 100644 --- a/disobedience/choose-search.c +++ b/disobedience/choose-search.c @@ -125,7 +125,7 @@ static int choose_make_one_visible(const char *track) { } if(is_prefix(dir, track)) { /* We found a prefix of the target track. */ - //fprintf(stderr, " is a prefix\n"); + //fprintf(stderr, " %s is a prefix\n", dir); const gboolean expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(choose_view), path); if(expanded) { @@ -246,7 +246,7 @@ static void choose_make_visible(const char attribute((unused)) *event, /* If there's work left to be done make sure we get a callback when * something changes */ if(!choose_inserted_handle) - choose_inserted_handle = event_register("choose-inserted-tracks", + choose_inserted_handle = event_register("choose-more-tracks", choose_make_visible, 0); } else { /* Suppress callbacks if there's nothing more to do */ diff --git a/disobedience/choose.c b/disobedience/choose.c index 1f316d7..44096d5 100644 --- a/disobedience/choose.c +++ b/disobedience/choose.c @@ -52,9 +52,6 @@ GtkTreeSelection *choose_selection; /** @brief Count of file listing operations in flight */ static int choose_list_in_flight; -/** @brief Count of files inserted in current batch of listing operations */ -static int choose_inserted; - static char *choose_get_string(GtkTreeIter *iter, int column) { gchar *gs; gtk_tree_model_get(GTK_TREE_MODEL(choose_store), iter, @@ -310,19 +307,15 @@ static void choose_populate(GtkTreeRowReference *parent_ref, gtk_tree_row_reference_free(parent_ref); gtk_tree_path_free(parent_path); } +skip: /* We only notify others that we've inserted tracks when there are no more * 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, "raising choose-more-tracks\n"); + event_raise("choose-more-tracks", 0); } //fprintf(stderr, "choose_list_in_flight -> %d-\n", choose_list_in_flight); } -- 2.11.0