[sysprof/wip/chergert/sysprof-3] libsysprof-ui: add pids to profiler



commit 8a15b7dbdeb255b8a00cfab0fc162a23974af067
Author: Christian Hergert <chergert redhat com>
Date:   Sat May 18 18:30:00 2019 -0700

    libsysprof-ui: add pids to profiler

 src/libsysprof-ui/sysprof-profiler-assistant.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/src/libsysprof-ui/sysprof-profiler-assistant.c b/src/libsysprof-ui/sysprof-profiler-assistant.c
index 0064274..9ad1d68 100644
--- a/src/libsysprof-ui/sysprof-profiler-assistant.c
+++ b/src/libsysprof-ui/sysprof-profiler-assistant.c
@@ -145,6 +145,26 @@ sysprof_profiler_assistant_command_line_changed_cb (SysprofProfilerAssistant *se
     gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_ERROR);
 }
 
+static void
+sysprof_profiler_assistant_foreach_cb (GtkWidget       *widget,
+                                       SysprofProfiler *profiler)
+{
+  g_assert (GTK_IS_WIDGET (widget));
+  g_assert (SYSPROF_IS_PROFILER (profiler));
+
+  if (SYSPROF_IS_PROCESS_MODEL_ROW (widget) &&
+      sysprof_process_model_row_get_selected (SYSPROF_PROCESS_MODEL_ROW (widget)))
+    {
+      SysprofProcessModelItem *item;
+      GPid pid;
+
+      item = sysprof_process_model_row_get_item (SYSPROF_PROCESS_MODEL_ROW (widget));
+      pid = sysprof_process_model_item_get_pid (item);
+
+      sysprof_profiler_add_pid (profiler, pid);
+    }
+}
+
 static void
 sysprof_profiler_assistant_record_clicked_cb (SysprofProfilerAssistant *self,
                                               GtkButton                *button)
@@ -158,6 +178,10 @@ sysprof_profiler_assistant_record_clicked_cb (SysprofProfilerAssistant *self,
 
   profiler = sysprof_local_profiler_new ();
 
+  /* Add pids to profiler */
+  gtk_container_foreach (GTK_CONTAINER (self->process_list_box),
+                         (GtkCallback) sysprof_profiler_assistant_foreach_cb,
+                         profiler);
 
   g_signal_emit (self, signals [START_RECORDING], 0, profiler);
 }


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