Commit 7c646611 authored by Christian Hergert's avatar Christian Hergert

libsysprof-ui: start on profiler assistant

parent d3281ad7
......@@ -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>
......
......@@ -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',
......
/* 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);
}
/* 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
......@@ -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"
......
......@@ -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>
......
......@@ -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">
......
<?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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment