[gnome-builder] ctags: replace existing index based on filename
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] ctags: replace existing index based on filename
- Date: Sun, 17 May 2015 03:15:35 +0000 (UTC)
commit c14a17363e77b90d036eb9c5b7337b1c060a6cfc
Author: Christian Hergert <christian hergert me>
Date: Sat May 16 20:12:18 2015 -0700
ctags: replace existing index based on filename
libide/ctags/ide-ctags-completion-provider.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/libide/ctags/ide-ctags-completion-provider.c b/libide/ctags/ide-ctags-completion-provider.c
index 91b5247..798d09c 100644
--- a/libide/ctags/ide-ctags-completion-provider.c
+++ b/libide/ctags/ide-ctags-completion-provider.c
@@ -46,10 +46,34 @@ void
ide_ctags_completion_provider_add_index (IdeCtagsCompletionProvider *self,
IdeCtagsIndex *index)
{
+ GFile *file;
+ gsize i;
+
+ IDE_ENTRY;
+
g_return_if_fail (IDE_IS_CTAGS_COMPLETION_PROVIDER (self));
g_return_if_fail (!index || IDE_IS_CTAGS_INDEX (index));
+ g_return_if_fail (self->indexes != NULL);
+
+ file = ide_ctags_index_get_file (index);
+
+ for (i = 0; i < self->indexes->len; i++)
+ {
+ IdeCtagsIndex *item = g_ptr_array_index (self->indexes, i);
+ GFile *item_file = ide_ctags_index_get_file (item);
+
+ if (g_file_equal (item_file, file))
+ {
+ g_ptr_array_remove_index_fast (self->indexes, i);
+ g_ptr_array_add (self->indexes, g_object_ref (index));
+
+ IDE_EXIT;
+ }
+ }
g_ptr_array_add (self->indexes, g_object_ref (index));
+
+ IDE_EXIT;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]