[gnome-builder] recent: purge cache data for project
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] recent: purge cache data for project
- Date: Tue, 21 Nov 2017 07:31:46 +0000 (UTC)
commit 508783620c150b6897cf838389cc42bda50d1984
Author: Christian Hergert <chergert redhat com>
Date: Mon Nov 20 23:30:46 2017 -0800
recent: purge cache data for project
When removing files for a project, we want to remove the
cache dir for the project.
This still requires that we refactor plugins to use the new
project based cache dir.
src/plugins/recent/gbp-recent-section.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/recent/gbp-recent-section.c b/src/plugins/recent/gbp-recent-section.c
index 61f3c60..2b01a27 100644
--- a/src/plugins/recent/gbp-recent-section.c
+++ b/src/plugins/recent/gbp-recent-section.c
@@ -293,6 +293,7 @@ gbp_recent_section_purge_selected (IdeGreeterSection *section)
for (const GList *iter = infos; iter != NULL; iter = iter->next)
{
g_autoptr(IdeProjectInfo) info = iter->data;
+ const gchar *name = ide_project_info_get_name (info);
GFile *directory = ide_project_info_get_directory (info);
GFile *file = ide_project_info_get_file (info);
g_autoptr(GFile) parent = NULL;
@@ -304,6 +305,27 @@ gbp_recent_section_purge_selected (IdeGreeterSection *section)
dzl_directory_reaper_add_directory (reaper, directory, 0);
g_ptr_array_add (directories, g_object_ref (directory));
+
+ /*
+ * Also add various cache directories we know are used by
+ * Builder so that we can cleanup extra state that the user
+ * might expect to be reomved.
+ */
+
+ if (name != NULL)
+ {
+ g_autoptr(GFile) cache = NULL;
+ g_autofree gchar *id = NULL;
+
+ id = ide_project_create_id (name);
+ cache = g_file_new_build_filename (g_get_user_cache_dir (),
+ ide_get_program_name (),
+ "projects",
+ id,
+ NULL);
+ dzl_directory_reaper_add_directory (reaper, cache, 0);
+ g_ptr_array_add (directories, g_steal_pointer (&cache));
+ }
}
dzl_directory_reaper_execute_async (reaper,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]