[gnome-builder/wip/chergert/perspective] search: add get_count() helper for search display



commit de99d0692fdd354c2f868224da8f50fdde94c10a
Author: Christian Hergert <christian hergert me>
Date:   Tue Nov 24 17:02:14 2015 -0800

    search: add get_count() helper for search display

 libide/search/ide-omni-search-display.c |   17 +++++++++++++++++
 libide/search/ide-omni-search-display.h |    1 +
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/libide/search/ide-omni-search-display.c b/libide/search/ide-omni-search-display.c
index 8f84436..68555c2 100644
--- a/libide/search/ide-omni-search-display.c
+++ b/libide/search/ide-omni-search-display.c
@@ -596,3 +596,20 @@ ide_omni_search_display_init (IdeOmniSearchDisplay *self)
 
   gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
 }
+
+guint64
+ide_omni_search_display_get_count (IdeOmniSearchDisplay *self)
+{
+  guint64 count = 0;
+  gint i;
+
+  g_return_val_if_fail (IDE_IS_OMNI_SEARCH_DISPLAY (self), 0);
+
+  for (i = 0; i < self->providers->len; i++)
+    {
+      ProviderEntry *provider = g_ptr_array_index (self->providers, i);
+      count += ide_omni_search_group_get_count (provider->group);
+    }
+
+  return count;
+}
diff --git a/libide/search/ide-omni-search-display.h b/libide/search/ide-omni-search-display.h
index 6351924..0a3524b 100644
--- a/libide/search/ide-omni-search-display.h
+++ b/libide/search/ide-omni-search-display.h
@@ -33,6 +33,7 @@ void              ide_omni_search_display_activate    (IdeOmniSearchDisplay *dis
 IdeSearchContext *ide_omni_search_display_get_context (IdeOmniSearchDisplay *display);
 void              ide_omni_search_display_set_context (IdeOmniSearchDisplay *display,
                                                       IdeSearchContext    *context);
+guint64           ide_omni_search_display_get_count   (IdeOmniSearchDisplay *display);
 
 G_END_DECLS
 


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