- index_lock->lock("MainIndexes::run 1");
- indexfile = new IndexFile(mwindow, indexable);
- index_lock->unlock();
-
-
-// Doesn't exist if this returns 1.
- if(indexfile->open_index())
- {
-// Try to create index now.
- if(!progress)
- {
- if(mwindow->gui) mwindow->gui->lock_window("MainIndexes::run 1");
- progress = mwindow->mainprogress->start_progress(_("Building Indexes..."), 1);
- if(mwindow->gui) mwindow->gui->unlock_window();
- }
-
-
- indexfile->create_index(progress);
- if(progress->is_cancelled()) interrupt_flag = 1;
- }
- else
-// Exists. Update real thing.
- {
-//printf("MainIndexes::run 8\n");
- if(index_state->index_status == INDEX_NOTTESTED)
- {
- index_state->index_status = INDEX_READY;
- if(mwindow->gui) mwindow->gui->lock_window("MainIndexes::run 2");
- mwindow->edl->set_index_file(indexable);
- if(mwindow->gui) mwindow->gui->unlock_window();
- }
- indexfile->close_index();
- }
-
- index_lock->lock("MainIndexes::run 2");
- delete indexfile;
- indexfile = 0;
- index_lock->unlock();
-//printf("MainIndexes::run 8\n");
+ next_lock->lock("MainIndexes::run");
+ for( int i=0; i<current_indexables.size() && !interrupt_flag; ++i ) {
+ Indexable *indexable = current_indexables[i];
+ IndexState *index_state = indexable->index_state;
+// if status is known, no probe
+ if( index_state->index_status != INDEX_NOTTESTED ) continue;
+ next_lock->unlock();
+
+ IndexFile indexfile(mwindow, indexable);
+ int ret = indexfile.open_index();
+ if( !ret ) {
+ indexfile.close_index();
+// use existing index
+ index_state->index_status = INDEX_READY;
+ if(mwindow->gui) mwindow->gui->lock_window("MainIndexes::run 2");
+ mwindow->edl->set_index_file(indexable);
+ if(mwindow->gui) mwindow->gui->unlock_window();
+ continue;