mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: start on details view
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
|
||||
<file preprocess="xml-stripblanks">ui/sysprof-callgraph-view.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/sysprof-capture-view.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/sysprof-details-view.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/sysprof-empty-state-view.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/sysprof-failed-state-view.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/sysprof-marks-view.ui</file>
|
||||
|
||||
@ -24,6 +24,7 @@ libsysprof_ui_public_sources = [
|
||||
libsysprof_ui_private_sources = [
|
||||
'pointcache.c',
|
||||
'rectangles.c',
|
||||
'sysprof-details-view.c',
|
||||
'sysprof-cell-renderer-duration.c',
|
||||
'sysprof-cell-renderer-percent.c',
|
||||
'sysprof-theme-manager.c',
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
|
||||
#include "sysprof-callgraph-view.h"
|
||||
#include "sysprof-capture-view.h"
|
||||
#include "sysprof-details-view.h"
|
||||
#include "sysprof-marks-view.h"
|
||||
#include "sysprof-visualizer-view.h"
|
||||
|
||||
@ -45,6 +46,7 @@ typedef struct
|
||||
|
||||
/* Template Objects */
|
||||
SysprofCallgraphView *callgraph_view;
|
||||
SysprofDetailsView *details_view;
|
||||
SysprofMarksView *marks_view;
|
||||
SysprofVisualizerView *visualizer_view;
|
||||
SysprofZoomManager *zoom_manager;
|
||||
@ -485,6 +487,8 @@ sysprof_capture_view_real_load_async (SysprofCaptureView *self,
|
||||
cancellable,
|
||||
sysprof_capture_view_load_scan_cb,
|
||||
g_steal_pointer (&task));
|
||||
|
||||
sysprof_details_view_set_reader (priv->details_view, reader);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -585,6 +589,7 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-capture-view.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, callgraph_view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, details_view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, marks_view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, visualizer_view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, zoom_manager);
|
||||
@ -597,6 +602,8 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
|
||||
g_type_ensure (SYSPROF_TYPE_DETAILS_VIEW);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
91
src/libsysprof-ui/sysprof-details-view.c
Normal file
91
src/libsysprof-ui/sysprof-details-view.c
Normal file
@ -0,0 +1,91 @@
|
||||
/* sysprof-details-view.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-details-view"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "sysprof-details-view.h"
|
||||
|
||||
struct _SysprofDetailsView
|
||||
{
|
||||
GtkBin parent_instance;
|
||||
GtkLabel *filename;
|
||||
GtkLabel *start_time;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (SysprofDetailsView, sysprof_details_view, GTK_TYPE_BIN)
|
||||
|
||||
static void
|
||||
sysprof_details_view_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (sysprof_details_view_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_details_view_class_init (SysprofDetailsViewClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->finalize = sysprof_details_view_finalize;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-details-view.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, filename);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, start_time);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_details_view_init (SysprofDetailsView *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
sysprof_details_view_new (void)
|
||||
{
|
||||
return g_object_new (SYSPROF_TYPE_DETAILS_VIEW, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
sysprof_details_view_set_reader (SysprofDetailsView *self,
|
||||
SysprofCaptureReader *reader)
|
||||
{
|
||||
g_autoptr(GDateTime) dt = NULL;
|
||||
g_autoptr(GDateTime) local = NULL;
|
||||
const gchar *filename;
|
||||
const gchar *capture_at;
|
||||
|
||||
g_return_if_fail (SYSPROF_IS_DETAILS_VIEW (self));
|
||||
|
||||
if (!(filename = sysprof_capture_reader_get_filename (reader)))
|
||||
filename = _("Memory Capture");
|
||||
gtk_label_set_label (self->filename, filename);
|
||||
|
||||
if ((capture_at = sysprof_capture_reader_get_time (reader)) &&
|
||||
(dt = g_date_time_new_from_iso8601 (capture_at, NULL)) &&
|
||||
(local = g_date_time_to_local (dt)))
|
||||
{
|
||||
g_autofree gchar *str = g_date_time_format (local, "%x %X");
|
||||
gtk_label_set_label (self->start_time, str);
|
||||
}
|
||||
}
|
||||
36
src/libsysprof-ui/sysprof-details-view.h
Normal file
36
src/libsysprof-ui/sysprof-details-view.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* sysprof-details-view.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-capture.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_TYPE_DETAILS_VIEW (sysprof_details_view_get_type())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SysprofDetailsView, sysprof_details_view, SYSPROF, DETAILS_VIEW, GtkBin)
|
||||
|
||||
GtkWidget *sysprof_details_view_new (void);
|
||||
void sysprof_details_view_set_reader (SysprofDetailsView *self,
|
||||
SysprofCaptureReader *reader);
|
||||
|
||||
G_END_DECLS
|
||||
@ -126,6 +126,15 @@
|
||||
<property name="title" translatable="yes">Timings</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="SysprofDetailsView" id="details_view">
|
||||
<property name="margin">36</property>
|
||||
<property name="visible">true</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="title" translatable="yes">Details</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
113
src/libsysprof-ui/ui/sysprof-details-view.ui
Normal file
113
src/libsysprof-ui/ui/sysprof-details-view.ui
Normal file
@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.22"/>
|
||||
<template class="SysprofDetailsView" parent="GtkBin">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Filename</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Captured At</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="center">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="filename">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="start_time">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
||||
Reference in New Issue
Block a user