build: remove dead code

This commit is contained in:
Christian Hergert
2019-06-25 10:01:52 -07:00
parent 2035c7e086
commit 7e403af624
12 changed files with 0 additions and 2785 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
/* sysprof-callgraph-view.h
*
* Copyright 2016-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.h>
G_BEGIN_DECLS
#define SYSPROF_TYPE_CALLGRAPH_VIEW (sysprof_callgraph_view_get_type())
G_DECLARE_DERIVABLE_TYPE (SysprofCallgraphView, sysprof_callgraph_view, SYSPROF, CALLGRAPH_VIEW, GtkBin)
struct _SysprofCallgraphViewClass
{
GtkBinClass parent_class;
void (*go_previous) (SysprofCallgraphView *self);
};
GtkWidget *sysprof_callgraph_view_new (void);
SysprofCallgraphProfile *sysprof_callgraph_view_get_profile (SysprofCallgraphView *self);
void sysprof_callgraph_view_set_profile (SysprofCallgraphView *self,
SysprofCallgraphProfile *profile);
gchar *sysprof_callgraph_view_screenshot (SysprofCallgraphView *self);
guint sysprof_callgraph_view_get_n_functions (SysprofCallgraphView *self);
G_END_DECLS

View File

@ -1,235 +0,0 @@
<interface>
<template class="SysprofCallgraphView" parent="GtkBin">
<child>
<object class="GtkStack" id="stack">
<property name="visible">true</property>
<child>
<object class="GtkPaned">
<property name="orientation">horizontal</property>
<property name="position">450</property>
<property name="visible">true</property>
<child>
<object class="GtkPaned">
<property name="orientation">vertical</property>
<property name="visible">true</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">true</property>
<child>
<object class="GtkTreeView" id="functions_view">
<property name="fixed-height-mode">true</property>
<property name="visible">true</property>
<child>
<object class="GtkTreeViewColumn" id="function_name_column">
<property name="expand">true</property>
<property name="sizing">fixed</property>
<property name="sort-column-id">0</property>
<property name="title" translatable="yes">Functions</property>
<child>
<object class="GtkCellRendererText">
<property name="ellipsize">middle</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="function_self_column">
<property name="expand">false</property>
<property name="sizing">fixed</property>
<property name="sort-column-id">1</property>
<property name="title" translatable="yes">Self</property>
<child>
<object class="SysprofCellRendererPercent">
<property name="width">65</property>
</object>
<attributes>
<attribute name="percent">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="function_total_column">
<property name="expand">false</property>
<property name="sizing">fixed</property>
<property name="sort-column-id">2</property>
<property name="title" translatable="yes">Total</property>
<child>
<object class="SysprofCellRendererPercent">
<property name="width">65</property>
</object>
<attributes>
<attribute name="percent">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="resize">true</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">true</property>
<child>
<object class="GtkTreeView" id="callers_view">
<property name="visible">true</property>
<child>
<object class="GtkTreeViewColumn" id="callers_name_column">
<property name="expand">true</property>
<property name="sizing">fixed</property>
<property name="sort-column-id">0</property>
<property name="title" translatable="yes">Callers</property>
<child>
<object class="GtkCellRendererText">
<property name="ellipsize">middle</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="callers_self_column">
<property name="expand">false</property>
<property name="sizing">fixed</property>
<property name="sort-column-id">1</property>
<property name="title" translatable="yes">Self</property>
<child>
<object class="SysprofCellRendererPercent">
<property name="width">65</property>
</object>
<attributes>
<attribute name="percent">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="callers_total_column">
<property name="expand">false</property>
<property name="sizing">fixed</property>
<property name="sort-column-id">2</property>
<property name="title" translatable="yes">Total</property>
<child>
<object class="SysprofCellRendererPercent">
<property name="width">65</property>
</object>
<attributes>
<attribute name="percent">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="resize">true</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">true</property>
<child>
<object class="GtkTreeView" id="descendants_view">
<property name="visible">true</property>
<child>
<object class="GtkTreeViewColumn" id="descendants_name_column">
<property name="expand">true</property>
<property name="sizing">autosize</property>
<property name="sort-column-id">0</property>
<property name="title" translatable="yes">Descendants</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="descendants_self_column">
<property name="expand">false</property>
<property name="sizing">fixed</property>
<property name="sort-column-id">1</property>
<property name="title" translatable="yes">Self</property>
<child>
<object class="SysprofCellRendererPercent">
<property name="width">65</property>
</object>
<attributes>
<attribute name="percent">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="descendants_total_column">
<property name="expand">false</property>
<property name="sizing">fixed</property>
<property name="sort-column-id">2</property>
<property name="title" translatable="yes">Total</property>
<child>
<object class="SysprofCellRendererPercent">
<property name="width">65</property>
</object>
<attributes>
<attribute name="percent">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="function_hits_column">
<property name="expand">false</property>
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Hits</property>
<child>
<object class="GtkCellRendererText">
<property name="xalign">1.0</property>
</object>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">callgraph</property>
</packing>
</child>
<child>
<object class="SysprofEmptyStateView">
<property name="icon-name">content-loading-symbolic</property>
<property name="title" translatable="yes">Generating Callgraph</property>
<property name="subtitle" translatable="yes">Sysprof is busy creating the selected callgraph.</property>
<property name="visible">true</property>
</object>
<packing>
<property name="name">loading</property>
</packing>
</child>
<child>
<object class="SysprofEmptyStateView">
<property name="icon-name">computer-fail-symbolic</property>
<property name="title" translatable="yes">Not Enough Samples</property>
<property name="subtitle" translatable="yes">More samples are necessary to display a callgraph.</property>
<property name="visible">false</property>
</object>
<packing>
<property name="name">empty-state</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -1,308 +0,0 @@
/* 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
*/
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#define G_LOG_DOMAIN "sysprof-details-view"
#include "config.h"
#include <dazzle.h>
#include <glib/gi18n.h>
#include <string.h>
#include "sysprof-details-view.h"
#include "sysprof-ui-private.h"
#define NSEC_PER_SEC (G_USEC_PER_SEC * 1000L)
struct _SysprofDetailsView
{
GtkBin parent_instance;
/* Template Objects */
DzlThreeGrid *three_grid;
GtkListStore *marks_store;
GtkTreeView *marks_view;
GtkLabel *counters;
GtkLabel *duration;
GtkLabel *filename;
GtkLabel *forks;
GtkLabel *marks;
GtkLabel *processes;
GtkLabel *samples;
GtkLabel *start_time;
GtkLabel *cpu_label;
guint next_row;
};
G_DEFINE_TYPE (SysprofDetailsView, sysprof_details_view, GTK_TYPE_BIN)
#if GLIB_CHECK_VERSION(2, 56, 0)
# define _g_date_time_new_from_iso8601 g_date_time_new_from_iso8601
#else
static GDateTime *
_g_date_time_new_from_iso8601 (const gchar *str,
GTimeZone *default_tz)
{
GTimeVal tv;
if (g_time_val_from_iso8601 (str, &tv))
{
g_autoptr(GDateTime) dt = g_date_time_new_from_timeval_utc (&tv);
if (default_tz)
return g_date_time_to_timezone (dt, default_tz);
else
return g_steal_pointer (&dt);
}
return NULL;
}
#endif
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, counters);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, cpu_label);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, duration);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, filename);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, forks);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, marks);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, marks_store);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, marks_view);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, processes);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, samples);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, start_time);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, three_grid);
g_type_ensure (DZL_TYPE_THREE_GRID);
}
static void
sysprof_details_view_init (SysprofDetailsView *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (self->marks_view),
GTK_SELECTION_MULTIPLE);
self->next_row = 8;
}
GtkWidget *
sysprof_details_view_new (void)
{
return g_object_new (SYSPROF_TYPE_DETAILS_VIEW, NULL);
}
static void
update_cpu_info_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
g_autoptr(SysprofDetailsView) self = user_data;
g_autofree gchar *str = NULL;
g_assert (SYSPROF_IS_DETAILS_VIEW (self));
g_assert (G_IS_TASK (result));
if ((str = g_task_propagate_pointer (G_TASK (result), NULL)))
gtk_label_set_label (self->cpu_label, str);
}
static gboolean
cpu_info_cb (const SysprofCaptureFrame *frame,
gpointer user_data)
{
const SysprofCaptureFileChunk *fc = (gpointer)frame;
const gchar *endptr;
const gchar *line;
gchar **str = user_data;
endptr = (gchar *)fc->data + fc->len;
line = memmem ((gchar *)fc->data, fc->len, "model name", 10);
endptr = memchr (line, '\n', endptr - line);
if (endptr)
{
gchar *tmp = *str = g_strndup (line, endptr - line);
for (; *tmp && *tmp != ':'; tmp++)
*tmp = ' ';
if (*tmp == ':')
*tmp = ' ';
g_strstrip (*str);
return FALSE;
}
return TRUE;
}
static void
sysprof_details_view_update_cpu_info_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
SysprofCaptureCursor *cursor = task_data;
gchar *str = NULL;
g_assert (G_IS_TASK (task));
g_assert (cursor != NULL);
sysprof_capture_cursor_foreach (cursor, cpu_info_cb, &str);
g_task_return_pointer (task, g_steal_pointer (&str), g_free);
}
static void
sysprof_details_view_update_cpu_info (SysprofDetailsView *self,
SysprofCaptureReader *reader)
{
g_autoptr(SysprofCaptureCursor) cursor = NULL;
g_autoptr(GTask) task = NULL;
g_assert (SYSPROF_IS_DETAILS_VIEW (self));
g_assert (reader != NULL);
cursor = sysprof_capture_cursor_new (reader);
sysprof_capture_cursor_add_condition (cursor,
sysprof_capture_condition_new_where_file ("/proc/cpuinfo"));
task = g_task_new (NULL, NULL, update_cpu_info_cb, g_object_ref (self));
g_task_set_task_data (task,
g_steal_pointer (&cursor),
(GDestroyNotify) sysprof_capture_cursor_unref);
g_task_run_in_thread (task, sysprof_details_view_update_cpu_info_worker);
}
void
sysprof_details_view_set_reader (SysprofDetailsView *self,
SysprofCaptureReader *reader)
{
g_autoptr(GDateTime) dt = NULL;
g_autoptr(GDateTime) local = NULL;
g_autofree gchar *duration_str = NULL;
const gchar *filename;
const gchar *capture_at;
SysprofCaptureStat st_buf;
gint64 duration;
g_return_if_fail (SYSPROF_IS_DETAILS_VIEW (self));
g_return_if_fail (reader != NULL);
sysprof_details_view_update_cpu_info (self, reader);
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);
}
duration = sysprof_capture_reader_get_end_time (reader) -
sysprof_capture_reader_get_start_time (reader);
duration_str = g_strdup_printf (_("%0.4lf seconds"), duration / (gdouble)NSEC_PER_SEC);
gtk_label_set_label (self->duration, duration_str);
if (sysprof_capture_reader_get_stat (reader, &st_buf))
{
#define SET_FRAME_COUNT(field, TYPE) \
G_STMT_START { \
g_autofree gchar *str = NULL; \
str = g_strdup_printf ("%"G_GSIZE_FORMAT, st_buf.frame_count[TYPE]); \
gtk_label_set_label (self->field, str); \
} G_STMT_END
SET_FRAME_COUNT (samples, SYSPROF_CAPTURE_FRAME_SAMPLE);
SET_FRAME_COUNT (marks, SYSPROF_CAPTURE_FRAME_MARK);
SET_FRAME_COUNT (processes, SYSPROF_CAPTURE_FRAME_PROCESS);
SET_FRAME_COUNT (forks, SYSPROF_CAPTURE_FRAME_FORK);
SET_FRAME_COUNT (counters, SYSPROF_CAPTURE_FRAME_CTRSET);
#undef SET_FRAME_COUNT
}
}
void
sysprof_details_view_add_item (SysprofDetailsView *self,
GtkWidget *left,
GtkWidget *center)
{
g_return_if_fail (SYSPROF_IS_DETAILS_VIEW (self));
g_return_if_fail (!left || GTK_IS_WIDGET (left));
g_return_if_fail (!center || GTK_IS_WIDGET (center));
if (left)
gtk_container_add_with_properties (GTK_CONTAINER (self->three_grid), left,
"row", self->next_row,
"column", DZL_THREE_GRID_COLUMN_LEFT,
NULL);
if (center)
gtk_container_add_with_properties (GTK_CONTAINER (self->three_grid), center,
"row", self->next_row,
"column", DZL_THREE_GRID_COLUMN_CENTER,
NULL);
self->next_row++;
}
void
sysprof_details_view_add_mark (SysprofDetailsView *self,
const gchar *mark,
gint64 min,
gint64 max,
gint64 avg,
gint64 hits)
{
GtkTreeIter iter;
g_return_if_fail (SYSPROF_IS_DETAILS_VIEW (self));
gtk_list_store_append (self->marks_store, &iter);
gtk_list_store_set (self->marks_store, &iter,
0, mark,
1, min ? _sysprof_format_duration (min) : "",
2, max ? _sysprof_format_duration (max) : "",
3, avg ? _sysprof_format_duration (avg) : "",
4, hits,
-1);
}

View File

@ -1,45 +0,0 @@
/* 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);
void sysprof_details_view_add_mark (SysprofDetailsView *self,
const gchar *mark,
gint64 min,
gint64 max,
gint64 avg,
gint64 hits);
void sysprof_details_view_add_item (SysprofDetailsView *self,
GtkWidget *left,
GtkWidget *center);
G_END_DECLS

View File

@ -1,372 +0,0 @@
<?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="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="propagate-natural-height">true</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="visible">true</property>
<property name="label" translatable="yes">Filename</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">true</property>
<property name="label" translatable="yes">Captured at</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Duration</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">CPU Model</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="margin-top">12</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Samples Captured</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Marks Captured</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Processes Captured</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">6</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Forks Captured</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">7</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="margin-bottom">12</property>
<property name="label" translatable="yes">Counters Captured</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">8</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="filename">
<property name="width-chars">35</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">start</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="column">1</property>
<property name="row">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>
<property name="selectable">True</property>
</object>
<packing>
<property name="column">center</property>
<property name="row">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="duration">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="column">center</property>
<property name="row">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="cpu_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">end</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="column">center</property>
<property name="row">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="samples">
<property name="margin-top">12</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">start</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="column">center</property>
<property name="row">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="marks">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">start</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="column">center</property>
<property name="row">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="processes">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">start</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="column">center</property>
<property name="row">6</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="forks">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">start</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="column">center</property>
<property name="row">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="counters">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">start</property>
<property name="margin-bottom">12</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="column">center</property>
<property name="row">8</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="shadow-type">in</property>
<property name="margin-bottom">12</property>
<child>
<object class="GtkTreeView" id="marks_view">
<property name="model">marks_store</property>
<property name="width-request">500</property>
<property name="height-request">100</property>
<property name="enable-grid-lines">both</property>
<property name="visible">true</property>
<child>
<object class="GtkTreeViewColumn">
<property name="expand">true</property>
<property name="title" translatable="yes">Mark</property>
<child>
<object class="GtkCellRendererText">
<property name="xalign">0.0</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Hits</property>
<child>
<object class="GtkCellRendererText">
<property name="xalign">0.0</property>
</object>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Min</property>
<child>
<object class="GtkCellRendererText">
<property name="xalign">0.0</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Max</property>
<child>
<object class="GtkCellRendererText">
<property name="xalign">0.0</property>
</object>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Avg</property>
<child>
<object class="GtkCellRendererText">
<property name="xalign">0.0</property>
</object>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="column">center</property>
<property name="row">9</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</template>
<object class="GtkListStore" id="marks_store">
<columns>
<!-- column-name Mark -->
<column type="gchararray"/>
<!-- column-name Min -->
<column type="gchararray"/>
<!-- column-name Max -->
<column type="gchararray"/>
<!-- column-name Avg -->
<column type="gchararray"/>
<!-- column-name Hits -->
<column type="gint64"/>
</columns>
</object>
</interface>

View File

@ -1,219 +0,0 @@
/* sysprof-empty-state-view.c
*
* Copyright 2016-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-empty-state-view"
#include "config.h"
#include <string.h>
#include "sysprof-empty-state-view.h"
typedef struct
{
GtkImage *image;
GtkLabel *title;
GtkLabel *subtitle;
} SysprofEmptyStateViewPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (SysprofEmptyStateView, sysprof_empty_state_view, GTK_TYPE_BIN)
enum {
PROP_0,
PROP_TITLE,
PROP_SUBTITLE,
PROP_ICON_NAME,
N_PROPS
};
static GParamSpec *properties [N_PROPS];
GtkWidget *
sysprof_empty_state_view_new (void)
{
return g_object_new (SYSPROF_TYPE_EMPTY_STATE_VIEW, NULL);
}
static gboolean
sysprof_empty_state_view_action (GtkWidget *widget,
const gchar *prefix,
const gchar *action_name,
GVariant *parameter)
{
GtkWidget *toplevel;
GApplication *app;
GActionGroup *group = NULL;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (prefix, FALSE);
g_return_val_if_fail (action_name, FALSE);
app = g_application_get_default ();
toplevel = gtk_widget_get_toplevel (widget);
while ((group == NULL) && (widget != NULL))
{
group = gtk_widget_get_action_group (widget, prefix);
widget = gtk_widget_get_parent (widget);
}
if (!group && g_str_equal (prefix, "win") && G_IS_ACTION_GROUP (toplevel))
group = G_ACTION_GROUP (toplevel);
if (!group && g_str_equal (prefix, "app") && G_IS_ACTION_GROUP (app))
group = G_ACTION_GROUP (app);
if (group && g_action_group_has_action (group, action_name))
{
g_action_group_activate_action (group, action_name, parameter);
return TRUE;
}
if (parameter && g_variant_is_floating (parameter))
{
parameter = g_variant_ref_sink (parameter);
g_variant_unref (parameter);
}
g_warning ("Failed to locate action %s.%s", prefix, action_name);
return FALSE;
}
static gboolean
sysprof_empty_state_view_activate_link (SysprofEmptyStateView *self,
const gchar *uri,
GtkLabel *label)
{
g_assert (SYSPROF_IS_EMPTY_STATE_VIEW (self));
g_assert (uri != NULL);
g_assert (GTK_IS_LABEL (label));
if (g_str_has_prefix (uri, "action://"))
{
g_autofree gchar *full_name = NULL;
g_autofree gchar *action_name = NULL;
g_autofree gchar *group_name = NULL;
g_autoptr(GVariant) param = NULL;
g_autoptr(GError) error = NULL;
uri += strlen ("action://");
if (g_action_parse_detailed_name (uri, &full_name, &param, &error))
{
const gchar *dot = strchr (full_name, '.');
if (param != NULL && g_variant_is_floating (param))
param = g_variant_ref_sink (param);
if (dot == NULL)
return FALSE;
group_name = g_strndup (full_name, dot - full_name);
action_name = g_strdup (++dot);
sysprof_empty_state_view_action (GTK_WIDGET (self),
group_name,
action_name,
param);
return TRUE;
}
else
g_warning ("%s", error->message);
}
return FALSE;
}
static void
sysprof_empty_state_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SysprofEmptyStateView *self = SYSPROF_EMPTY_STATE_VIEW (object);
SysprofEmptyStateViewPrivate *priv = sysprof_empty_state_view_get_instance_private (self);
switch (prop_id)
{
case PROP_ICON_NAME:
g_object_set (priv->image,
"icon-name", g_value_get_string (value),
NULL);
break;
case PROP_TITLE:
gtk_label_set_label (priv->title, g_value_get_string (value));
break;
case PROP_SUBTITLE:
gtk_label_set_label (priv->subtitle, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
sysprof_empty_state_view_class_init (SysprofEmptyStateViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->set_property = sysprof_empty_state_view_set_property;
properties [PROP_ICON_NAME] =
g_param_spec_string ("icon-name", NULL, NULL,
NULL,
(G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
properties [PROP_TITLE] =
g_param_spec_string ("title", NULL, NULL,
NULL,
(G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
properties [PROP_SUBTITLE] =
g_param_spec_string ("subtitle", NULL, NULL,
NULL,
(G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-empty-state-view.ui");
gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, subtitle);
gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, title);
gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, image);
}
static void
sysprof_empty_state_view_init (SysprofEmptyStateView *self)
{
SysprofEmptyStateViewPrivate *priv = sysprof_empty_state_view_get_instance_private (self);
gtk_widget_init_template (GTK_WIDGET (self));
g_signal_connect_object (priv->subtitle,
"activate-link",
G_CALLBACK (sysprof_empty_state_view_activate_link),
self,
G_CONNECT_SWAPPED);
}

View File

@ -1,41 +0,0 @@
/* sysprof-empty-state-view.h
*
* Copyright 2016-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.h>
G_BEGIN_DECLS
#define SYSPROF_TYPE_EMPTY_STATE_VIEW (sysprof_empty_state_view_get_type())
G_DECLARE_DERIVABLE_TYPE (SysprofEmptyStateView, sysprof_empty_state_view, SYSPROF, EMPTY_STATE_VIEW, GtkBin)
struct _SysprofEmptyStateViewClass
{
GtkBinClass parent;
gpointer padding[4];
};
GtkWidget *sysprof_empty_state_view_new (void);
G_END_DECLS

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="SysprofEmptyStateView" parent="GtkBin">
<child>
<object class="GtkBox">
<property name="border-width">36</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="visible">true</property>
<child type="center">
<object class="GtkImage" id="image">
<property name="icon-name">org.gnome.Sysprof-symbolic</property>
<property name="pixel-size">192</property>
<property name="visible">true</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="title">
<property name="label" translatable="yes">Welcome to Sysprof</property>
<property name="visible">true</property>
<style>
<class name="dim-label"/>
</style>
<attributes>
<attribute name="scale" value="2"/>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="pack-type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="subtitle">
<property name="label" translatable="yes">Start profiling your system with the &lt;b&gt;Record&lt;/b&gt; button above</property>
<property name="use-markup">true</property>
<property name="visible">true</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="vexpand">true</property>
<property name="visible">true</property>
</object>
<packing>
<property name="position">0</property>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -1,112 +0,0 @@
/* sysprof-logs-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-logs-view"
#include "config.h"
#include "sysprof-log-model.h"
#include "sysprof-logs-view.h"
struct _SysprofLogsView
{
GtkBin parent_instance;
GtkTreeView *tree_view;
};
G_DEFINE_TYPE (SysprofLogsView, sysprof_logs_view, GTK_TYPE_BIN)
static void
sysprof_logs_view_class_init (SysprofLogsViewClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-logs-view.ui");
gtk_widget_class_bind_template_child (widget_class, SysprofLogsView, tree_view);
}
static void
sysprof_logs_view_init (SysprofLogsView *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
}
static void
sysprof_logs_view_load_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
g_autoptr(SysprofLogModel) model = NULL;
g_autoptr(GTask) task = user_data;
g_autoptr(GError) error = NULL;
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (G_IS_TASK (task));
if (!(model = sysprof_log_model_new_finish (result, &error)))
{
g_task_return_error (task, g_steal_pointer (&error));
}
else
{
SysprofLogsView *self;
self = g_task_get_source_object (task);
gtk_tree_view_set_model (GTK_TREE_VIEW (self->tree_view), GTK_TREE_MODEL (model));
g_task_return_boolean (task, TRUE);
}
}
void
sysprof_logs_view_load_async (SysprofLogsView *self,
SysprofCaptureReader *reader,
SysprofSelection *selection,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
g_return_if_fail (SYSPROF_IS_LOGS_VIEW (self));
g_return_if_fail (reader != NULL);
g_return_if_fail (!selection || SYSPROF_IS_SELECTION (selection));
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, sysprof_logs_view_load_async);
sysprof_log_model_new_async (reader,
selection,
cancellable,
sysprof_logs_view_load_cb,
g_steal_pointer (&task));
}
gboolean
sysprof_logs_view_load_finish (SysprofLogsView *self,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (SYSPROF_IS_LOGS_VIEW (self), FALSE);
g_return_val_if_fail (G_IS_TASK (result), FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}

View File

@ -1,43 +0,0 @@
/* sysprof-logs-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-log-model.h"
G_BEGIN_DECLS
#define SYSPROF_TYPE_LOGS_VIEW (sysprof_logs_view_get_type())
G_DECLARE_FINAL_TYPE (SysprofLogsView, sysprof_logs_view, SYSPROF, LOGS_VIEW, GtkBin)
void sysprof_logs_view_load_async (SysprofLogsView *self,
SysprofCaptureReader *reader,
SysprofSelection *selection,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean sysprof_logs_view_load_finish (SysprofLogsView *self,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="SysprofLogsView" parent="GtkBin">
<child>
<object class="GtkScrolledWindow">
<property name="visible">true</property>
<child>
<object class="GtkTreeView" id="tree_view">
<property name="tooltip-column">3</property>
<property name="headers-visible">true</property>
<property name="visible">true</property>
<child>
<object class="GtkTreeViewColumn">
<property name="expand">false</property>
<property name="title" translatable="yes">Time</property>
<child>
<object class="GtkCellRendererText">
<property name="xalign">0.0</property>
</object>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="expand">false</property>
<property name="title" translatable="yes">Severity</property>
<child>
<object class="GtkCellRendererText">
<property name="xalign">0.0</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="expand">false</property>
<property name="resizable">true</property>
<property name="title" translatable="yes">Domain</property>
<child>
<object class="GtkCellRendererText">
<property name="xalign">0.0</property>
</object>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="expand">true</property>
<property name="title" translatable="yes">Message</property>
<child>
<object class="GtkCellRendererText">
<property name="ellipsize">end</property>
<property name="xalign">0.0</property>
</object>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>