[gnome-builder] recent-projects: work around GBookmarkFile chicanery



commit 8741800022dddeb91efd59b716c3cabb89b26507
Author: Christian Hergert <christian hergert me>
Date:   Fri Apr 22 18:25:14 2016 -0700

    recent-projects: work around GBookmarkFile chicanery
    
    If GBookmarkFile sees "file:///foo/" but we ask to remove "file:///foo"
    it will not consider them the same. So we can just add a little fallback
    to work around the issue for now.

 libide/ide-recent-projects.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-recent-projects.c b/libide/ide-recent-projects.c
index 5240836..8ff851d 100644
--- a/libide/ide-recent-projects.c
+++ b/libide/ide-recent-projects.c
@@ -480,12 +480,24 @@ ide_recent_projects_remove (IdeRecentProjects *self,
 
       if (!g_bookmark_file_remove_item (projects_file, file_uri, &error))
         {
-          g_warning ("Failed to remove recent project: %s", error->message);
+          g_autofree gchar *with_slash = g_strdup_printf ("%s/", file_uri);
+
+          /* Sometimes we don't get a match because the directory is missing a
+           * trailing slash. Annoying, I know. See the following for the
+           * upstream bug filed in GLib.
+           *
+           * https://bugzilla.gnome.org/show_bug.cgi?id=765449
+           */
+          if (!g_bookmark_file_remove_item (projects_file, with_slash, NULL))
+            {
+              g_warning ("Failed to remove recent project: %s", error->message);
+              g_clear_error (&error);
+              continue;
+            }
+
           g_clear_error (&error);
-          continue;
         }
 
-
       g_sequence_remove (iter);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]