[sysprof/wip/chergert/timechart: 2/3] timechart: stub out timechart widget
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/chergert/timechart: 2/3] timechart: stub out timechart widget
- Date: Mon, 21 May 2018 21:11:04 +0000 (UTC)
commit 0ef64e986fcef956b91542b14e5c58e91c0c8f78
Author: Christian Hergert <chergert redhat com>
Date: Sun May 20 19:30:06 2018 -0700
timechart: stub out timechart widget
This just puts some things in place so that we can start iterating on a
timechart widget.
lib/meson.build | 1 +
lib/resources/libsysprof.gresource.xml | 1 +
lib/resources/ui/sp-timechart-view.ui | 5 ++
lib/timechart/meson.build | 16 +++++
lib/timechart/sp-timechart-view.c | 99 ++++++++++++++++++++++++++++++++
lib/timechart/sp-timechart-view.h | 31 ++++++++++
6 files changed, 153 insertions(+), 0 deletions(-)
---
diff --git a/lib/meson.build b/lib/meson.build
index 90b6a6e..4436d3b 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -52,6 +52,7 @@ subdir('capture')
subdir('profiler')
subdir('sources')
subdir('symbols')
+subdir('timechart')
subdir('util')
subdir('visualizers')
subdir('widgets')
diff --git a/lib/resources/libsysprof.gresource.xml b/lib/resources/libsysprof.gresource.xml
index 00743b6..7a2e7b7 100644
--- a/lib/resources/libsysprof.gresource.xml
+++ b/lib/resources/libsysprof.gresource.xml
@@ -19,6 +19,7 @@
<file compressed="true">ui/sp-process-model-row.ui</file>
<file compressed="true">ui/sp-profiler-menu-button.ui</file>
<file compressed="true">ui/sp-recording-state-view.ui</file>
+ <file compressed="true">ui/sp-timechart-view.ui</file>
<file compressed="true">ui/sp-visualizer-view.ui</file>
</gresource>
</gresources>
diff --git a/lib/resources/ui/sp-timechart-view.ui b/lib/resources/ui/sp-timechart-view.ui
new file mode 100644
index 0000000..520c383
--- /dev/null
+++ b/lib/resources/ui/sp-timechart-view.ui
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="SpTimechartView" parent="GtkBin">
+ </template>
+</interface>
diff --git a/lib/timechart/meson.build b/lib/timechart/meson.build
new file mode 100644
index 0000000..fbbae22
--- /dev/null
+++ b/lib/timechart/meson.build
@@ -0,0 +1,16 @@
+if get_option('enable_gtk')
+
+timechart_ui_headers = [
+ 'sp-timechart-view.h',
+]
+
+timechart_ui_sources = [
+ 'sp-timechart-view.c',
+]
+
+libsysprof_ui_headers += files(timechart_ui_headers)
+libsysprof_ui_sources += files(timechart_ui_sources)
+
+install_headers(timechart_ui_headers, subdir: join_paths(libsysprof_header_subdir, 'timechart'))
+
+endif
diff --git a/lib/timechart/sp-timechart-view.c b/lib/timechart/sp-timechart-view.c
new file mode 100644
index 0000000..d7b0f90
--- /dev/null
+++ b/lib/timechart/sp-timechart-view.c
@@ -0,0 +1,99 @@
+/* sp-timechart-view.c
+ *
+ * Copyright 2018 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/>.
+ */
+
+#define G_LOG_DOMAIN "sp-timechart-view"
+
+#include "sp-timechart-view.h"
+
+struct _SpTimechartView
+{
+ GtkBin parent_instance;
+};
+
+enum {
+ PROP_0,
+ N_PROPS
+};
+
+G_DEFINE_TYPE (SpTimechartView, sp_timechart_view, GTK_TYPE_BIN)
+
+static GParamSpec *properties [N_PROPS];
+
+static void
+sp_timechart_view_finalize (GObject *object)
+{
+ SpTimechartView *self = (SpTimechartView *)object;
+
+ G_OBJECT_CLASS (sp_timechart_view_parent_class)->finalize (object);
+}
+
+static void
+sp_timechart_view_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ SpTimechartView *self = SP_TIMECHART_VIEW (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+sp_timechart_view_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ SpTimechartView *self = SP_TIMECHART_VIEW (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+sp_timechart_view_class_init (SpTimechartViewClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ object_class->finalize = sp_timechart_view_finalize;
+ object_class->get_property = sp_timechart_view_get_property;
+ object_class->set_property = sp_timechart_view_set_property;
+
+ gtk_widget_class_set_template_from_resource (widget_class,
+ "/org/gnome/sysprof/ui/sp-timechart-view.ui");
+}
+
+static void
+sp_timechart_view_init (SpTimechartView *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+sp_timechart_view_new (void)
+{
+ return g_object_new (SP_TYPE_TIMECHART_VIEW, NULL);
+}
diff --git a/lib/timechart/sp-timechart-view.h b/lib/timechart/sp-timechart-view.h
new file mode 100644
index 0000000..e995ffc
--- /dev/null
+++ b/lib/timechart/sp-timechart-view.h
@@ -0,0 +1,31 @@
+/* sp-timechart-view.h
+ *
+ * Copyright 2018 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/>.
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define SP_TYPE_TIMECHART_VIEW (sp_timechart_view_get_type())
+
+G_DECLARE_FINAL_TYPE (SpTimechartView, sp_timechart_view, SP, TIMECHART_VIEW, GtkBin)
+
+GtkWidget *sp_timechart_view_new (void);
+
+G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]