[gnome-builder/gnome-builder-3-20] recent-projects: don't track removed projects
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-20] recent-projects: don't track removed projects
- Date: Fri, 13 May 2016 13:57:29 +0000 (UTC)
commit 22bf0246b13ba9d6ae341cb0a9a7d697ed92d8fd
Author: Christian Hergert <chergert redhat com>
Date: Fri May 13 16:57:04 2016 +0300
recent-projects: don't track removed projects
If we discover a project has been removed, remove it from the bookmarks
file and don't display it at startup.
libide/ide-recent-projects.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-recent-projects.c b/libide/ide-recent-projects.c
index 8ff851d..36d7b16 100644
--- a/libide/ide-recent-projects.c
+++ b/libide/ide-recent-projects.c
@@ -157,8 +157,9 @@ ide_recent_projects_get_bookmarks (IdeRecentProjects *self,
static void
ide_recent_projects_load_recent (IdeRecentProjects *self)
{
- g_autoptr(GBookmarkFile) projects_file;
+ g_autoptr(GBookmarkFile) projects_file = NULL;
g_autoptr(GError) error = NULL;
+ gboolean needs_sync = FALSE;
gchar **uris;
gssize z;
@@ -200,11 +201,19 @@ ide_recent_projects_load_recent (IdeRecentProjects *self)
continue;
is_project:
+ project_file = g_file_new_for_uri (uri);
+
+ if (g_file_is_native (project_file) && !g_file_query_exists (project_file, NULL))
+ {
+ g_bookmark_file_remove_item (projects_file, uri, NULL);
+ needs_sync = TRUE;
+ continue;
+ }
+
name = g_bookmark_file_get_title (projects_file, uri, NULL);
description = g_bookmark_file_get_description (projects_file, uri, NULL);
modified = g_bookmark_file_get_modified (projects_file, uri, NULL);
last_modified_at = g_date_time_new_from_unix_local (modified);
- project_file = g_file_new_for_uri (uri);
directory = g_file_get_parent (project_file);
languages = g_ptr_array_new ();
@@ -229,7 +238,11 @@ ide_recent_projects_load_recent (IdeRecentProjects *self)
g_hash_table_insert (self->recent_uris, g_strdup (uri), NULL);
}
+
g_strfreev (uris);
+
+ if (needs_sync)
+ g_bookmark_file_to_file (projects_file, self->file_uri, NULL);
}
static GType
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]