[sysprof] libsysprof-ui: start on profiler assistant
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof-ui: start on profiler assistant
- Date: Wed, 29 May 2019 22:33:53 +0000 (UTC)
commit 11712643b9367cda322c933c6e1d82df48d363e2
Author: Christian Hergert <chergert redhat com>
Date: Fri May 17 23:41:16 2019 -0700
libsysprof-ui: start on profiler assistant
src/libsysprof-ui/libsysprof-ui.gresource.xml | 1 +
src/libsysprof-ui/meson.build | 2 +
src/libsysprof-ui/sysprof-profiler-assistant.c | 127 ++++++++++++
src/libsysprof-ui/sysprof-profiler-assistant.h | 37 ++++
src/libsysprof-ui/sysprof-ui.h | 1 +
src/libsysprof-ui/ui/sysprof-display.ui | 8 +
src/libsysprof-ui/ui/sysprof-process-model-row.ui | 1 +
src/libsysprof-ui/ui/sysprof-profiler-assistant.ui | 216 +++++++++++++++++++++
8 files changed, 393 insertions(+)
---
diff --git a/src/libsysprof-ui/libsysprof-ui.gresource.xml b/src/libsysprof-ui/libsysprof-ui.gresource.xml
index 849b877..3e3df45 100644
--- a/src/libsysprof-ui/libsysprof-ui.gresource.xml
+++ b/src/libsysprof-ui/libsysprof-ui.gresource.xml
@@ -17,6 +17,7 @@
<file preprocess="xml-stripblanks">ui/sysprof-failed-state-view.ui</file>
<file preprocess="xml-stripblanks">ui/sysprof-marks-view.ui</file>
<file preprocess="xml-stripblanks">ui/sysprof-process-model-row.ui</file>
+ <file preprocess="xml-stripblanks">ui/sysprof-profiler-assistant.ui</file>
<file preprocess="xml-stripblanks">ui/sysprof-profiler-menu-button.ui</file>
<file preprocess="xml-stripblanks">ui/sysprof-recording-state-view.ui</file>
<file preprocess="xml-stripblanks">ui/sysprof-tab.ui</file>
diff --git a/src/libsysprof-ui/meson.build b/src/libsysprof-ui/meson.build
index 549582b..f64f7a3 100644
--- a/src/libsysprof-ui/meson.build
+++ b/src/libsysprof-ui/meson.build
@@ -13,6 +13,7 @@ libsysprof_ui_public_sources = [
'sysprof-model-filter.c',
'sysprof-notebook.c',
'sysprof-process-model-row.c',
+ 'sysprof-profiler-assistant.c',
'sysprof-profiler-menu-button.c',
'sysprof-recording-state-view.c',
'sysprof-visualizer-list.c',
@@ -49,6 +50,7 @@ libsysprof_ui_public_headers = [
'sysprof-model-filter.h',
'sysprof-notebook.h',
'sysprof-process-model-row.h',
+ 'sysprof-profiler-assistant.h',
'sysprof-profiler-menu-button.h',
'sysprof-recording-state-view.h',
'sysprof-visualizer-list.h',
diff --git a/src/libsysprof-ui/sysprof-profiler-assistant.c b/src/libsysprof-ui/sysprof-profiler-assistant.c
new file mode 100644
index 0000000..79d1c2b
--- /dev/null
+++ b/src/libsysprof-ui/sysprof-profiler-assistant.c
@@ -0,0 +1,127 @@
+/* sysprof-profiler-assistant.c
+ *
+ * Copyright 2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "sysprof-profiler-assistant"
+
+#include "config.h"
+
+#include <sysprof.h>
+
+#include "sysprof-profiler-assistant.h"
+#include "sysprof-process-model-row.h"
+
+struct _SysprofProfilerAssistant
+{
+ GtkBin parent_instance;
+
+ /* Template Objects */
+ GtkRevealer *process_revealer;
+ GtkListBox *process_list_box;
+};
+
+G_DEFINE_TYPE (SysprofProfilerAssistant, sysprof_profiler_assistant, GTK_TYPE_BIN)
+
+/**
+ * sysprof_profiler_assistant_new:
+ *
+ * Create a new #SysprofProfilerAssistant.
+ *
+ * Returns: (transfer full): a newly created #SysprofProfilerAssistant
+ *
+ * Since: 3.34
+ */
+GtkWidget *
+sysprof_profiler_assistant_new (void)
+{
+ return g_object_new (SYSPROF_TYPE_PROFILER_ASSISTANT, NULL);
+}
+
+static GtkWidget *
+create_process_row_cb (gpointer item_,
+ gpointer user_data)
+{
+ SysprofProcessModelItem *item = item_;
+
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (item));
+
+ return sysprof_process_model_row_new (item);
+}
+
+static void
+sysprof_profiler_assistant_notify_reveal_child_cb (SysprofProfilerAssistant *self,
+ GParamSpec *pspec,
+ GtkRevealer *revealer)
+{
+ g_assert (SYSPROF_IS_PROFILER_ASSISTANT (self));
+ g_assert (GTK_IS_REVEALER (revealer));
+
+ if (gtk_revealer_get_reveal_child (revealer))
+ {
+ g_autoptr(SysprofProcessModel) model = NULL;
+
+ model = sysprof_process_model_new ();
+ gtk_list_box_bind_model (self->process_list_box,
+ G_LIST_MODEL (model),
+ create_process_row_cb,
+ NULL, NULL);
+ sysprof_process_model_reload (model);
+ }
+}
+
+static void
+sysprof_profiler_assistant_row_activated_cb (SysprofProfilerAssistant *self,
+ SysprofProcessModelRow *row,
+ GtkListBox *list_box)
+{
+ g_assert (SYSPROF_PROFILER_ASSISTANT (self));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ROW (row));
+ g_assert (GTK_IS_LIST_BOX (list_box));
+
+ sysprof_process_model_row_set_selected (row,
+ !sysprof_process_model_row_get_selected (row));
+}
+
+static void
+sysprof_profiler_assistant_class_init (SysprofProfilerAssistantClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/sysprof/ui/sysprof-profiler-assistant.ui");
+ gtk_widget_class_bind_template_child (widget_class, SysprofProfilerAssistant, process_list_box);
+ gtk_widget_class_bind_template_child (widget_class, SysprofProfilerAssistant, process_revealer);
+}
+
+static void
+sysprof_profiler_assistant_init (SysprofProfilerAssistant *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+
+ g_signal_connect_object (self->process_list_box,
+ "row-activated",
+ G_CALLBACK (sysprof_profiler_assistant_row_activated_cb),
+ self,
+ G_CONNECT_SWAPPED);
+
+ g_signal_connect_object (self->process_revealer,
+ "notify::reveal-child",
+ G_CALLBACK (sysprof_profiler_assistant_notify_reveal_child_cb),
+ self,
+ G_CONNECT_SWAPPED);
+}
diff --git a/src/libsysprof-ui/sysprof-profiler-assistant.h b/src/libsysprof-ui/sysprof-profiler-assistant.h
new file mode 100644
index 0000000..8bc6df5
--- /dev/null
+++ b/src/libsysprof-ui/sysprof-profiler-assistant.h
@@ -0,0 +1,37 @@
+/* sysprof-profiler-assistant.h
+ *
+ * Copyright 2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "sysprof-version-macros.h"
+
+G_BEGIN_DECLS
+
+#define SYSPROF_TYPE_PROFILER_ASSISTANT (sysprof_profiler_assistant_get_type())
+
+SYSPROF_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (SysprofProfilerAssistant, sysprof_profiler_assistant, SYSPROF, PROFILER_ASSISTANT,
GtkBin)
+
+SYSPROF_AVAILABLE_IN_ALL
+GtkWidget *sysprof_profiler_assistant_new (void);
+
+G_END_DECLS
diff --git a/src/libsysprof-ui/sysprof-ui.h b/src/libsysprof-ui/sysprof-ui.h
index 796690e..fa112af 100644
--- a/src/libsysprof-ui/sysprof-ui.h
+++ b/src/libsysprof-ui/sysprof-ui.h
@@ -41,6 +41,7 @@ G_BEGIN_DECLS
# include "sysprof-model-filter.h"
# include "sysprof-notebook.h"
# include "sysprof-process-model-row.h"
+# include "sysprof-profiler-assistant.h"
# include "sysprof-profiler-menu-button.h"
# include "sysprof-recording-state-view.h"
# include "sysprof-visualizer-row.h"
diff --git a/src/libsysprof-ui/ui/sysprof-display.ui b/src/libsysprof-ui/ui/sysprof-display.ui
index df0071a..7565a5d 100644
--- a/src/libsysprof-ui/ui/sysprof-display.ui
+++ b/src/libsysprof-ui/ui/sysprof-display.ui
@@ -5,6 +5,14 @@
<object class="GtkStack" id="stack">
<property name="homogeneous">false</property>
<property name="visible">true</property>
+ <child>
+ <object class="SysprofProfilerAssistant" id="assistant">
+ <property name="visible">true</property>
+ </object>
+ <packing>
+ <property name="name">assistant</property>
+ </packing>
+ </child>
<child>
<object class="SysprofEmptyStateView" id="empty_view">
<property name="title" translatable="yes">Welcome to Sysprof</property>
diff --git a/src/libsysprof-ui/ui/sysprof-process-model-row.ui
b/src/libsysprof-ui/ui/sysprof-process-model-row.ui
index 118e3d8..53ed284 100644
--- a/src/libsysprof-ui/ui/sysprof-process-model-row.ui
+++ b/src/libsysprof-ui/ui/sysprof-process-model-row.ui
@@ -4,6 +4,7 @@
<child>
<object class="GtkBox">
<property name="visible">true</property>
+ <property name="margin">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="image">
diff --git a/src/libsysprof-ui/ui/sysprof-profiler-assistant.ui
b/src/libsysprof-ui/ui/sysprof-profiler-assistant.ui
new file mode 100644
index 0000000..d499335
--- /dev/null
+++ b/src/libsysprof-ui/ui/sysprof-profiler-assistant.ui
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="3.22"/>
+ <template class="SysprofProfilerAssistant" parent="GtkBin">
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="propagate-natural-width">true</property>
+ <property name="hscrollbar-policy">never</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="DzlThreeGrid" id="three_grid">
+ <property name="margin">36</property>
+ <property name="column-spacing">12</property>
+ <property name="row-spacing">6</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">All Processes</property>
+ <property name="xalign">1.0</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="column">left</property>
+ <property name="row">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="whole_system_switch">
+ <property name="active">true</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="visible">true</property>
+ </object>
+ <packing>
+ <property name="column">center</property>
+ <property name="row">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Enabling this will request that Sysprof
generate callgraph information for all applications and the operating system kernel. This may not always be
possible depending on the system configuration.</property>
+ <property name="margin-bottom">6</property>
+ <property name="max-width-chars">10</property>
+ <property name="wrap">true</property>
+ <property name="visible">true</property>
+ <property name="xalign">0.0</property>
+ <attributes>
+ <attribute name="scale" value="0.8333"/>
+ </attributes>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRevealer" id="process_revealer">
+ <property name="reveal-child" bind-source="whole_system_switch" bind-property="active"
bind-flags="sync-create|invert-boolean"/>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkBox">
+ <property name="margin-bottom">12</property>
+ <property name="orientation">vertical</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="linked"/>
+ </style>
+ <child>
+ <object class="GtkSearchEntry">
+ <property name="placeholder-text" translatable="yes">Search Processes…</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="shadow-type">in</property>
+ <property name="hscrollbar-policy">never</property>
+ <property name="min-content-height">175</property>
+ <property name="max-content-height">175</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkListBox" id="process_list_box">
+ <property name="selection-mode">none</property>
+ <property name="visible">true</property>
+ <child type="placeholder">
+ <object class="GtkLabel">
+ <property name="margin-left">12</property>
+ <property name="margin-right">12</property>
+ <property name="label" translatable="yes">Loading Processes…</property>
+ <property name="valign">center</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="column">center</property>
+ <property name="row">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Launch Application</property>
+ <property name="xalign">1.0</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="column">left</property>
+ <property name="row">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch">
+ <property name="active">false</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="visible">true</property>
+ </object>
+ <packing>
+ <property name="column">center</property>
+ <property name="row">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton">
+ <property name="halign">start</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">view-more-symbolic</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="column">right</property>
+ <property name="row">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="homogeneous">true</property>
+ <property name="width-request">500</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="linked"/>
+ </style>
+ <child>
+ <object class="GtkRadioButton" id="whole_system">
+ <property name="draw-indicator">false</property>
+ <property name="label" translatable="yes">Existing Process</property>
+ <property name="visible">true</property>
+ <property name="hexpand">true</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="by_pid">
+ <property name="draw-indicator">false</property>
+ <property name="label" translatable="yes">New Process</property>
+ <property name="group">whole_system</property>
+ <property name="visible">true</property>
+ <property name="hexpand">true</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="column">center</property>
+ <property name="row">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="record_button">
+ <property name="label" translatable="yes">_Record</property>
+ <property name="use-underline">true</property>
+ <property name="halign">end</property>
+ <property name="margin-top">24</property>
+ <property name="width-request">125</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="column">center</property>
+ <property name="row">4</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]