[gnome-builder/wip/libide] libide: plumb max results into search reducer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide] libide: plumb max results into search reducer
- Date: Wed, 18 Feb 2015 02:40:52 +0000 (UTC)
commit 6550c8d49e2fcae9ca584f3ea207dd715181a91c
Author: Christian Hergert <christian hergert me>
Date: Tue Feb 17 18:40:43 2015 -0800
libide: plumb max results into search reducer
libide/git/ide-git-search-index.c | 2 +-
libide/ide-search-reducer.c | 5 +++--
libide/ide-search-reducer.h | 3 ++-
3 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/libide/git/ide-git-search-index.c b/libide/git/ide-git-search-index.c
index 884793b..ba8bd5b 100644
--- a/libide/git/ide-git-search-index.c
+++ b/libide/git/ide-git-search-index.c
@@ -209,7 +209,7 @@ ide_git_search_index_populate (IdeGitSearchIndex *self,
/* initialize our reducer, which helps us prevent creating unnecessary
* objects that will simply be discarded */
- ide_search_reducer_init (&reducer, search_context, provider);
+ ide_search_reducer_init (&reducer, search_context, provider, max_results);
for (i = 0; i < matches->len; i++)
{
diff --git a/libide/ide-search-reducer.c b/libide/ide-search-reducer.c
index c25b6f0..4753b7c 100644
--- a/libide/ide-search-reducer.c
+++ b/libide/ide-search-reducer.c
@@ -24,7 +24,8 @@
void
ide_search_reducer_init (IdeSearchReducer *reducer,
IdeSearchContext *context,
- IdeSearchProvider *provider)
+ IdeSearchProvider *provider,
+ gsize max_results)
{
g_return_if_fail (reducer);
g_return_if_fail (IDE_IS_SEARCH_CONTEXT (context));
@@ -33,7 +34,7 @@ ide_search_reducer_init (IdeSearchReducer *reducer,
reducer->context = context;
reducer->provider = provider;
reducer->sequence = g_sequence_new (g_object_unref);
- reducer->max_results = 10;
+ reducer->max_results = max_results ?: G_MAXSIZE;
reducer->count = 0;
}
diff --git a/libide/ide-search-reducer.h b/libide/ide-search-reducer.h
index 21cd3ec..e67b689 100644
--- a/libide/ide-search-reducer.h
+++ b/libide/ide-search-reducer.h
@@ -34,7 +34,8 @@ typedef struct
void ide_search_reducer_init (IdeSearchReducer *reducer,
IdeSearchContext *context,
- IdeSearchProvider *provider);
+ IdeSearchProvider *provider,
+ gsize max_results);
gboolean ide_search_reducer_accepts (IdeSearchReducer *reducer,
gfloat score);
void ide_search_reducer_push (IdeSearchReducer *reducer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]