From 70d151b5e8c8d37bd70797b56a4acba35e2ace85 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 26 Jul 2023 17:52:50 -0700 Subject: [PATCH] sysprof: add graphics section --- .../scalable/actions/graphics-symbolic.svg | 114 +++++ src/sysprof/meson.build | 1 + src/sysprof/sysprof-energy-section.c | 1 - .../sysprof-graphics-section-counter.ui | 50 ++ src/sysprof/sysprof-graphics-section.c | 55 +++ src/sysprof/sysprof-graphics-section.h | 31 ++ src/sysprof/sysprof-graphics-section.ui | 437 ++++++++++++++++++ src/sysprof/sysprof-window.c | 2 + src/sysprof/sysprof-window.ui | 10 + src/sysprof/sysprof.gresource.xml | 3 + 10 files changed, 703 insertions(+), 1 deletion(-) create mode 100644 src/sysprof/icons/scalable/actions/graphics-symbolic.svg create mode 100644 src/sysprof/sysprof-graphics-section-counter.ui create mode 100644 src/sysprof/sysprof-graphics-section.c create mode 100644 src/sysprof/sysprof-graphics-section.h create mode 100644 src/sysprof/sysprof-graphics-section.ui diff --git a/src/sysprof/icons/scalable/actions/graphics-symbolic.svg b/src/sysprof/icons/scalable/actions/graphics-symbolic.svg new file mode 100644 index 00000000..da6cc644 --- /dev/null +++ b/src/sysprof/icons/scalable/actions/graphics-symbolic.svg @@ -0,0 +1,114 @@ + + + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build index d082314e..92d86e4e 100644 --- a/src/sysprof/meson.build +++ b/src/sysprof/meson.build @@ -18,6 +18,7 @@ sysprof_sources = [ 'sysprof-energy-section.c', 'sysprof-files-section.c', 'sysprof-frame-utility.c', + 'sysprof-graphics-section.c', 'sysprof-greeter.c', 'sysprof-line-layer.c', 'sysprof-logs-section.c', diff --git a/src/sysprof/sysprof-energy-section.c b/src/sysprof/sysprof-energy-section.c index 8de3431b..2203e0f8 100644 --- a/src/sysprof/sysprof-energy-section.c +++ b/src/sysprof/sysprof-energy-section.c @@ -81,4 +81,3 @@ sysprof_energy_section_init (SysprofEnergySection *self) gtk_column_view_sort_by_column (self->column_view, self->time_column, GTK_SORT_ASCENDING); } - diff --git a/src/sysprof/sysprof-graphics-section-counter.ui b/src/sysprof/sysprof-graphics-section-counter.ui new file mode 100644 index 00000000..99cae904 --- /dev/null +++ b/src/sysprof/sysprof-graphics-section-counter.ui @@ -0,0 +1,50 @@ + + + + diff --git a/src/sysprof/sysprof-graphics-section.c b/src/sysprof/sysprof-graphics-section.c new file mode 100644 index 00000000..30165d12 --- /dev/null +++ b/src/sysprof/sysprof-graphics-section.c @@ -0,0 +1,55 @@ +/* sysprof-graphics-section.c + * + * Copyright 2023 Christian Hergert + * + * 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 . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include "config.h" + +#include "sysprof-graphics-section.h" + +struct _SysprofGraphicsSection +{ + SysprofSection parent_instance; + + GtkColumnView *column_view; + GtkColumnViewColumn *time_column; +}; + +G_DEFINE_FINAL_TYPE (SysprofGraphicsSection, sysprof_graphics_section, SYSPROF_TYPE_SECTION) + +static void +sysprof_graphics_section_class_init (SysprofGraphicsSectionClass *klass) +{ + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-graphics-section.ui"); + + gtk_widget_class_bind_template_child (widget_class, SysprofGraphicsSection, column_view); + gtk_widget_class_bind_template_child (widget_class, SysprofGraphicsSection, time_column); +} + +static void +sysprof_graphics_section_init (SysprofGraphicsSection *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); + + gtk_column_view_sort_by_column (self->column_view, + self->time_column, + GTK_SORT_ASCENDING); +} + diff --git a/src/sysprof/sysprof-graphics-section.h b/src/sysprof/sysprof-graphics-section.h new file mode 100644 index 00000000..7965e48b --- /dev/null +++ b/src/sysprof/sysprof-graphics-section.h @@ -0,0 +1,31 @@ +/* sysprof-graphics-section.h + * + * Copyright 2023 Christian Hergert + * + * 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 . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include "sysprof-section.h" + +G_BEGIN_DECLS + +#define SYSPROF_TYPE_GRAPHICS_SECTION (sysprof_graphics_section_get_type()) + +G_DECLARE_FINAL_TYPE (SysprofGraphicsSection, sysprof_graphics_section, SYSPROF, GRAPHICS_SECTION, SysprofSection) + +G_END_DECLS diff --git a/src/sysprof/sysprof-graphics-section.ui b/src/sysprof/sysprof-graphics-section.ui new file mode 100644 index 00000000..fc345749 --- /dev/null +++ b/src/sysprof/sysprof-graphics-section.ui @@ -0,0 +1,437 @@ + + + + + + + + SysprofGraphicsSection + + + + + + exact + gtk + + + + + + + diff --git a/src/sysprof/sysprof-window.c b/src/sysprof/sysprof-window.c index c1808baf..27ad126e 100644 --- a/src/sysprof/sysprof-window.c +++ b/src/sysprof/sysprof-window.c @@ -26,6 +26,7 @@ #include "sysprof-cpu-section.h" #include "sysprof-energy-section.h" #include "sysprof-files-section.h" +#include "sysprof-graphics-section.h" #include "sysprof-greeter.h" #include "sysprof-logs-section.h" #include "sysprof-marks-section.h" @@ -416,6 +417,7 @@ sysprof_window_class_init (SysprofWindowClass *klass) g_type_ensure (SYSPROF_TYPE_DOCUMENT); g_type_ensure (SYSPROF_TYPE_ENERGY_SECTION); g_type_ensure (SYSPROF_TYPE_FILES_SECTION); + g_type_ensure (SYSPROF_TYPE_GRAPHICS_SECTION); g_type_ensure (SYSPROF_TYPE_LOGS_SECTION); g_type_ensure (SYSPROF_TYPE_MARKS_SECTION); g_type_ensure (SYSPROF_TYPE_MEMORY_SECTION); diff --git a/src/sysprof/sysprof-window.ui b/src/sysprof/sysprof-window.ui index 04611279..a907bd9e 100644 --- a/src/sysprof/sysprof-window.ui +++ b/src/sysprof/sysprof-window.ui @@ -226,6 +226,16 @@ + + + Graphics + counters + graphics-symbolic + + SysprofWindow + + + Network diff --git a/src/sysprof/sysprof.gresource.xml b/src/sysprof/sysprof.gresource.xml index a2caf973..323f1fae 100644 --- a/src/sysprof/sysprof.gresource.xml +++ b/src/sysprof/sysprof.gresource.xml @@ -6,6 +6,7 @@ icons/scalable/actions/address-layout-symbolic.svg icons/scalable/actions/empty-symbolic.svg icons/scalable/actions/energy-symbolic.svg + icons/scalable/actions/graphics-symbolic.svg icons/scalable/actions/mark-chart-symbolic.svg icons/scalable/actions/mark-table-symbolic.svg icons/scalable/actions/mark-waterfall-symbolic.svg @@ -23,6 +24,8 @@ sysprof-energy-section-counter.ui sysprof-files-section.ui sysprof-frame-utility.ui + sysprof-graphics-section.ui + sysprof-graphics-section-counter.ui sysprof-greeter.ui sysprof-logs-section.ui sysprof-mark-chart-row.ui