From 958f428946c423f343eb5c8e2f8ba6cadc70e383 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sat, 18 May 2019 18:30:00 -0700 Subject: [PATCH] libsysprof-ui: add pids to profiler --- .../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 00642746..9ad1d681 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); }