[gnome-builder/wip/libide-merge] tune back-forward list history saving depth



commit a264a0ec0672ce4a284af23c25200ab3e6fda479
Author: Christian Hergert <christian hergert me>
Date:   Fri Mar 20 23:52:06 2015 -0700

    tune back-forward list history saving depth

 libide/ide-back-forward-list.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-back-forward-list.c b/libide/ide-back-forward-list.c
index 8cf7a50..5b3a9b4 100644
--- a/libide/ide-back-forward-list.c
+++ b/libide/ide-back-forward-list.c
@@ -28,7 +28,8 @@
 #include "ide-project.h"
 #include "ide-source-location.h"
 
-#define MAX_ITEMS_PER_FILE 10
+#define MAX_ITEMS_PER_FILE 5
+#define MAX_ITEMS_TOTAL    100
 
 struct _IdeBackForwardList
 {
@@ -527,6 +528,7 @@ add_item_string (gpointer data,
   struct {
     GHashTable *counts;
     GString *str;
+    guint count;
   } *save_state = user_data;
   guint count;
   guint line;
@@ -544,6 +546,11 @@ add_item_string (gpointer data,
   if (count >= MAX_ITEMS_PER_FILE)
     return;
 
+  if (save_state->count == MAX_ITEMS_TOTAL)
+    return;
+
+  save_state->count++;
+
   g_hash_table_replace (save_state->counts, file, GINT_TO_POINTER (++count));
 
   line = ide_source_location_get_line (item_loc);
@@ -585,7 +592,8 @@ _ide_back_forward_list_save_async (IdeBackForwardList  *self,
   struct {
     GHashTable *counts;
     GString *str;
-  } save_state;
+    guint count;
+  } save_state = { 0 };
   gsize len;
 
   g_assert (IDE_IS_BACK_FORWARD_LIST (self));


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