static gboolean add_in_idle (GscProviderDevhelp *devhelp) { guint idx = 0; GList *ret = NULL; gboolean finished; /* Don't complete empty string (when word == NULL) */ if (devhelp->priv->word == NULL) { gtk_source_completion_context_add_proposals (devhelp->priv->context, GTK_SOURCE_COMPLETION_PROVIDER (devhelp), NULL, TRUE); population_finished (devhelp); return FALSE; } if (devhelp->priv->populate_iter == NULL) { devhelp->priv->populate_iter = find_first_proposal (devhelp); } while (idx < PROCESS_BATCH && devhelp->priv->populate_iter) { GtkSourceCompletionProposal *proposal; proposal = GTK_SOURCE_COMPLETION_PROPOSAL (g_sequence_get (devhelp->priv->populate_iter)); ret = g_list_prepend (ret, proposal); devhelp->priv->populate_iter = find_next_proposal (devhelp, devhelp->priv->populate_iter); ++idx; } ret = g_list_reverse (ret); finished = devhelp->priv->populate_iter == NULL; gtk_source_completion_context_add_proposals (devhelp->priv->context, GTK_SOURCE_COMPLETION_PROVIDER (devhelp), ret, finished); if (finished) { population_finished (devhelp); } return !finished; }
GtkSourceCompletionProposal * ide_ctags_completion_item_new (const IdeCtagsIndexEntry *entry, IdeCtagsCompletionProvider *provider, GtkSourceCompletionContext *context) { IdeCtagsCompletionItem *self; self= g_object_new (IDE_TYPE_CTAGS_COMPLETION_ITEM, NULL); /* * use borrowed references to avoid the massive amount of reference counting. * we don't need them since we know the provider will outlast us. */ self->entry = entry; self->provider = provider; /* * There is the slight chance the context will get disposed out of * our control. I've seen this happen a few times now. */ ide_set_weak_pointer (&self->context, context); return GTK_SOURCE_COMPLETION_PROPOSAL (self); }