[gnome-builder] libide: only load 100 recent projects



commit 3e456a8d3ec0138967631eef2c207e4cb7f7452c
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 14 16:34:18 2015 -0700

    libide: only load 100 recent projects
    
    This gives us a little bit of protection against loading a bunch of
    project infos for people with lots of checked out repositories.

 libide/ide-recent-projects.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide-recent-projects.c b/libide/ide-recent-projects.c
index decd50d..c2aad4b 100644
--- a/libide/ide-recent-projects.c
+++ b/libide/ide-recent-projects.c
@@ -39,6 +39,8 @@ struct _IdeRecentProjects
   guint         discovered : 1;
 };
 
+#define MAX_PROJECT_INFOS 100
+
 static void list_model_iface_init (GListModelInterface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (IdeRecentProjects, ide_recent_projects, G_TYPE_OBJECT,
@@ -74,7 +76,10 @@ ide_recent_projects_added (IdeRecentProjects *self,
                                        (GCompareDataFunc)ide_project_info_compare,
                                        NULL);
       position = g_sequence_iter_get_position (iter);
-      g_list_model_items_changed (G_LIST_MODEL (self), position, 0, 1);
+      if (position > MAX_PROJECT_INFOS)
+        g_sequence_remove (iter);
+      else
+        g_list_model_items_changed (G_LIST_MODEL (self), position, 0, 1);
     }
 }
 


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