[gnome-builder] file-search: update search index upon IdeProject::file-trashed
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] file-search: update search index upon IdeProject::file-trashed
- Date: Tue, 26 Apr 2016 04:56:52 +0000 (UTC)
commit faafc3f94f91d653454b8b6b66ed88fb03aca2ba
Author: Christian Hergert <christian hergert me>
Date: Mon Apr 25 21:56:39 2016 -0700
file-search: update search index upon IdeProject::file-trashed
plugins/file-search/gb-file-search-provider.c | 29 +++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/plugins/file-search/gb-file-search-provider.c b/plugins/file-search/gb-file-search-provider.c
index e1ac50d..cac5369 100644
--- a/plugins/file-search/gb-file-search-provider.c
+++ b/plugins/file-search/gb-file-search-provider.c
@@ -124,6 +124,29 @@ on_file_renamed (GbFileSearchProvider *self,
}
static void
+on_file_trashed (GbFileSearchProvider *self,
+ GFile *file,
+ IdeProject *project)
+{
+ g_autofree gchar *path = NULL;
+ IdeContext *context;
+ IdeVcs *vcs;
+ GFile *workdir;
+
+ g_assert (GB_IS_FILE_SEARCH_PROVIDER (self));
+ g_assert (G_IS_FILE (file));
+ g_assert (IDE_IS_PROJECT (project));
+ g_assert (GB_IS_FILE_SEARCH_INDEX (self->index));
+
+ context = ide_object_get_context (IDE_OBJECT (project));
+ vcs = ide_context_get_vcs (context);
+ workdir = ide_vcs_get_working_directory (vcs);
+
+ if (NULL != (path = g_file_get_relative_path (workdir, file)))
+ gb_file_search_index_remove (self->index, path);
+}
+
+static void
gb_file_search_provider_build_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
@@ -161,6 +184,12 @@ gb_file_search_provider_build_cb (GObject *object,
G_CALLBACK (on_file_renamed),
self,
G_CONNECT_SWAPPED);
+
+ g_signal_connect_object (project,
+ "file-trashed",
+ G_CALLBACK (on_file_trashed),
+ self,
+ G_CONNECT_SWAPPED);
}
static GtkWidget *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]