[gtk+] inspector: Split out a function



commit db8cdd639295b2bb24287df702b4ae6dbe7c976f
Author: Benjamin Otte <otte redhat com>
Date:   Mon Oct 13 05:30:33 2014 +0200

    inspector: Split out a function

 gtk/inspector/statistics.c |   33 ++++++++++++++++++++-------------
 1 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/gtk/inspector/statistics.c b/gtk/inspector/statistics.c
index f64c839..8d1f598 100644
--- a/gtk/inspector/statistics.c
+++ b/gtk/inspector/statistics.c
@@ -97,10 +97,27 @@ add_type_count (GtkInspectorStatistics *sl, GType type)
 }
 
 static void
-refresh_clicked (GtkWidget *button, GtkInspectorStatistics *sl)
+update_type_counts (GtkInspectorStatistics *sl)
 {
   GType type;
   gpointer class;
+
+  for (type = G_TYPE_INTERFACE; type <= G_TYPE_FUNDAMENTAL_MAX; type += G_TYPE_FUNDAMENTAL_SHIFT)
+    {
+      class = g_type_class_peek (type);
+      if (class == NULL)
+        continue;
+
+      if (!G_TYPE_IS_INSTANTIATABLE (type))
+        continue;
+
+      add_type_count (sl, type);
+    }
+}
+
+static void
+refresh_clicked (GtkWidget *button, GtkInspectorStatistics *sl)
+{
   GHashTableIter iter;
   TypeData *data;
   GtkTreeIter treeiter;
@@ -123,17 +140,7 @@ refresh_clicked (GtkWidget *button, GtkInspectorStatistics *sl)
       gtk_tree_view_column_set_visible (sl->priv->column_cumulative1, TRUE);
     }
 
-  for (type = G_TYPE_INTERFACE; type <= G_TYPE_FUNDAMENTAL_MAX; type += G_TYPE_FUNDAMENTAL_SHIFT)
-    {
-      class = g_type_class_peek (type);
-      if (class == NULL)
-        continue;
-
-      if (!G_TYPE_IS_INSTANTIATABLE (type))
-        continue;
-
-      add_type_count (sl, type);
-    }
+  update_type_counts (sl);
 
   gtk_list_store_clear (GTK_LIST_STORE (sl->priv->model));
 
@@ -244,7 +251,7 @@ gtk_inspector_statistics_init (GtkInspectorStatistics *sl)
   sl->priv->counts = g_hash_table_new_full (NULL, NULL, NULL, g_free);
 
   if (has_instance_counts ())
-    add_type_count (sl, G_TYPE_OBJECT);
+    update_type_counts (sl);
   else
     gtk_stack_set_visible_child_name (GTK_STACK (sl->priv->stack), "excuse");
 }


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