- threads->notmuch = query->notmuch;
- threads->threads = g_ptr_array_new ();
- threads->index = 0;
-
- talloc_set_destructor (threads, _notmuch_threads_destructor);
-
- seen = g_hash_table_new_full (g_str_hash, g_str_equal,
- free, NULL);
-
- for (messages = notmuch_query_search_messages (query, 0, -1);
- notmuch_messages_has_more (messages);
- notmuch_messages_advance (messages))
- {
- message = notmuch_messages_get (messages);
-
- thread_id = notmuch_message_get_thread_id (message);
-
- if (! g_hash_table_lookup_extended (seen,
- thread_id, NULL,
- (void **) &thread))
- {
- thread = _notmuch_thread_create (query, query->notmuch,
- thread_id,
- query->query_string);
- g_ptr_array_add (threads->threads, thread);
+ threads->query = query;
+ threads->threads = g_hash_table_new_full (g_str_hash, g_str_equal,
+ free, NULL);