From c81e832a5a2363558a22a728dcd349f1c4aafb7b Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 14 Jul 2023 11:29:50 -0700 Subject: [PATCH] sysprof: stub out counters section --- .../scalable/actions/storage-symbolic.svg | 2 + src/sysprof/meson.build | 1 + src/sysprof/sysprof-counters-section.c | 68 ++++++++++++++++++ src/sysprof/sysprof-counters-section.h | 31 +++++++++ src/sysprof/sysprof-counters-section.ui | 69 +++++++++++++++++++ src/sysprof/sysprof-window.c | 2 + src/sysprof/sysprof-window.ui | 30 ++++++++ src/sysprof/sysprof.gresource.xml | 2 + 8 files changed, 205 insertions(+) create mode 100644 src/sysprof/icons/scalable/actions/storage-symbolic.svg create mode 100644 src/sysprof/sysprof-counters-section.c create mode 100644 src/sysprof/sysprof-counters-section.h create mode 100644 src/sysprof/sysprof-counters-section.ui diff --git a/src/sysprof/icons/scalable/actions/storage-symbolic.svg b/src/sysprof/icons/scalable/actions/storage-symbolic.svg new file mode 100644 index 00000000..5417b9a7 --- /dev/null +++ b/src/sysprof/icons/scalable/actions/storage-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build index accaab25..7eb71919 100644 --- a/src/sysprof/meson.build +++ b/src/sysprof/meson.build @@ -1,6 +1,7 @@ sysprof_sources = [ 'main.c', 'sysprof-application.c', + 'sysprof-counters-section.c', 'sysprof-cpu-info-dialog.c', 'sysprof-files-section.c', 'sysprof-frame-utility.c', diff --git a/src/sysprof/sysprof-counters-section.c b/src/sysprof/sysprof-counters-section.c new file mode 100644 index 00000000..5d26b104 --- /dev/null +++ b/src/sysprof/sysprof-counters-section.c @@ -0,0 +1,68 @@ +/* sysprof-counters-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 + +#include "sysprof-counters-section.h" + +struct _SysprofCountersSection +{ + SysprofSection parent_instance; +}; + +G_DEFINE_FINAL_TYPE (SysprofCountersSection, sysprof_counters_section, SYSPROF_TYPE_SECTION) + +static void +sysprof_counters_section_dispose (GObject *object) +{ + SysprofCountersSection *self = (SysprofCountersSection *)object; + + gtk_widget_dispose_template (GTK_WIDGET (self), SYSPROF_TYPE_COUNTERS_SECTION); + + G_OBJECT_CLASS (sysprof_counters_section_parent_class)->dispose (object); +} + +static void +sysprof_counters_section_class_init (SysprofCountersSectionClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->dispose = sysprof_counters_section_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-counters-section.ui"); + + g_type_ensure (SYSPROF_TYPE_CHART); + g_type_ensure (SYSPROF_TYPE_DOCUMENT_MARK); + g_type_ensure (SYSPROF_TYPE_DOCUMENT_COUNTER); + g_type_ensure (SYSPROF_TYPE_DOCUMENT_COUNTER_VALUE); + g_type_ensure (SYSPROF_TYPE_LINE_LAYER); + g_type_ensure (SYSPROF_TYPE_TIME_SERIES); + g_type_ensure (SYSPROF_TYPE_TIME_SPAN_LAYER); + g_type_ensure (SYSPROF_TYPE_XY_SERIES); +} + +static void +sysprof_counters_section_init (SysprofCountersSection *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); +} diff --git a/src/sysprof/sysprof-counters-section.h b/src/sysprof/sysprof-counters-section.h new file mode 100644 index 00000000..544fa8bc --- /dev/null +++ b/src/sysprof/sysprof-counters-section.h @@ -0,0 +1,31 @@ +/* sysprof-counters-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_COUNTERS_SECTION (sysprof_counters_section_get_type()) + +G_DECLARE_FINAL_TYPE (SysprofCountersSection, sysprof_counters_section, SYSPROF, COUNTERS_SECTION, SysprofSection) + +G_END_DECLS diff --git a/src/sysprof/sysprof-counters-section.ui b/src/sysprof/sysprof-counters-section.ui new file mode 100644 index 00000000..2f0cabbc --- /dev/null +++ b/src/sysprof/sysprof-counters-section.ui @@ -0,0 +1,69 @@ + + + + + + diff --git a/src/sysprof/sysprof-window.c b/src/sysprof/sysprof-window.c index d9b3e70c..4c27792d 100644 --- a/src/sysprof/sysprof-window.c +++ b/src/sysprof/sysprof-window.c @@ -24,6 +24,7 @@ #include +#include "sysprof-counters-section.h" #include "sysprof-cpu-info-dialog.h" #include "sysprof-files-section.h" #include "sysprof-greeter.h" @@ -412,6 +413,7 @@ sysprof_window_class_init (SysprofWindowClass *klass) gtk_widget_class_add_binding_action (widget_class, GDK_KEY_bracketleft, GDK_CONTROL_MASK, "session.seek-backward", NULL); gtk_widget_class_add_binding_action (widget_class, GDK_KEY_bracketright, GDK_CONTROL_MASK, "session.seek-forward", NULL); + g_type_ensure (SYSPROF_TYPE_COUNTERS_SECTION); g_type_ensure (SYSPROF_TYPE_DOCUMENT); g_type_ensure (SYSPROF_TYPE_FILES_SECTION); g_type_ensure (SYSPROF_TYPE_LOGS_SECTION); diff --git a/src/sysprof/sysprof-window.ui b/src/sysprof/sysprof-window.ui index 6abe341a..79af664a 100644 --- a/src/sysprof/sysprof-window.ui +++ b/src/sysprof/sysprof-window.ui @@ -143,6 +143,36 @@ + + + CPU Usage + counters + system-run-symbolic + + SysprofWindow + + + + + + Network + counters + network-transmit-receive-symbolic + + SysprofWindow + + + + + + Storage + counters + storage-symbolic + + SysprofWindow + + + auxiliary diff --git a/src/sysprof/sysprof.gresource.xml b/src/sysprof/sysprof.gresource.xml index 6ecbdc6b..37a1d126 100644 --- a/src/sysprof/sysprof.gresource.xml +++ b/src/sysprof/sysprof.gresource.xml @@ -3,6 +3,7 @@ gtk/help-overlay.ui gtk/menus.ui + sysprof-counters-section.ui sysprof-cpu-info-dialog.ui sysprof-files-section.ui sysprof-frame-utility.ui @@ -25,6 +26,7 @@ icons/scalable/actions/memory-allocations-symbolic.svg icons/scalable/actions/metadata-symbolic.svg icons/scalable/actions/process-mounts-symbolic.svg + icons/scalable/actions/storage-symbolic.svg icons/scalable/actions/system-log-symbolic.svg