[sysprof] visualizers: limit mark rows to 30



commit 0e9f4ca2912e3705679dc8f7f29f3cf7f4dfa190
Author: Christian Hergert <chergert redhat com>
Date:   Tue May 15 17:19:12 2018 +0100

    visualizers: limit mark rows to 30

 lib/visualizers/sp-visualizer-list.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/lib/visualizers/sp-visualizer-list.c b/lib/visualizers/sp-visualizer-list.c
index 5da2547..4ee6d32 100644
--- a/lib/visualizers/sp-visualizer-list.c
+++ b/lib/visualizers/sp-visualizer-list.c
@@ -243,7 +243,6 @@ handle_capture_results (GObject      *object,
 {
   SpVisualizerList *self = (SpVisualizerList *)object;
   Discovery *state;
-  GHashTableIter iter;
   const gchar *key;
 
   g_assert (SP_IS_VISUALIZER_LIST (self));
@@ -265,18 +264,23 @@ handle_capture_results (GObject      *object,
       gtk_container_add (GTK_CONTAINER (self), row);
     }
 
-  g_hash_table_iter_init (&iter, state->mark_groups);
-
-  while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
+  if (g_hash_table_size (state->mark_groups) < 30)
     {
-      GtkWidget *row = g_object_new (SP_TYPE_MARK_VISUALIZER_ROW,
-                                     "group", key,
-                                     "title", key,
-                                     "height-request", 75,
-                                     "selectable", FALSE,
-                                     "visible", TRUE,
-                                     NULL);
-      gtk_container_add (GTK_CONTAINER (self), row);
+      GHashTableIter iter;
+
+      g_hash_table_iter_init (&iter, state->mark_groups);
+
+      while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
+        {
+          GtkWidget *row = g_object_new (SP_TYPE_MARK_VISUALIZER_ROW,
+                                         "group", key,
+                                         "title", key,
+                                         "height-request", 75,
+                                         "selectable", FALSE,
+                                         "visible", TRUE,
+                                         NULL);
+          gtk_container_add (GTK_CONTAINER (self), row);
+        }
     }
 }
 


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