build: rename all symbols to use sysprof_ as prefix

As we gain in usage, we need to be more careful about using a prefix
that will not collide with other symbols. So version 3 of our ABI will
change to using Sysprof/SYSPROF/sysprof as the various prefixes.

The soname/api version bump will happen later on this branch so that
things are easier to test up until then.
This commit is contained in:
Christian Hergert
2019-05-08 12:03:46 -07:00
parent 4821883bfa
commit 53c718b708
143 changed files with 5792 additions and 5789 deletions

View File

@ -1,49 +1,49 @@
libsysprof_ui_public_sources = [
'sp-callgraph-view.c',
'sp-color-cycle.c',
'sp-cpu-visualizer-row.c',
'sp-empty-state-view.c',
'sp-failed-state-view.c',
'sp-line-visualizer-row.c',
'sp-mark-visualizer-row.c',
'sp-model-filter.c',
'sp-multi-paned.c',
'sp-process-model-row.c',
'sp-profiler-menu-button.c',
'sp-recording-state-view.c',
'sp-visualizer-list.c',
'sp-visualizer-row.c',
'sp-visualizer-ticks.c',
'sp-visualizer-view.c',
'sp-zoom-manager.c',
'sysprof-callgraph-view.c',
'sysprof-color-cycle.c',
'sysprof-cpu-visualizer-row.c',
'sysprof-empty-state-view.c',
'sysprof-failed-state-view.c',
'sysprof-line-visualizer-row.c',
'sysprof-mark-visualizer-row.c',
'sysprof-model-filter.c',
'sysprof-multi-paned.c',
'sysprof-process-model-row.c',
'sysprof-profiler-menu-button.c',
'sysprof-recording-state-view.c',
'sysprof-visualizer-list.c',
'sysprof-visualizer-row.c',
'sysprof-visualizer-ticks.c',
'sysprof-visualizer-view.c',
'sysprof-zoom-manager.c',
]
libsysprof_ui_private_sources = [
'pointcache.c',
'rectangles.c',
'sp-cell-renderer-percent.c',
'sp-theme-manager.c',
'sysprof-cell-renderer-percent.c',
'sysprof-theme-manager.c',
'../stackstash.c',
]
libsysprof_ui_public_headers = [
'sp-callgraph-view.h',
'sp-cell-renderer-percent.h',
'sp-cpu-visualizer-row.h',
'sp-empty-state-view.h',
'sp-failed-state-view.h',
'sp-line-visualizer-row.h',
'sp-mark-visualizer-row.h',
'sp-model-filter.h',
'sp-multi-paned.h',
'sp-process-model-row.h',
'sp-profiler-menu-button.h',
'sp-recording-state-view.h',
'sp-visualizer-list.h',
'sp-visualizer-row.h',
'sp-visualizer-ticks.h',
'sp-visualizer-view.h',
'sp-zoom-manager.h',
'sysprof-callgraph-view.h',
'sysprof-cell-renderer-percent.h',
'sysprof-cpu-visualizer-row.h',
'sysprof-empty-state-view.h',
'sysprof-failed-state-view.h',
'sysprof-line-visualizer-row.h',
'sysprof-mark-visualizer-row.h',
'sysprof-model-filter.h',
'sysprof-multi-paned.h',
'sysprof-process-model-row.h',
'sysprof-profiler-menu-button.h',
'sysprof-recording-state-view.h',
'sysprof-visualizer-list.h',
'sysprof-visualizer-row.h',
'sysprof-visualizer-ticks.h',
'sysprof-visualizer-view.h',
'sysprof-zoom-manager.h',
'sysprof-ui.h',
]

View File

@ -19,8 +19,8 @@
*/
#include "rectangles.h"
#include "sp-color-cycle.h"
#include "sp-visualizer-row.h"
#include "sysprof-color-cycle.h"
#include "sysprof-visualizer-row.h"
typedef struct
{
@ -37,7 +37,7 @@ struct _Rectangles
GArray *rectangles;
GHashTable *y_indexes;
GHashTable *colors;
SpColorCycle *cycle;
SysprofColorCycle *cycle;
gint64 begin_time;
gint64 end_time;
guint sorted : 1;
@ -54,7 +54,7 @@ rectangles_new (gint64 begin_time,
self->rectangles = g_array_new (FALSE, FALSE, sizeof (Rectangle));
self->y_indexes = g_hash_table_new (g_str_hash, g_str_equal);
self->colors = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
self->cycle = sp_color_cycle_new ();
self->cycle = sysprof_color_cycle_new ();
self->begin_time = begin_time;
self->end_time = end_time;
self->sorted = FALSE;
@ -97,7 +97,7 @@ rectangles_free (Rectangles *self)
g_array_unref (self->rectangles);
g_hash_table_unref (self->colors);
g_hash_table_unref (self->y_indexes);
sp_color_cycle_unref (self->cycle);
sysprof_color_cycle_unref (self->cycle);
g_slice_free (Rectangles, self);
}
@ -137,7 +137,7 @@ rectangles_sort (Rectangles *self)
{
GdkRGBA rgba;
sp_color_cycle_next (self->cycle, &rgba);
sysprof_color_cycle_next (self->cycle, &rgba);
g_hash_table_insert (self->y_indexes, (gchar *)rect->name, GUINT_TO_POINTER (++sequence));
g_hash_table_insert (self->colors, (gchar *)rect->name, g_memdup (&rgba, sizeof rgba));
}
@ -156,7 +156,7 @@ rectangles_draw (Rectangles *self,
guint n_rows;
g_assert (self != NULL);
g_assert (SP_IS_VISUALIZER_ROW (row));
g_assert (SYSPROF_IS_VISUALIZER_ROW (row));
g_assert (cr != NULL);
if (!self->sorted)
@ -173,8 +173,8 @@ rectangles_draw (Rectangles *self,
{
Rectangle *rect = &g_array_index (self->rectangles, Rectangle, i);
guint y_index = GPOINTER_TO_UINT (g_hash_table_lookup (self->y_indexes, rect->name));
SpVisualizerRowRelativePoint in_points[2];
SpVisualizerRowAbsolutePoint out_points[2];
SysprofVisualizerRowRelativePoint in_points[2];
SysprofVisualizerRowAbsolutePoint out_points[2];
GdkRectangle r;
GdkRGBA *rgba;
@ -186,9 +186,9 @@ rectangles_draw (Rectangles *self,
in_points[1].x = (rect->end - self->begin_time) / range;
in_points[1].y = 0;
sp_visualizer_row_translate_points (SP_VISUALIZER_ROW (row),
in_points, G_N_ELEMENTS (in_points),
out_points, G_N_ELEMENTS (out_points));
sysprof_visualizer_row_translate_points (SYSPROF_VISUALIZER_ROW (row),
in_points, G_N_ELEMENTS (in_points),
out_points, G_N_ELEMENTS (out_points));
r.height = alloc.height / (gdouble)n_rows;
r.x = out_points[0].x;

View File

@ -1,62 +0,0 @@
/* sp-cell-renderer-percent.h
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
* 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-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_CELL_RENDERER_PERCENT (sp_cell_renderer_percent_get_type())
#define SP_CELL_RENDERER_PERCENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CELL_RENDERER_PERCENT, SpCellRendererPercent))
#define SP_CELL_RENDERER_PERCENT_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CELL_RENDERER_PERCENT, SpCellRendererPercent const))
#define SP_CELL_RENDERER_PERCENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_CELL_RENDERER_PERCENT, SpCellRendererPercentClass))
#define SP_IS_CELL_RENDERER_PERCENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CELL_RENDERER_PERCENT))
#define SP_IS_CELL_RENDERER_PERCENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_CELL_RENDERER_PERCENT))
#define SP_CELL_RENDERER_PERCENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SP_TYPE_CELL_RENDERER_PERCENT, SpCellRendererPercentClass))
typedef struct _SpCellRendererPercent SpCellRendererPercent;
typedef struct _SpCellRendererPercentClass SpCellRendererPercentClass;
struct _SpCellRendererPercent
{
GtkCellRendererText parent;
};
struct _SpCellRendererPercentClass
{
GtkCellRendererTextClass parent_class;
gpointer padding[4];
};
SYSPROF_AVAILABLE_IN_ALL
GType sp_cell_renderer_percent_get_type (void);
SYSPROF_AVAILABLE_IN_ALL
GtkCellRenderer *sp_cell_renderer_percent_new (void);
SYSPROF_AVAILABLE_IN_ALL
gdouble sp_cell_renderer_percent_get_percent (SpCellRendererPercent *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_cell_renderer_percent_set_percent (SpCellRendererPercent *self,
gdouble percent);
G_END_DECLS

View File

@ -1,173 +0,0 @@
/* sp-cpu-visualizer-row.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 "sp-cpu-visualizer-row"
#include "config.h"
#include "sp-capture-condition.h"
#include "sp-capture-cursor.h"
#include "sp-color-cycle.h"
#include "sp-cpu-visualizer-row.h"
struct _SpCpuVisualizerRow
{
SpLineVisualizerRow parent_instance;
SpColorCycle *colors;
};
G_DEFINE_TYPE (SpCpuVisualizerRow, sp_cpu_visualizer_row, SP_TYPE_LINE_VISUALIZER_ROW)
static gboolean
sp_cpu_visualizer_counter_found (const SpCaptureFrame *frame,
gpointer user_data)
{
const SpCaptureFrameCounterDefine *def = (SpCaptureFrameCounterDefine *)frame;
GArray *counters = user_data;
gboolean found = FALSE;
g_assert (frame->type == SP_CAPTURE_FRAME_CTRDEF);
/*
* In practice, all the CPU counters are defined at once, so we can avoid
* walking the rest of the capture by returning after we find our CTRDEF.
*/
for (guint i = 0; i < def->n_counters; i++)
{
if (g_str_equal (def->counters[i].category, "CPU Percent"))
{
guint id = def->counters[i].id;
g_array_append_val (counters, id);
found = TRUE;
}
}
return !found;
}
static void
sp_cpu_visualizer_row_discover_counters (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *canellable)
{
const SpCaptureFrameType types[] = { SP_CAPTURE_FRAME_CTRDEF };
SpCaptureReader *reader = task_data;
g_autoptr(SpCaptureCursor) cursor = NULL;
g_autoptr(GArray) counters = NULL;
g_assert (G_IS_TASK (task));
g_assert (SP_IS_CPU_VISUALIZER_ROW (source_object));
g_assert (reader != NULL);
counters = g_array_new (FALSE, FALSE, sizeof (guint));
cursor = sp_capture_cursor_new (reader);
sp_capture_cursor_add_condition (cursor, sp_capture_condition_new_where_type_in (G_N_ELEMENTS (types), types));
sp_capture_cursor_foreach (cursor, sp_cpu_visualizer_counter_found, counters);
g_task_return_pointer (task, g_steal_pointer (&counters), (GDestroyNotify)g_array_unref);
}
static void
complete_counters (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
SpCpuVisualizerRow *self = (SpCpuVisualizerRow *)object;
g_autoptr(GArray) counters = NULL;
g_assert (SP_IS_CPU_VISUALIZER_ROW (self));
g_assert (G_IS_TASK (result));
counters = g_task_propagate_pointer (G_TASK (result), NULL);
if (counters != NULL)
{
for (guint i = 0; i < counters->len; i++)
{
guint counter_id = g_array_index (counters, guint, i);
GdkRGBA color;
sp_color_cycle_next (self->colors, &color);
sp_line_visualizer_row_add_counter (SP_LINE_VISUALIZER_ROW (self), counter_id, &color);
}
}
/* Hide ourself if we failed to locate counters */
gtk_widget_set_visible (GTK_WIDGET (self), counters != NULL && counters->len > 0);
}
static void
sp_cpu_visualizer_row_set_reader (SpVisualizerRow *row,
SpCaptureReader *reader)
{
SpCpuVisualizerRow *self = (SpCpuVisualizerRow *)row;
g_autoptr(GTask) task = NULL;
g_assert (SP_IS_CPU_VISUALIZER_ROW (row));
sp_color_cycle_reset (self->colors);
sp_line_visualizer_row_clear (SP_LINE_VISUALIZER_ROW (row));
SP_VISUALIZER_ROW_CLASS (sp_cpu_visualizer_row_parent_class)->set_reader (row, reader);
if (reader != NULL)
{
task = g_task_new (self, NULL, complete_counters, NULL);
g_task_set_source_tag (task, sp_cpu_visualizer_row_set_reader);
g_task_set_task_data (task, sp_capture_reader_copy (reader),
(GDestroyNotify)sp_capture_reader_unref);
g_task_run_in_thread (task, sp_cpu_visualizer_row_discover_counters);
}
}
static void
sp_cpu_visualizer_row_finalize (GObject *object)
{
SpCpuVisualizerRow *self = (SpCpuVisualizerRow *)object;
g_clear_pointer (&self->colors, sp_color_cycle_unref);
G_OBJECT_CLASS (sp_cpu_visualizer_row_parent_class)->finalize (object);
}
static void
sp_cpu_visualizer_row_class_init (SpCpuVisualizerRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
SpVisualizerRowClass *row_class = SP_VISUALIZER_ROW_CLASS (klass);
object_class->finalize = sp_cpu_visualizer_row_finalize;
row_class->set_reader = sp_cpu_visualizer_row_set_reader;
}
static void
sp_cpu_visualizer_row_init (SpCpuVisualizerRow *self)
{
self->colors = sp_color_cycle_new ();
}
GtkWidget *
sp_cpu_visualizer_row_new (void)
{
return g_object_new (SP_TYPE_CPU_VISUALIZER_ROW, NULL);
}

View File

@ -1,4 +1,4 @@
/* sp-callgraph-view.c
/* sysprof-callgraph-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -43,12 +43,12 @@
#include "../stackstash.h"
#include "sp-callgraph-view.h"
#include "sp-cell-renderer-percent.h"
#include "sysprof-callgraph-view.h"
#include "sysprof-cell-renderer-percent.h"
typedef struct
{
SpCallgraphProfile *profile;
SysprofCallgraphProfile *profile;
GtkTreeView *callers_view;
GtkTreeView *functions_view;
@ -58,9 +58,9 @@ typedef struct
GQueue *history;
guint profile_size;
} SpCallgraphViewPrivate;
} SysprofCallgraphViewPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (SpCallgraphView, sp_callgraph_view, GTK_TYPE_BIN)
G_DEFINE_TYPE_WITH_PRIVATE (SysprofCallgraphView, sysprof_callgraph_view, GTK_TYPE_BIN)
enum {
PROP_0,
@ -81,21 +81,21 @@ enum {
};
static void sp_callgraph_view_update_descendants (SpCallgraphView *self,
static void sysprof_callgraph_view_update_descendants (SysprofCallgraphView *self,
StackNode *node);
static GParamSpec *properties [N_PROPS];
static guint signals [N_SIGNALS];
static guint
sp_callgraph_view_get_profile_size (SpCallgraphView *self)
sysprof_callgraph_view_get_profile_size (SysprofCallgraphView *self)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
StackStash *stash;
StackNode *node;
guint size = 0;
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
if (priv->profile_size != 0)
return priv->profile_size;
@ -103,7 +103,7 @@ sp_callgraph_view_get_profile_size (SpCallgraphView *self)
if (priv->profile == NULL)
return 0;
if (NULL == (stash = sp_callgraph_profile_get_stash (priv->profile)))
if (NULL == (stash = sysprof_callgraph_profile_get_stash (priv->profile)))
return 0;
for (node = stack_stash_get_root (stash); node != NULL; node = node->siblings)
@ -148,10 +148,10 @@ build_functions_store (StackNode *node,
}
static void
sp_callgraph_view_load (SpCallgraphView *self,
SpCallgraphProfile *profile)
sysprof_callgraph_view_load (SysprofCallgraphView *self,
SysprofCallgraphProfile *profile)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkListStore *functions;
StackStash *stash;
StackNode *n;
@ -161,8 +161,8 @@ sp_callgraph_view_load (SpCallgraphView *self,
gdouble profile_size;
} state = { 0 };
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SP_IS_CALLGRAPH_PROFILE (profile));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (profile));
/*
* TODO: This is probably the type of thing we want to do off the main
@ -175,7 +175,7 @@ sp_callgraph_view_load (SpCallgraphView *self,
g_set_object (&priv->profile, profile);
if (NULL == (stash = sp_callgraph_profile_get_stash (profile)))
if (NULL == (stash = sysprof_callgraph_profile_get_stash (profile)))
return;
for (n = stack_stash_get_root (stash); n; n = n->siblings)
@ -206,12 +206,12 @@ sp_callgraph_view_load (SpCallgraphView *self,
}
static void
sp_callgraph_view_unload (SpCallgraphView *self)
sysprof_callgraph_view_unload (SysprofCallgraphView *self)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SP_IS_CALLGRAPH_PROFILE (priv->profile));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (priv->profile));
g_queue_clear (priv->history);
g_clear_object (&priv->profile);
@ -223,45 +223,45 @@ sp_callgraph_view_unload (SpCallgraphView *self)
}
/**
* sp_callgraph_view_get_profile:
* sysprof_callgraph_view_get_profile:
*
* Returns: (transfer none): An #SpCallgraphProfile.
* Returns: (transfer none): An #SysprofCallgraphProfile.
*/
SpCallgraphProfile *
sp_callgraph_view_get_profile (SpCallgraphView *self)
SysprofCallgraphProfile *
sysprof_callgraph_view_get_profile (SysprofCallgraphView *self)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
g_return_val_if_fail (SP_IS_CALLGRAPH_VIEW (self), NULL);
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), NULL);
return priv->profile;
}
void
sp_callgraph_view_set_profile (SpCallgraphView *self,
SpCallgraphProfile *profile)
sysprof_callgraph_view_set_profile (SysprofCallgraphView *self,
SysprofCallgraphProfile *profile)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
g_return_if_fail (SP_IS_CALLGRAPH_VIEW (self));
g_return_if_fail (!profile || SP_IS_CALLGRAPH_PROFILE (profile));
g_return_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_return_if_fail (!profile || SYSPROF_IS_CALLGRAPH_PROFILE (profile));
if (profile != priv->profile)
{
if (priv->profile)
sp_callgraph_view_unload (self);
sysprof_callgraph_view_unload (self);
if (profile)
sp_callgraph_view_load (self, profile);
sysprof_callgraph_view_load (self, profile);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_PROFILE]);
}
}
static void
sp_callgraph_view_expand_descendants (SpCallgraphView *self)
sysprof_callgraph_view_expand_descendants (SysprofCallgraphView *self)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeModel *model;
GList *all_paths = NULL;
GtkTreePath *first_path;
@ -270,7 +270,7 @@ sp_callgraph_view_expand_descendants (SpCallgraphView *self)
gint max_rows = 40; /* FIXME */
gint n_rows;
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
model = gtk_tree_view_get_model (priv->descendants_view);
first_path = gtk_tree_path_new_first ();
@ -384,10 +384,10 @@ caller_free (gpointer data)
}
static void
sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
sysprof_callgraph_view_function_selection_changed (SysprofCallgraphView *self,
GtkTreeSelection *selection)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeModel *model = NULL;
GtkTreeIter iter;
GtkListStore *callers_store;
@ -396,7 +396,7 @@ sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
StackNode *callees = NULL;
StackNode *node;
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (GTK_IS_TREE_SELECTION (selection));
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
@ -410,7 +410,7 @@ sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
COLUMN_POINTER, &callees,
-1);
sp_callgraph_view_update_descendants (self, callees);
sysprof_callgraph_view_update_descendants (self, callees);
callers_store = gtk_list_store_new (4,
G_TYPE_STRING,
@ -479,7 +479,7 @@ sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
gpointer key, value;
guint size = 0;
size = MAX (1, sp_callgraph_view_get_profile_size (self));
size = MAX (1, sysprof_callgraph_view_get_profile_size (self));
g_hash_table_iter_init (&hiter, callers);
@ -506,14 +506,14 @@ sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
}
static void
sp_callgraph_view_set_node (SpCallgraphView *self,
sysprof_callgraph_view_set_node (SysprofCallgraphView *self,
StackNode *node)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeModel *model;
GtkTreeIter iter;
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (node != NULL);
if (priv->profile == NULL)
@ -546,7 +546,7 @@ sp_callgraph_view_set_node (SpCallgraphView *self,
}
static void
sp_callgraph_view_descendant_activated (SpCallgraphView *self,
sysprof_callgraph_view_descendant_activated (SysprofCallgraphView *self,
GtkTreePath *path,
GtkTreeViewColumn *column,
GtkTreeView *tree_view)
@ -555,7 +555,7 @@ sp_callgraph_view_descendant_activated (SpCallgraphView *self,
StackNode *node = NULL;
GtkTreeIter iter;
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (GTK_IS_TREE_VIEW (tree_view));
g_assert (path != NULL);
g_assert (GTK_IS_TREE_VIEW_COLUMN (column));
@ -570,11 +570,11 @@ sp_callgraph_view_descendant_activated (SpCallgraphView *self,
-1);
if (node != NULL)
sp_callgraph_view_set_node (self, node);
sysprof_callgraph_view_set_node (self, node);
}
static void
sp_callgraph_view_caller_activated (SpCallgraphView *self,
sysprof_callgraph_view_caller_activated (SysprofCallgraphView *self,
GtkTreePath *path,
GtkTreeViewColumn *column,
GtkTreeView *tree_view)
@ -583,7 +583,7 @@ sp_callgraph_view_caller_activated (SpCallgraphView *self,
StackNode *node = NULL;
GtkTreeIter iter;
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (GTK_IS_TREE_VIEW (tree_view));
g_assert (path != NULL);
g_assert (GTK_IS_TREE_VIEW_COLUMN (column));
@ -598,18 +598,18 @@ sp_callgraph_view_caller_activated (SpCallgraphView *self,
-1);
if (node != NULL)
sp_callgraph_view_set_node (self, node);
sysprof_callgraph_view_set_node (self, node);
}
static void
sp_callgraph_view_tag_data_func (GtkTreeViewColumn *column,
sysprof_callgraph_view_tag_data_func (GtkTreeViewColumn *column,
GtkCellRenderer *cell,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
SpCallgraphView *self = data;
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphView *self = data;
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
StackNode *node = NULL;
const gchar *str = NULL;
@ -622,7 +622,7 @@ sp_callgraph_view_tag_data_func (GtkTreeViewColumn *column,
{
GQuark tag;
tag = sp_callgraph_profile_get_tag (priv->profile, GSIZE_TO_POINTER (node->data));
tag = sysprof_callgraph_profile_get_tag (priv->profile, GSIZE_TO_POINTER (node->data));
if (tag != 0)
str = g_quark_to_string (tag);
}
@ -631,39 +631,39 @@ sp_callgraph_view_tag_data_func (GtkTreeViewColumn *column,
}
static void
sp_callgraph_view_real_go_previous (SpCallgraphView *self)
sysprof_callgraph_view_real_go_previous (SysprofCallgraphView *self)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
StackNode *node;
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
node = g_queue_pop_head (priv->history);
if (NULL != (node = g_queue_peek_head (priv->history)))
sp_callgraph_view_set_node (self, node);
sysprof_callgraph_view_set_node (self, node);
}
static void
sp_callgraph_view_finalize (GObject *object)
sysprof_callgraph_view_finalize (GObject *object)
{
SpCallgraphView *self = (SpCallgraphView *)object;
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphView *self = (SysprofCallgraphView *)object;
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
g_clear_pointer (&priv->history, g_queue_free);
g_clear_object (&priv->profile);
G_OBJECT_CLASS (sp_callgraph_view_parent_class)->finalize (object);
G_OBJECT_CLASS (sysprof_callgraph_view_parent_class)->finalize (object);
}
static void
sp_callgraph_view_get_property (GObject *object,
sysprof_callgraph_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpCallgraphView *self = SP_CALLGRAPH_VIEW (object);
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphView *self = SYSPROF_CALLGRAPH_VIEW (object);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
switch (prop_id)
{
@ -677,17 +677,17 @@ sp_callgraph_view_get_property (GObject *object,
}
static void
sp_callgraph_view_set_property (GObject *object,
sysprof_callgraph_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpCallgraphView *self = SP_CALLGRAPH_VIEW (object);
SysprofCallgraphView *self = SYSPROF_CALLGRAPH_VIEW (object);
switch (prop_id)
{
case PROP_PROFILE:
sp_callgraph_view_set_profile (self, g_value_get_object (value));
sysprof_callgraph_view_set_profile (self, g_value_get_object (value));
break;
default:
@ -723,23 +723,23 @@ descendants_view_move_cursor_cb (GtkTreeView *descendants_view,
}
static void
sp_callgraph_view_class_init (SpCallgraphViewClass *klass)
sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkBindingSet *bindings;
object_class->finalize = sp_callgraph_view_finalize;
object_class->get_property = sp_callgraph_view_get_property;
object_class->set_property = sp_callgraph_view_set_property;
object_class->finalize = sysprof_callgraph_view_finalize;
object_class->get_property = sysprof_callgraph_view_get_property;
object_class->set_property = sysprof_callgraph_view_set_property;
klass->go_previous = sp_callgraph_view_real_go_previous;
klass->go_previous = sysprof_callgraph_view_real_go_previous;
properties [PROP_PROFILE] =
g_param_spec_object ("profile",
"Profile",
"The callgraph profile to view",
SP_TYPE_CALLGRAPH_PROFILE,
SYSPROF_TYPE_CALLGRAPH_PROFILE,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
@ -748,27 +748,27 @@ sp_callgraph_view_class_init (SpCallgraphViewClass *klass)
g_signal_new ("go-previous",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (SpCallgraphViewClass, go_previous),
G_STRUCT_OFFSET (SysprofCallgraphViewClass, go_previous),
NULL, NULL, NULL, G_TYPE_NONE, 0);
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/sysprof/ui/sp-callgraph-view.ui");
"/org/gnome/sysprof/ui/sysprof-callgraph-view.ui");
gtk_widget_class_bind_template_child_private (widget_class, SpCallgraphView, callers_view);
gtk_widget_class_bind_template_child_private (widget_class, SpCallgraphView, functions_view);
gtk_widget_class_bind_template_child_private (widget_class, SpCallgraphView, descendants_view);
gtk_widget_class_bind_template_child_private (widget_class, SpCallgraphView, descendants_name_column);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphView, callers_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphView, functions_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphView, descendants_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphView, descendants_name_column);
bindings = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (bindings, GDK_KEY_Left, GDK_MOD1_MASK, "go-previous", 0);
g_type_ensure (SP_TYPE_CELL_RENDERER_PERCENT);
g_type_ensure (SYSPROF_TYPE_CELL_RENDERER_PERCENT);
}
static void
sp_callgraph_view_init (SpCallgraphView *self)
sysprof_callgraph_view_init (SysprofCallgraphView *self)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeSelection *selection;
GtkCellRenderer *cell;
@ -780,19 +780,19 @@ sp_callgraph_view_init (SpCallgraphView *self)
g_signal_connect_object (selection,
"changed",
G_CALLBACK (sp_callgraph_view_function_selection_changed),
G_CALLBACK (sysprof_callgraph_view_function_selection_changed),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->descendants_view,
"row-activated",
G_CALLBACK (sp_callgraph_view_descendant_activated),
G_CALLBACK (sysprof_callgraph_view_descendant_activated),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->callers_view,
"row-activated",
G_CALLBACK (sp_callgraph_view_caller_activated),
G_CALLBACK (sysprof_callgraph_view_caller_activated),
self,
G_CONNECT_SWAPPED);
@ -815,7 +815,7 @@ sp_callgraph_view_init (SpCallgraphView *self)
NULL);
gtk_tree_view_column_pack_start (priv->descendants_name_column, cell, FALSE);
gtk_tree_view_column_set_cell_data_func (priv->descendants_name_column, cell,
sp_callgraph_view_tag_data_func,
sysprof_callgraph_view_tag_data_func,
self, NULL);
}
@ -916,7 +916,7 @@ build_tree (StackNode *node)
}
static void
append_to_tree_and_free (SpCallgraphView *self,
append_to_tree_and_free (SysprofCallgraphView *self,
StackStash *stash,
GtkTreeStore *store,
Descendant *item,
@ -929,7 +929,7 @@ append_to_tree_and_free (SpCallgraphView *self,
g_assert (GTK_IS_TREE_STORE (store));
g_assert (item != NULL);
profile_size = MAX (1, sp_callgraph_view_get_profile_size (self));
profile_size = MAX (1, sysprof_callgraph_view_get_profile_size (self));
gtk_tree_store_append (store, &iter, parent);
@ -952,13 +952,13 @@ append_to_tree_and_free (SpCallgraphView *self,
}
static void
sp_callgraph_view_update_descendants (SpCallgraphView *self,
sysprof_callgraph_view_update_descendants (SysprofCallgraphView *self,
StackNode *node)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeStore *store;
g_assert (SP_IS_CALLGRAPH_VIEW (self));
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
if (g_queue_peek_head (priv->history) != node)
g_queue_push_head (priv->history, node);
@ -973,7 +973,7 @@ sp_callgraph_view_update_descendants (SpCallgraphView *self,
{
StackStash *stash;
stash = sp_callgraph_profile_get_stash (priv->profile);
stash = sysprof_callgraph_profile_get_stash (priv->profile);
if (stash != NULL)
{
Descendant *tree;
@ -987,14 +987,14 @@ sp_callgraph_view_update_descendants (SpCallgraphView *self,
gtk_tree_view_set_model (priv->descendants_view, GTK_TREE_MODEL (store));
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
COLUMN_TOTAL, GTK_SORT_DESCENDING);
sp_callgraph_view_expand_descendants (self);
sysprof_callgraph_view_expand_descendants (self);
g_clear_object (&store);
}
/**
* sp_callgraph_view_screenshot:
* @self: A #SpCallgraphView.
* sysprof_callgraph_view_screenshot:
* @self: A #SysprofCallgraphView.
*
* This function will generate a text representation of the descendants tree.
* This is useful if you want to include various profiling information in a
@ -1006,16 +1006,16 @@ sp_callgraph_view_update_descendants (SpCallgraphView *self,
* with g_free().
*/
gchar *
sp_callgraph_view_screenshot (SpCallgraphView *self)
sysprof_callgraph_view_screenshot (SysprofCallgraphView *self)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeView *tree_view;
GtkTreeModel *model;
GtkTreePath *tree_path;
GString *str;
GtkTreeIter iter;
g_return_val_if_fail (SP_IS_CALLGRAPH_VIEW (self), NULL);
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), NULL);
tree_view = priv->descendants_view;
@ -1073,13 +1073,13 @@ sp_callgraph_view_screenshot (SpCallgraphView *self)
}
guint
sp_callgraph_view_get_n_functions (SpCallgraphView *self)
sysprof_callgraph_view_get_n_functions (SysprofCallgraphView *self)
{
SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeModel *model;
guint ret = 0;
g_return_val_if_fail (SP_IS_CALLGRAPH_VIEW (self), 0);
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), 0);
if (NULL != (model = gtk_tree_view_get_model (priv->functions_view)))
ret = gtk_tree_model_iter_n_children (model, NULL);

View File

@ -1,4 +1,4 @@
/* sp-callgraph-view.h
/* sysprof-callgraph-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -22,36 +22,36 @@
#include <gtk/gtk.h>
#include "sp-callgraph-profile.h"
#include "sysprof-callgraph-profile.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_CALLGRAPH_VIEW (sp_callgraph_view_get_type())
#define SYSPROF_TYPE_CALLGRAPH_VIEW (sysprof_callgraph_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpCallgraphView, sp_callgraph_view, SP, CALLGRAPH_VIEW, GtkBin)
G_DECLARE_DERIVABLE_TYPE (SysprofCallgraphView, sysprof_callgraph_view, SYSPROF, CALLGRAPH_VIEW, GtkBin)
struct _SpCallgraphViewClass
struct _SysprofCallgraphViewClass
{
GtkBinClass parent_class;
void (*go_previous) (SpCallgraphView *self);
void (*go_previous) (SysprofCallgraphView *self);
gpointer padding[8];
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_callgraph_view_new (void);
GtkWidget *sysprof_callgraph_view_new (void);
SYSPROF_AVAILABLE_IN_ALL
SpCallgraphProfile *sp_callgraph_view_get_profile (SpCallgraphView *self);
SysprofCallgraphProfile *sysprof_callgraph_view_get_profile (SysprofCallgraphView *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_callgraph_view_set_profile (SpCallgraphView *self,
SpCallgraphProfile *profile);
void sysprof_callgraph_view_set_profile (SysprofCallgraphView *self,
SysprofCallgraphProfile *profile);
SYSPROF_AVAILABLE_IN_ALL
gchar *sp_callgraph_view_screenshot (SpCallgraphView *self);
gchar *sysprof_callgraph_view_screenshot (SysprofCallgraphView *self);
SYSPROF_AVAILABLE_IN_ALL
guint sp_callgraph_view_get_n_functions (SpCallgraphView *self);
guint sysprof_callgraph_view_get_n_functions (SysprofCallgraphView *self);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-cell-renderer-percent.c
/* sysprof-cell-renderer-percent.c
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -22,12 +22,12 @@
#include <glib/gi18n.h>
#include "sp-cell-renderer-percent.h"
#include "sysprof-cell-renderer-percent.h"
typedef struct
{
gdouble percent;
} SpCellRendererPercentPrivate;
} SysprofCellRendererPercentPrivate;
enum {
PROP_0,
@ -35,22 +35,22 @@ enum {
N_PROPS
};
G_DEFINE_TYPE_WITH_PRIVATE (SpCellRendererPercent, sp_cell_renderer_percent, GTK_TYPE_CELL_RENDERER_TEXT)
G_DEFINE_TYPE_WITH_PRIVATE (SysprofCellRendererPercent, sysprof_cell_renderer_percent, GTK_TYPE_CELL_RENDERER_TEXT)
static GParamSpec *properties [N_PROPS];
static void
sp_cell_renderer_percent_get_property (GObject *object,
sysprof_cell_renderer_percent_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpCellRendererPercent *self = SP_CELL_RENDERER_PERCENT (object);
SysprofCellRendererPercent *self = SYSPROF_CELL_RENDERER_PERCENT (object);
switch (prop_id)
{
case PROP_PERCENT:
g_value_set_double (value, sp_cell_renderer_percent_get_percent (self));
g_value_set_double (value, sysprof_cell_renderer_percent_get_percent (self));
break;
default:
@ -59,17 +59,17 @@ sp_cell_renderer_percent_get_property (GObject *object,
}
static void
sp_cell_renderer_percent_set_property (GObject *object,
sysprof_cell_renderer_percent_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpCellRendererPercent *self = SP_CELL_RENDERER_PERCENT (object);
SysprofCellRendererPercent *self = SYSPROF_CELL_RENDERER_PERCENT (object);
switch (prop_id)
{
case PROP_PERCENT:
sp_cell_renderer_percent_set_percent (self, g_value_get_double (value));
sysprof_cell_renderer_percent_set_percent (self, g_value_get_double (value));
break;
default:
@ -78,12 +78,12 @@ sp_cell_renderer_percent_set_property (GObject *object,
}
static void
sp_cell_renderer_percent_class_init (SpCellRendererPercentClass *klass)
sysprof_cell_renderer_percent_class_init (SysprofCellRendererPercentClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = sp_cell_renderer_percent_get_property;
object_class->set_property = sp_cell_renderer_percent_set_property;
object_class->get_property = sysprof_cell_renderer_percent_get_property;
object_class->set_property = sysprof_cell_renderer_percent_set_property;
properties [PROP_PERCENT] =
g_param_spec_double ("percent",
@ -98,28 +98,28 @@ sp_cell_renderer_percent_class_init (SpCellRendererPercentClass *klass)
}
static void
sp_cell_renderer_percent_init (SpCellRendererPercent *self)
sysprof_cell_renderer_percent_init (SysprofCellRendererPercent *self)
{
g_object_set (self, "xalign", 1.0f, NULL);
}
gdouble
sp_cell_renderer_percent_get_percent (SpCellRendererPercent *self)
sysprof_cell_renderer_percent_get_percent (SysprofCellRendererPercent *self)
{
SpCellRendererPercentPrivate *priv = sp_cell_renderer_percent_get_instance_private (self);
SysprofCellRendererPercentPrivate *priv = sysprof_cell_renderer_percent_get_instance_private (self);
g_return_val_if_fail (SP_IS_CELL_RENDERER_PERCENT (self), 0.0);
g_return_val_if_fail (SYSPROF_IS_CELL_RENDERER_PERCENT (self), 0.0);
return priv->percent;
}
void
sp_cell_renderer_percent_set_percent (SpCellRendererPercent *self,
sysprof_cell_renderer_percent_set_percent (SysprofCellRendererPercent *self,
gdouble percent)
{
SpCellRendererPercentPrivate *priv = sp_cell_renderer_percent_get_instance_private (self);
SysprofCellRendererPercentPrivate *priv = sysprof_cell_renderer_percent_get_instance_private (self);
g_return_if_fail (SP_IS_CELL_RENDERER_PERCENT (self));
g_return_if_fail (SYSPROF_IS_CELL_RENDERER_PERCENT (self));
g_return_if_fail (percent >= 0.0);
g_return_if_fail (percent <= 100.0);

View File

@ -0,0 +1,62 @@
/* sysprof-cell-renderer-percent.h
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
* 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-version-macros.h"
G_BEGIN_DECLS
#define SYSPROF_TYPE_CELL_RENDERER_PERCENT (sysprof_cell_renderer_percent_get_type())
#define SYSPROF_CELL_RENDERER_PERCENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYSPROF_TYPE_CELL_RENDERER_PERCENT, SysprofCellRendererPercent))
#define SYSPROF_CELL_RENDERER_PERCENT_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYSPROF_TYPE_CELL_RENDERER_PERCENT, SysprofCellRendererPercent const))
#define SYSPROF_CELL_RENDERER_PERCENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYSPROF_TYPE_CELL_RENDERER_PERCENT, SysprofCellRendererPercentClass))
#define SYSPROF_IS_CELL_RENDERER_PERCENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYSPROF_TYPE_CELL_RENDERER_PERCENT))
#define SYSPROF_IS_CELL_RENDERER_PERCENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYSPROF_TYPE_CELL_RENDERER_PERCENT))
#define SYSPROF_CELL_RENDERER_PERCENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYSPROF_TYPE_CELL_RENDERER_PERCENT, SysprofCellRendererPercentClass))
typedef struct _SysprofCellRendererPercent SysprofCellRendererPercent;
typedef struct _SysprofCellRendererPercentClass SysprofCellRendererPercentClass;
struct _SysprofCellRendererPercent
{
GtkCellRendererText parent;
};
struct _SysprofCellRendererPercentClass
{
GtkCellRendererTextClass parent_class;
gpointer padding[4];
};
SYSPROF_AVAILABLE_IN_ALL
GType sysprof_cell_renderer_percent_get_type (void);
SYSPROF_AVAILABLE_IN_ALL
GtkCellRenderer *sysprof_cell_renderer_percent_new (void);
SYSPROF_AVAILABLE_IN_ALL
gdouble sysprof_cell_renderer_percent_get_percent (SysprofCellRendererPercent *self);
SYSPROF_AVAILABLE_IN_ALL
void sysprof_cell_renderer_percent_set_percent (SysprofCellRendererPercent *self,
gdouble percent);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-color-cycle.c
/* sysprof-color-cycle.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -18,13 +18,13 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sp-color-cycle"
#define G_LOG_DOMAIN "sysprof-color-cycle"
#include "config.h"
#include "sp-color-cycle.h"
#include "sysprof-color-cycle.h"
G_DEFINE_BOXED_TYPE (SpColorCycle, sp_color_cycle, sp_color_cycle_ref, sp_color_cycle_unref)
G_DEFINE_BOXED_TYPE (SysprofColorCycle, sysprof_color_cycle, sysprof_color_cycle_ref, sysprof_color_cycle_unref)
static const gchar *default_colors[] = {
"#73d216",
@ -54,7 +54,7 @@ static const gchar *default_colors[] = {
NULL
};
struct _SpColorCycle
struct _SysprofColorCycle
{
volatile gint ref_count;
GdkRGBA *colors;
@ -63,18 +63,18 @@ struct _SpColorCycle
};
static void
sp_color_cycle_destroy (SpColorCycle *self)
sysprof_color_cycle_destroy (SysprofColorCycle *self)
{
g_free (self->colors);
g_slice_free (SpColorCycle, self);
g_slice_free (SysprofColorCycle, self);
}
SpColorCycle *
sp_color_cycle_new (void)
SysprofColorCycle *
sysprof_color_cycle_new (void)
{
SpColorCycle *self;
SysprofColorCycle *self;
self = g_slice_new0 (SpColorCycle);
self = g_slice_new0 (SysprofColorCycle);
self->ref_count = 1;
self->n_colors = g_strv_length ((gchar **)default_colors);
self->colors = g_new0 (GdkRGBA, self->n_colors);
@ -88,8 +88,8 @@ sp_color_cycle_new (void)
return self;
}
SpColorCycle *
sp_color_cycle_ref (SpColorCycle *self)
SysprofColorCycle *
sysprof_color_cycle_ref (SysprofColorCycle *self)
{
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (self->ref_count > 0, NULL);
@ -98,16 +98,16 @@ sp_color_cycle_ref (SpColorCycle *self)
}
void
sp_color_cycle_unref (SpColorCycle *self)
sysprof_color_cycle_unref (SysprofColorCycle *self)
{
g_return_if_fail (self != NULL);
g_return_if_fail (self->ref_count > 0);
if (g_atomic_int_dec_and_test (&self->ref_count))
sp_color_cycle_destroy (self);
sysprof_color_cycle_destroy (self);
}
void
sp_color_cycle_next (SpColorCycle *self,
sysprof_color_cycle_next (SysprofColorCycle *self,
GdkRGBA *rgba)
{
g_return_if_fail (self != NULL);
@ -126,7 +126,7 @@ sp_color_cycle_next (SpColorCycle *self,
}
void
sp_color_cycle_reset (SpColorCycle *self)
sysprof_color_cycle_reset (SysprofColorCycle *self)
{
g_return_if_fail (self != NULL);

View File

@ -1,4 +1,4 @@
/* sp-color-cycle.h
/* sysprof-color-cycle.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -26,22 +26,22 @@
G_BEGIN_DECLS
#define SP_TYPE_COLOR_CYCLE (sp_color_cycle_get_type())
#define SYSPROF_TYPE_COLOR_CYCLE (sysprof_color_cycle_get_type())
typedef struct _SpColorCycle SpColorCycle;
typedef struct _SysprofColorCycle SysprofColorCycle;
SYSPROF_AVAILABLE_IN_ALL
GType sp_color_cycle_get_type (void);
GType sysprof_color_cycle_get_type (void);
SYSPROF_AVAILABLE_IN_ALL
SpColorCycle *sp_color_cycle_ref (SpColorCycle *self);
SysprofColorCycle *sysprof_color_cycle_ref (SysprofColorCycle *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_color_cycle_unref (SpColorCycle *self);
void sysprof_color_cycle_unref (SysprofColorCycle *self);
SYSPROF_AVAILABLE_IN_ALL
SpColorCycle *sp_color_cycle_new (void);
SysprofColorCycle *sysprof_color_cycle_new (void);
SYSPROF_AVAILABLE_IN_ALL
void sp_color_cycle_reset (SpColorCycle *self);
void sysprof_color_cycle_reset (SysprofColorCycle *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_color_cycle_next (SpColorCycle *self,
void sysprof_color_cycle_next (SysprofColorCycle *self,
GdkRGBA *rgba);
G_END_DECLS

View File

@ -0,0 +1,173 @@
/* sysprof-cpu-visualizer-row.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-cpu-visualizer-row"
#include "config.h"
#include "sysprof-capture-condition.h"
#include "sysprof-capture-cursor.h"
#include "sysprof-color-cycle.h"
#include "sysprof-cpu-visualizer-row.h"
struct _SysprofCpuVisualizerRow
{
SysprofLineVisualizerRow parent_instance;
SysprofColorCycle *colors;
};
G_DEFINE_TYPE (SysprofCpuVisualizerRow, sysprof_cpu_visualizer_row, SYSPROF_TYPE_LINE_VISUALIZER_ROW)
static gboolean
sysprof_cpu_visualizer_counter_found (const SysprofCaptureFrame *frame,
gpointer user_data)
{
const SysprofCaptureFrameCounterDefine *def = (SysprofCaptureFrameCounterDefine *)frame;
GArray *counters = user_data;
gboolean found = FALSE;
g_assert (frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF);
/*
* In practice, all the CPU counters are defined at once, so we can avoid
* walking the rest of the capture by returning after we find our CTRDEF.
*/
for (guint i = 0; i < def->n_counters; i++)
{
if (g_str_equal (def->counters[i].category, "CPU Percent"))
{
guint id = def->counters[i].id;
g_array_append_val (counters, id);
found = TRUE;
}
}
return !found;
}
static void
sysprof_cpu_visualizer_row_discover_counters (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *canellable)
{
const SysprofCaptureFrameType types[] = { SYSPROF_CAPTURE_FRAME_CTRDEF };
SysprofCaptureReader *reader = task_data;
g_autoptr(SysprofCaptureCursor) cursor = NULL;
g_autoptr(GArray) counters = NULL;
g_assert (G_IS_TASK (task));
g_assert (SYSPROF_IS_CPU_VISUALIZER_ROW (source_object));
g_assert (reader != NULL);
counters = g_array_new (FALSE, FALSE, sizeof (guint));
cursor = sysprof_capture_cursor_new (reader);
sysprof_capture_cursor_add_condition (cursor, sysprof_capture_condition_new_where_type_in (G_N_ELEMENTS (types), types));
sysprof_capture_cursor_foreach (cursor, sysprof_cpu_visualizer_counter_found, counters);
g_task_return_pointer (task, g_steal_pointer (&counters), (GDestroyNotify)g_array_unref);
}
static void
complete_counters (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
SysprofCpuVisualizerRow *self = (SysprofCpuVisualizerRow *)object;
g_autoptr(GArray) counters = NULL;
g_assert (SYSPROF_IS_CPU_VISUALIZER_ROW (self));
g_assert (G_IS_TASK (result));
counters = g_task_propagate_pointer (G_TASK (result), NULL);
if (counters != NULL)
{
for (guint i = 0; i < counters->len; i++)
{
guint counter_id = g_array_index (counters, guint, i);
GdkRGBA color;
sysprof_color_cycle_next (self->colors, &color);
sysprof_line_visualizer_row_add_counter (SYSPROF_LINE_VISUALIZER_ROW (self), counter_id, &color);
}
}
/* Hide ourself if we failed to locate counters */
gtk_widget_set_visible (GTK_WIDGET (self), counters != NULL && counters->len > 0);
}
static void
sysprof_cpu_visualizer_row_set_reader (SysprofVisualizerRow *row,
SysprofCaptureReader *reader)
{
SysprofCpuVisualizerRow *self = (SysprofCpuVisualizerRow *)row;
g_autoptr(GTask) task = NULL;
g_assert (SYSPROF_IS_CPU_VISUALIZER_ROW (row));
sysprof_color_cycle_reset (self->colors);
sysprof_line_visualizer_row_clear (SYSPROF_LINE_VISUALIZER_ROW (row));
SYSPROF_VISUALIZER_ROW_CLASS (sysprof_cpu_visualizer_row_parent_class)->set_reader (row, reader);
if (reader != NULL)
{
task = g_task_new (self, NULL, complete_counters, NULL);
g_task_set_source_tag (task, sysprof_cpu_visualizer_row_set_reader);
g_task_set_task_data (task, sysprof_capture_reader_copy (reader),
(GDestroyNotify)sysprof_capture_reader_unref);
g_task_run_in_thread (task, sysprof_cpu_visualizer_row_discover_counters);
}
}
static void
sysprof_cpu_visualizer_row_finalize (GObject *object)
{
SysprofCpuVisualizerRow *self = (SysprofCpuVisualizerRow *)object;
g_clear_pointer (&self->colors, sysprof_color_cycle_unref);
G_OBJECT_CLASS (sysprof_cpu_visualizer_row_parent_class)->finalize (object);
}
static void
sysprof_cpu_visualizer_row_class_init (SysprofCpuVisualizerRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
SysprofVisualizerRowClass *row_class = SYSPROF_VISUALIZER_ROW_CLASS (klass);
object_class->finalize = sysprof_cpu_visualizer_row_finalize;
row_class->set_reader = sysprof_cpu_visualizer_row_set_reader;
}
static void
sysprof_cpu_visualizer_row_init (SysprofCpuVisualizerRow *self)
{
self->colors = sysprof_color_cycle_new ();
}
GtkWidget *
sysprof_cpu_visualizer_row_new (void)
{
return g_object_new (SYSPROF_TYPE_CPU_VISUALIZER_ROW, NULL);
}

View File

@ -1,4 +1,4 @@
/* sp-cpu-visualizer-row.h
/* sysprof-cpu-visualizer-row.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -20,18 +20,18 @@
#pragma once
#include "sp-line-visualizer-row.h"
#include "sysprof-line-visualizer-row.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_CPU_VISUALIZER_ROW (sp_cpu_visualizer_row_get_type())
#define SYSPROF_TYPE_CPU_VISUALIZER_ROW (sysprof_cpu_visualizer_row_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (SpCpuVisualizerRow, sp_cpu_visualizer_row, SP, CPU_VISUALIZER_ROW, SpLineVisualizerRow)
G_DECLARE_FINAL_TYPE (SysprofCpuVisualizerRow, sysprof_cpu_visualizer_row, SYSPROF, CPU_VISUALIZER_ROW, SysprofLineVisualizerRow)
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_cpu_visualizer_row_new (void);
GtkWidget *sysprof_cpu_visualizer_row_new (void);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-empty-state-view.c
/* sysprof-empty-state-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -18,21 +18,21 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sp-empty-state-view"
#define G_LOG_DOMAIN "sysprof-empty-state-view"
#include "config.h"
#include <string.h>
#include "sp-empty-state-view.h"
#include "sysprof-empty-state-view.h"
typedef struct
{
GtkLabel *title;
GtkLabel *subtitle;
} SpEmptyStateViewPrivate;
} SysprofEmptyStateViewPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (SpEmptyStateView, sp_empty_state_view, GTK_TYPE_BIN)
G_DEFINE_TYPE_WITH_PRIVATE (SysprofEmptyStateView, sysprof_empty_state_view, GTK_TYPE_BIN)
enum {
PROP_0,
@ -44,13 +44,13 @@ enum {
static GParamSpec *properties [N_PROPS];
GtkWidget *
sp_empty_state_view_new (void)
sysprof_empty_state_view_new (void)
{
return g_object_new (SP_TYPE_EMPTY_STATE_VIEW, NULL);
return g_object_new (SYSPROF_TYPE_EMPTY_STATE_VIEW, NULL);
}
static gboolean
sp_empty_state_view_action (GtkWidget *widget,
sysprof_empty_state_view_action (GtkWidget *widget,
const gchar *prefix,
const gchar *action_name,
GVariant *parameter)
@ -96,11 +96,11 @@ sp_empty_state_view_action (GtkWidget *widget,
}
static gboolean
sp_empty_state_view_activate_link (SpEmptyStateView *self,
sysprof_empty_state_view_activate_link (SysprofEmptyStateView *self,
const gchar *uri,
GtkLabel *label)
{
g_assert (SP_IS_EMPTY_STATE_VIEW (self));
g_assert (SYSPROF_IS_EMPTY_STATE_VIEW (self));
g_assert (uri != NULL);
g_assert (GTK_IS_LABEL (label));
@ -127,7 +127,7 @@ sp_empty_state_view_activate_link (SpEmptyStateView *self,
group_name = g_strndup (full_name, dot - full_name);
action_name = g_strdup (++dot);
sp_empty_state_view_action (GTK_WIDGET (self),
sysprof_empty_state_view_action (GTK_WIDGET (self),
group_name,
action_name,
param);
@ -142,13 +142,13 @@ sp_empty_state_view_activate_link (SpEmptyStateView *self,
}
static void
sp_empty_state_view_set_property (GObject *object,
sysprof_empty_state_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpEmptyStateView *self = SP_EMPTY_STATE_VIEW (object);
SpEmptyStateViewPrivate *priv = sp_empty_state_view_get_instance_private (self);
SysprofEmptyStateView *self = SYSPROF_EMPTY_STATE_VIEW (object);
SysprofEmptyStateViewPrivate *priv = sysprof_empty_state_view_get_instance_private (self);
switch (prop_id)
{
@ -166,12 +166,12 @@ sp_empty_state_view_set_property (GObject *object,
}
static void
sp_empty_state_view_class_init (SpEmptyStateViewClass *klass)
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 = sp_empty_state_view_set_property;
object_class->set_property = sysprof_empty_state_view_set_property;
properties [PROP_TITLE] =
g_param_spec_string ("title",
@ -189,21 +189,21 @@ sp_empty_state_view_class_init (SpEmptyStateViewClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sp-empty-state-view.ui");
gtk_widget_class_bind_template_child_private (widget_class, SpEmptyStateView, subtitle);
gtk_widget_class_bind_template_child_private (widget_class, SpEmptyStateView, title);
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);
}
static void
sp_empty_state_view_init (SpEmptyStateView *self)
sysprof_empty_state_view_init (SysprofEmptyStateView *self)
{
SpEmptyStateViewPrivate *priv = sp_empty_state_view_get_instance_private (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 (sp_empty_state_view_activate_link),
G_CALLBACK (sysprof_empty_state_view_activate_link),
self,
G_CONNECT_SWAPPED);
}

View File

@ -1,4 +1,4 @@
/* sp-empty-state-view.h
/* sysprof-empty-state-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -26,12 +26,12 @@
G_BEGIN_DECLS
#define SP_TYPE_EMPTY_STATE_VIEW (sp_empty_state_view_get_type())
#define SYSPROF_TYPE_EMPTY_STATE_VIEW (sysprof_empty_state_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpEmptyStateView, sp_empty_state_view, SP, EMPTY_STATE_VIEW, GtkBin)
G_DECLARE_DERIVABLE_TYPE (SysprofEmptyStateView, sysprof_empty_state_view, SYSPROF, EMPTY_STATE_VIEW, GtkBin)
struct _SpEmptyStateViewClass
struct _SysprofEmptyStateViewClass
{
GtkBinClass parent;
@ -39,6 +39,6 @@ struct _SpEmptyStateViewClass
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_empty_state_view_new (void);
GtkWidget *sysprof_empty_state_view_new (void);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-failed-state-view.c
/* sysprof-failed-state-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -20,27 +20,27 @@
#include "config.h"
#include "sp-failed-state-view.h"
#include "sysprof-failed-state-view.h"
G_DEFINE_TYPE (SpFailedStateView, sp_failed_state_view, GTK_TYPE_BIN)
G_DEFINE_TYPE (SysprofFailedStateView, sysprof_failed_state_view, GTK_TYPE_BIN)
GtkWidget *
sp_failed_state_view_new (void)
sysprof_failed_state_view_new (void)
{
return g_object_new (SP_TYPE_FAILED_STATE_VIEW, NULL);
return g_object_new (SYSPROF_TYPE_FAILED_STATE_VIEW, NULL);
}
static void
sp_failed_state_view_class_init (SpFailedStateViewClass *klass)
sysprof_failed_state_view_class_init (SysprofFailedStateViewClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/sysprof/ui/sp-failed-state-view.ui");
"/org/gnome/sysprof/ui/sysprof-failed-state-view.ui");
}
static void
sp_failed_state_view_init (SpFailedStateView *self)
sysprof_failed_state_view_init (SysprofFailedStateView *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
}

View File

@ -1,4 +1,4 @@
/* sp-failed-state-view.h
/* sysprof-failed-state-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -22,17 +22,17 @@
#include <gtk/gtk.h>
#include "sp-profiler.h"
#include "sysprof-profiler.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_FAILED_STATE_VIEW (sp_failed_state_view_get_type())
#define SYSPROF_TYPE_FAILED_STATE_VIEW (sysprof_failed_state_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpFailedStateView, sp_failed_state_view, SP, FAILED_STATE_VIEW, GtkBin)
G_DECLARE_DERIVABLE_TYPE (SysprofFailedStateView, sysprof_failed_state_view, SYSPROF, FAILED_STATE_VIEW, GtkBin)
struct _SpFailedStateViewClass
struct _SysprofFailedStateViewClass
{
GtkBinClass parent;
@ -40,9 +40,9 @@ struct _SpFailedStateViewClass
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_failed_state_view_new (void);
GtkWidget *sysprof_failed_state_view_new (void);
SYSPROF_AVAILABLE_IN_ALL
void sp_failed_state_view_set_profiler (SpFailedStateView *self,
SpProfiler *profiler);
void sysprof_failed_state_view_set_profiler (SysprofFailedStateView *self,
SysprofProfiler *profiler);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-line-visualizer-row.c
/* sysprof-line-visualizer-row.c
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -18,7 +18,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sp-line-visualizer-row"
#define G_LOG_DOMAIN "sysprof-line-visualizer-row"
#include "config.h"
@ -26,16 +26,16 @@
#include <string.h>
#include "pointcache.h"
#include "sp-capture-condition.h"
#include "sp-capture-cursor.h"
#include "sp-line-visualizer-row.h"
#include "sysprof-capture-condition.h"
#include "sysprof-capture-cursor.h"
#include "sysprof-line-visualizer-row.h"
typedef struct
{
/*
* Our reader as assigned by the visualizer system.
*/
SpCaptureReader *reader;
SysprofCaptureReader *reader;
/*
* An array of LineInfo which contains information about the counters
@ -70,7 +70,7 @@ typedef struct
guint y_lower_set : 1;
guint y_upper_set : 1;
} SpLineVisualizerRowPrivate;
} SysprofLineVisualizerRowPrivate;
typedef struct
{
@ -84,7 +84,7 @@ typedef struct
typedef struct
{
SpCaptureCursor *cursor;
SysprofCaptureCursor *cursor;
GArray *lines;
PointCache *cache;
gint64 begin_time;
@ -95,13 +95,13 @@ typedef struct
guint y_upper_set : 1;
} LoadData;
G_DEFINE_TYPE_WITH_PRIVATE (SpLineVisualizerRow, sp_line_visualizer_row, SP_TYPE_VISUALIZER_ROW)
G_DEFINE_TYPE_WITH_PRIVATE (SysprofLineVisualizerRow, sysprof_line_visualizer_row, SYSPROF_TYPE_VISUALIZER_ROW)
static void sp_line_visualizer_row_load_data_async (SpLineVisualizerRow *self,
static void sysprof_line_visualizer_row_load_data_async (SysprofLineVisualizerRow *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
static PointCache *sp_line_visualizer_row_load_data_finish (SpLineVisualizerRow *self,
static PointCache *sysprof_line_visualizer_row_load_data_finish (SysprofLineVisualizerRow *self,
GAsyncResult *result,
GError **error);
@ -123,7 +123,7 @@ load_data_free (gpointer data)
if (load != NULL)
{
g_clear_pointer (&load->lines, g_array_unref);
g_clear_pointer (&load->cursor, sp_capture_cursor_unref);
g_clear_pointer (&load->cursor, sysprof_capture_cursor_unref);
g_clear_pointer (&load->cache, point_cache_unref);
g_slice_free (LoadData, load);
}
@ -142,23 +142,23 @@ copy_array (GArray *ar)
}
static gboolean
sp_line_visualizer_row_draw (GtkWidget *widget,
sysprof_line_visualizer_row_draw (GtkWidget *widget,
cairo_t *cr)
{
SpLineVisualizerRow *self = (SpLineVisualizerRow *)widget;
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRow *self = (SysprofLineVisualizerRow *)widget;
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
GtkStyleContext *style_context;
GtkStateFlags flags;
GtkAllocation alloc;
GdkRGBA foreground;
gboolean ret;
g_assert (SP_IS_LINE_VISUALIZER_ROW (widget));
g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (widget));
g_assert (cr != NULL);
gtk_widget_get_allocation (widget, &alloc);
ret = GTK_WIDGET_CLASS (sp_line_visualizer_row_parent_class)->draw (widget, cr);
ret = GTK_WIDGET_CLASS (sysprof_line_visualizer_row_parent_class)->draw (widget, cr);
if (priv->cache == NULL)
return ret;
@ -169,7 +169,7 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
for (guint line = 0; line < priv->lines->len; line++)
{
g_autofree SpVisualizerRowAbsolutePoint *points = NULL;
g_autofree SysprofVisualizerRowAbsolutePoint *points = NULL;
const LineInfo *line_info = &g_array_index (priv->lines, LineInfo, line);
const Point *fpoints;
guint n_fpoints = 0;
@ -182,10 +182,10 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
gdouble last_x;
gdouble last_y;
points = g_new0 (SpVisualizerRowAbsolutePoint, n_fpoints);
points = g_new0 (SysprofVisualizerRowAbsolutePoint, n_fpoints);
sp_visualizer_row_translate_points (SP_VISUALIZER_ROW (self),
(const SpVisualizerRowRelativePoint *)fpoints,
sysprof_visualizer_row_translate_points (SYSPROF_VISUALIZER_ROW (self),
(const SysprofVisualizerRowRelativePoint *)fpoints,
n_fpoints,
points,
n_fpoints);
@ -244,18 +244,18 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
}
static void
sp_line_visualizer_row_load_data_cb (GObject *object,
sysprof_line_visualizer_row_load_data_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
SpLineVisualizerRow *self = (SpLineVisualizerRow *)object;
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRow *self = (SysprofLineVisualizerRow *)object;
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_autoptr(GError) error = NULL;
g_autoptr(PointCache) cache = NULL;
g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
cache = sp_line_visualizer_row_load_data_finish (self, result, &error);
cache = sysprof_line_visualizer_row_load_data_finish (self, result, &error);
if (cache == NULL)
{
@ -270,20 +270,20 @@ sp_line_visualizer_row_load_data_cb (GObject *object,
}
static gboolean
sp_line_visualizer_row_do_reload (gpointer data)
sysprof_line_visualizer_row_do_reload (gpointer data)
{
SpLineVisualizerRow *self = data;
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRow *self = data;
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
priv->queued_load = 0;
if (priv->reader != NULL)
{
sp_line_visualizer_row_load_data_async (self,
sysprof_line_visualizer_row_load_data_async (self,
NULL,
sp_line_visualizer_row_load_data_cb,
sysprof_line_visualizer_row_load_data_cb,
NULL);
}
@ -291,54 +291,54 @@ sp_line_visualizer_row_do_reload (gpointer data)
}
static void
sp_line_visualizer_row_queue_reload (SpLineVisualizerRow *self)
sysprof_line_visualizer_row_queue_reload (SysprofLineVisualizerRow *self)
{
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
if (priv->queued_load == 0)
{
priv->queued_load = gdk_threads_add_idle_full (G_PRIORITY_LOW,
sp_line_visualizer_row_do_reload,
sysprof_line_visualizer_row_do_reload,
self,
NULL);
}
}
static void
sp_line_visualizer_row_set_reader (SpVisualizerRow *row,
SpCaptureReader *reader)
sysprof_line_visualizer_row_set_reader (SysprofVisualizerRow *row,
SysprofCaptureReader *reader)
{
SpLineVisualizerRow *self = (SpLineVisualizerRow *)row;
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRow *self = (SysprofLineVisualizerRow *)row;
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
if (priv->reader != reader)
{
if (priv->reader != NULL)
{
sp_capture_reader_unref (priv->reader);
sysprof_capture_reader_unref (priv->reader);
priv->reader = NULL;
}
if (reader != NULL)
priv->reader = sp_capture_reader_ref (reader);
priv->reader = sysprof_capture_reader_ref (reader);
sp_line_visualizer_row_queue_reload (self);
sysprof_line_visualizer_row_queue_reload (self);
}
}
static void
sp_line_visualizer_row_finalize (GObject *object)
sysprof_line_visualizer_row_finalize (GObject *object)
{
SpLineVisualizerRow *self = (SpLineVisualizerRow *)object;
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRow *self = (SysprofLineVisualizerRow *)object;
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_clear_pointer (&priv->lines, g_array_unref);
g_clear_pointer (&priv->cache, point_cache_unref);
g_clear_pointer (&priv->reader, sp_capture_reader_unref);
g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (priv->queued_load != 0)
{
@ -346,17 +346,17 @@ sp_line_visualizer_row_finalize (GObject *object)
priv->queued_load = 0;
}
G_OBJECT_CLASS (sp_line_visualizer_row_parent_class)->finalize (object);
G_OBJECT_CLASS (sysprof_line_visualizer_row_parent_class)->finalize (object);
}
static void
sp_line_visualizer_row_get_property (GObject *object,
sysprof_line_visualizer_row_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpLineVisualizerRow *self = SP_LINE_VISUALIZER_ROW (object);
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRow *self = SYSPROF_LINE_VISUALIZER_ROW (object);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
switch (prop_id)
{
@ -378,13 +378,13 @@ sp_line_visualizer_row_get_property (GObject *object,
}
static void
sp_line_visualizer_row_set_property (GObject *object,
sysprof_line_visualizer_row_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpLineVisualizerRow *self = SP_LINE_VISUALIZER_ROW (object);
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRow *self = SYSPROF_LINE_VISUALIZER_ROW (object);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
switch (prop_id)
{
@ -410,19 +410,19 @@ sp_line_visualizer_row_set_property (GObject *object,
}
static void
sp_line_visualizer_row_class_init (SpLineVisualizerRowClass *klass)
sysprof_line_visualizer_row_class_init (SysprofLineVisualizerRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
SpVisualizerRowClass *visualizer_class = SP_VISUALIZER_ROW_CLASS (klass);
SysprofVisualizerRowClass *visualizer_class = SYSPROF_VISUALIZER_ROW_CLASS (klass);
object_class->finalize = sp_line_visualizer_row_finalize;
object_class->get_property = sp_line_visualizer_row_get_property;
object_class->set_property = sp_line_visualizer_row_set_property;
object_class->finalize = sysprof_line_visualizer_row_finalize;
object_class->get_property = sysprof_line_visualizer_row_get_property;
object_class->set_property = sysprof_line_visualizer_row_set_property;
widget_class->draw = sp_line_visualizer_row_draw;
widget_class->draw = sysprof_line_visualizer_row_draw;
visualizer_class->set_reader = sp_line_visualizer_row_set_reader;
visualizer_class->set_reader = sysprof_line_visualizer_row_set_reader;
properties [PROP_TITLE] =
g_param_spec_string ("title",
@ -453,9 +453,9 @@ sp_line_visualizer_row_class_init (SpLineVisualizerRowClass *klass)
}
static void
sp_line_visualizer_row_init (SpLineVisualizerRow *self)
sysprof_line_visualizer_row_init (SysprofLineVisualizerRow *self)
{
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
PangoAttrList *attrs = pango_attr_list_new ();
priv->lines = g_array_new (FALSE, FALSE, sizeof (LineInfo));
@ -474,14 +474,14 @@ sp_line_visualizer_row_init (SpLineVisualizerRow *self)
}
void
sp_line_visualizer_row_add_counter (SpLineVisualizerRow *self,
sysprof_line_visualizer_row_add_counter (SysprofLineVisualizerRow *self,
guint counter_id,
const GdkRGBA *color)
{
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
LineInfo line_info = { 0 };
g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
g_assert (priv->lines != NULL);
line_info.id = counter_id;
@ -500,18 +500,18 @@ sp_line_visualizer_row_add_counter (SpLineVisualizerRow *self,
g_array_append_val (priv->lines, line_info);
if (SP_LINE_VISUALIZER_ROW_GET_CLASS (self)->counter_added)
SP_LINE_VISUALIZER_ROW_GET_CLASS (self)->counter_added (self, counter_id);
if (SYSPROF_LINE_VISUALIZER_ROW_GET_CLASS (self)->counter_added)
SYSPROF_LINE_VISUALIZER_ROW_GET_CLASS (self)->counter_added (self, counter_id);
sp_line_visualizer_row_queue_reload (self);
sysprof_line_visualizer_row_queue_reload (self);
}
void
sp_line_visualizer_row_clear (SpLineVisualizerRow *self)
sysprof_line_visualizer_row_clear (SysprofLineVisualizerRow *self)
{
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_return_if_fail (SP_IS_LINE_VISUALIZER_ROW (self));
g_return_if_fail (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
if (priv->lines->len > 0)
g_array_remove_range (priv->lines, 0, priv->lines->len);
@ -542,7 +542,7 @@ counter_type (LoadData *load,
* We need to keep some information on the counter (by id) so that we
* can track the counters type (which is a 1-byte type id).
*/
return SP_CAPTURE_COUNTER_DOUBLE;
return SYSPROF_CAPTURE_COUNTER_DOUBLE;
}
static inline gdouble
@ -570,24 +570,24 @@ calc_y_int64 (gint64 lower,
}
static gboolean
sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
sysprof_line_visualizer_row_load_data_frame_cb (const SysprofCaptureFrame *frame,
gpointer user_data)
{
LoadData *load = user_data;
g_assert (frame != NULL);
g_assert (frame->type == SP_CAPTURE_FRAME_CTRSET ||
frame->type == SP_CAPTURE_FRAME_CTRDEF);
g_assert (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET ||
frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF);
g_assert (load != NULL);
if (frame->type == SP_CAPTURE_FRAME_CTRSET)
if (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET)
{
const SpCaptureFrameCounterSet *set = (SpCaptureFrameCounterSet *)frame;
const SysprofCaptureFrameCounterSet *set = (SysprofCaptureFrameCounterSet *)frame;
gdouble x = calc_x (load->begin_time, load->end_time, frame->time);
for (guint i = 0; i < set->n_values; i++)
{
const SpCaptureCounterValues *group = &set->values[i];
const SysprofCaptureCounterValues *group = &set->values[i];
for (guint j = 0; j < G_N_ELEMENTS (group->ids); j++)
{
@ -597,7 +597,7 @@ sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
{
gdouble y;
if (counter_type (load, counter_id) == SP_CAPTURE_COUNTER_DOUBLE)
if (counter_type (load, counter_id) == SYSPROF_CAPTURE_COUNTER_DOUBLE)
y = calc_y_double (load->y_lower, load->y_upper, group->values[j].vdbl);
else
y = calc_y_int64 (load->y_lower, load->y_upper, group->values[j].v64);
@ -612,25 +612,25 @@ sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
}
static gboolean
sp_line_visualizer_row_load_data_range_cb (const SpCaptureFrame *frame,
sysprof_line_visualizer_row_load_data_range_cb (const SysprofCaptureFrame *frame,
gpointer user_data)
{
LoadData *load = user_data;
g_assert (frame != NULL);
g_assert (frame->type == SP_CAPTURE_FRAME_CTRSET ||
frame->type == SP_CAPTURE_FRAME_CTRDEF);
g_assert (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET ||
frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF);
g_assert (load != NULL);
g_assert (load->y_upper_set == FALSE ||
load->y_lower_set == FALSE);
if (frame->type == SP_CAPTURE_FRAME_CTRSET)
if (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET)
{
const SpCaptureFrameCounterSet *set = (SpCaptureFrameCounterSet *)frame;
const SysprofCaptureFrameCounterSet *set = (SysprofCaptureFrameCounterSet *)frame;
for (guint i = 0; i < set->n_values; i++)
{
const SpCaptureCounterValues *group = &set->values[i];
const SysprofCaptureCounterValues *group = &set->values[i];
for (guint j = 0; j < G_N_ELEMENTS (group->ids); j++)
{
@ -640,7 +640,7 @@ sp_line_visualizer_row_load_data_range_cb (const SpCaptureFrame *frame,
{
gdouble y;
if (counter_type (load, counter_id) == SP_CAPTURE_COUNTER_DOUBLE)
if (counter_type (load, counter_id) == SYSPROF_CAPTURE_COUNTER_DOUBLE)
y = group->values[j].vdbl;
else
y = group->values[j].v64;
@ -659,7 +659,7 @@ sp_line_visualizer_row_load_data_range_cb (const SpCaptureFrame *frame,
}
static void
sp_line_visualizer_row_load_data_worker (GTask *task,
sysprof_line_visualizer_row_load_data_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
@ -668,7 +668,7 @@ sp_line_visualizer_row_load_data_worker (GTask *task,
g_autoptr(GArray) counter_ids = NULL;
g_assert (G_IS_TASK (task));
g_assert (SP_IS_LINE_VISUALIZER_ROW (source_object));
g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (source_object));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
counter_ids = g_array_new (FALSE, FALSE, sizeof (guint));
@ -679,41 +679,41 @@ sp_line_visualizer_row_load_data_worker (GTask *task,
g_array_append_val (counter_ids, line_info->id);
}
sp_capture_cursor_add_condition (load->cursor,
sp_capture_condition_new_where_counter_in (counter_ids->len,
sysprof_capture_cursor_add_condition (load->cursor,
sysprof_capture_condition_new_where_counter_in (counter_ids->len,
(guint *)(gpointer)counter_ids->data));
/* If y boundaries are not set, we need to discover them by scaning the data. */
if (!load->y_lower_set || !load->y_upper_set)
{
sp_capture_cursor_foreach (load->cursor, sp_line_visualizer_row_load_data_range_cb, load);
sp_capture_cursor_reset (load->cursor);
sysprof_capture_cursor_foreach (load->cursor, sysprof_line_visualizer_row_load_data_range_cb, load);
sysprof_capture_cursor_reset (load->cursor);
/* Add extra boundary for some space above the graph line */
if (G_MAXDOUBLE - load->y_upper > (load->y_upper * .25))
load->y_upper *= 1.25;
}
sp_capture_cursor_foreach (load->cursor, sp_line_visualizer_row_load_data_frame_cb, load);
sysprof_capture_cursor_foreach (load->cursor, sysprof_line_visualizer_row_load_data_frame_cb, load);
g_task_return_pointer (task, g_steal_pointer (&load->cache), (GDestroyNotify)point_cache_unref);
}
static void
sp_line_visualizer_row_load_data_async (SpLineVisualizerRow *self,
sysprof_line_visualizer_row_load_data_async (SysprofLineVisualizerRow *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_autoptr(GTask) task = NULL;
LoadData *load;
g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_priority (task, G_PRIORITY_LOW);
g_task_set_source_tag (task, sp_line_visualizer_row_load_data_async);
g_task_set_source_tag (task, sysprof_line_visualizer_row_load_data_async);
if (priv->reader == NULL)
{
@ -730,9 +730,9 @@ sp_line_visualizer_row_load_data_async (SpLineVisualizerRow *self,
load->y_upper = priv->y_upper;
load->y_lower_set = priv->y_lower_set;
load->y_upper_set = priv->y_upper_set;
load->begin_time = sp_capture_reader_get_start_time (priv->reader);
load->end_time = sp_capture_reader_get_end_time (priv->reader);
load->cursor = sp_capture_cursor_new (priv->reader);
load->begin_time = sysprof_capture_reader_get_start_time (priv->reader);
load->end_time = sysprof_capture_reader_get_end_time (priv->reader);
load->cursor = sysprof_capture_cursor_new (priv->reader);
load->lines = copy_array (priv->lines);
for (guint i = 0; i < load->lines->len; i++)
@ -743,18 +743,18 @@ sp_line_visualizer_row_load_data_async (SpLineVisualizerRow *self,
}
g_task_set_task_data (task, load, load_data_free);
g_task_run_in_thread (task, sp_line_visualizer_row_load_data_worker);
g_task_run_in_thread (task, sysprof_line_visualizer_row_load_data_worker);
}
static PointCache *
sp_line_visualizer_row_load_data_finish (SpLineVisualizerRow *self,
sysprof_line_visualizer_row_load_data_finish (SysprofLineVisualizerRow *self,
GAsyncResult *result,
GError **error)
{
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
LoadData *state;
g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
g_assert (G_IS_TASK (result));
state = g_task_get_task_data (G_TASK (result));
@ -775,13 +775,13 @@ sp_line_visualizer_row_load_data_finish (SpLineVisualizerRow *self,
}
void
sp_line_visualizer_row_set_line_width (SpLineVisualizerRow *self,
sysprof_line_visualizer_row_set_line_width (SysprofLineVisualizerRow *self,
guint counter_id,
gdouble width)
{
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_return_if_fail (SP_IS_LINE_VISUALIZER_ROW (self));
g_return_if_fail (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
for (guint i = 0; i < priv->lines->len; i++)
{
@ -790,20 +790,20 @@ sp_line_visualizer_row_set_line_width (SpLineVisualizerRow *self,
if (info->id == counter_id)
{
info->line_width = width;
sp_line_visualizer_row_queue_reload (self);
sysprof_line_visualizer_row_queue_reload (self);
break;
}
}
}
void
sp_line_visualizer_row_set_fill (SpLineVisualizerRow *self,
sysprof_line_visualizer_row_set_fill (SysprofLineVisualizerRow *self,
guint counter_id,
const GdkRGBA *color)
{
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_return_if_fail (SP_IS_LINE_VISUALIZER_ROW (self));
g_return_if_fail (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
for (guint i = 0; i < priv->lines->len; i++)
{
@ -814,7 +814,7 @@ sp_line_visualizer_row_set_fill (SpLineVisualizerRow *self,
info->fill = !!color;
if (color != NULL)
info->background = *color;
sp_line_visualizer_row_queue_reload (self);
sysprof_line_visualizer_row_queue_reload (self);
break;
}
}

View File

@ -1,4 +1,4 @@
/* sp-line-visualizer-row.h
/* sysprof-line-visualizer-row.h
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -20,21 +20,21 @@
#pragma once
#include "sp-visualizer-row.h"
#include "sysprof-visualizer-row.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_LINE_VISUALIZER_ROW (sp_line_visualizer_row_get_type())
#define SYSPROF_TYPE_LINE_VISUALIZER_ROW (sysprof_line_visualizer_row_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpLineVisualizerRow, sp_line_visualizer_row, SP, LINE_VISUALIZER_ROW, SpVisualizerRow)
G_DECLARE_DERIVABLE_TYPE (SysprofLineVisualizerRow, sysprof_line_visualizer_row, SYSPROF, LINE_VISUALIZER_ROW, SysprofVisualizerRow)
struct _SpLineVisualizerRowClass
struct _SysprofLineVisualizerRowClass
{
SpVisualizerRowClass parent_class;
SysprofVisualizerRowClass parent_class;
void (*counter_added) (SpLineVisualizerRow *self,
void (*counter_added) (SysprofLineVisualizerRow *self,
guint counter_id);
/*< private >*/
@ -42,19 +42,19 @@ struct _SpLineVisualizerRowClass
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_line_visualizer_row_new (void);
GtkWidget *sysprof_line_visualizer_row_new (void);
SYSPROF_AVAILABLE_IN_ALL
void sp_line_visualizer_row_clear (SpLineVisualizerRow *self);
void sysprof_line_visualizer_row_clear (SysprofLineVisualizerRow *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_line_visualizer_row_add_counter (SpLineVisualizerRow *self,
void sysprof_line_visualizer_row_add_counter (SysprofLineVisualizerRow *self,
guint counter_id,
const GdkRGBA *color);
SYSPROF_AVAILABLE_IN_ALL
void sp_line_visualizer_row_set_line_width (SpLineVisualizerRow *self,
void sysprof_line_visualizer_row_set_line_width (SysprofLineVisualizerRow *self,
guint counter_id,
gdouble width);
SYSPROF_AVAILABLE_IN_ALL
void sp_line_visualizer_row_set_fill (SpLineVisualizerRow *self,
void sysprof_line_visualizer_row_set_fill (SysprofLineVisualizerRow *self,
guint counter_id,
const GdkRGBA *color);

View File

@ -1,4 +1,4 @@
/* sp-mark-visualizer-row.c
/* sysprof-mark-visualizer-row.c
*
* Copyright 2018-2019 Christian Hergert <chergert@redhat.com>
*
@ -18,21 +18,21 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sp-mark-visualizer-row"
#define G_LOG_DOMAIN "sysprof-mark-visualizer-row"
#include "config.h"
#include "sp-capture-condition.h"
#include "sp-capture-cursor.h"
#include "sysprof-capture-condition.h"
#include "sysprof-capture-cursor.h"
#include "rectangles.h"
#include "sp-mark-visualizer-row.h"
#include "sysprof-mark-visualizer-row.h"
typedef struct
{
/*
* Our reader as assigned by the visualizer system.
*/
SpCaptureReader *reader;
SysprofCaptureReader *reader;
/*
* The group we care about for displaying marks. The idea is that we only
@ -51,12 +51,12 @@ typedef struct
* Child widget to display the label in the upper corner.
*/
GtkLabel *label;
} SpMarkVisualizerRowPrivate;
} SysprofMarkVisualizerRowPrivate;
typedef struct
{
gchar *group;
SpCaptureCursor *cursor;
SysprofCaptureCursor *cursor;
Rectangles *rects;
GHashTable *inferred_rects;
} BuildState;
@ -74,7 +74,7 @@ enum {
N_PROPS
};
G_DEFINE_TYPE_WITH_PRIVATE (SpMarkVisualizerRow, sp_mark_visualizer_row, SP_TYPE_VISUALIZER_ROW)
G_DEFINE_TYPE_WITH_PRIVATE (SysprofMarkVisualizerRow, sysprof_mark_visualizer_row, SYSPROF_TYPE_VISUALIZER_ROW)
static GParamSpec *properties [N_PROPS];
@ -116,7 +116,7 @@ build_state_free (BuildState *state)
*/
static gboolean
process_gpu_mark (BuildState *state,
const SpCaptureMark *mark)
const SysprofCaptureMark *mark)
{
InferredRect *rect = g_hash_table_lookup (state->inferred_rects,
mark->message);
@ -167,14 +167,14 @@ process_gpu_mark (BuildState *state,
static gboolean
sp_mark_visualizer_row_add_rect (const SpCaptureFrame *frame,
sysprof_mark_visualizer_row_add_rect (const SysprofCaptureFrame *frame,
gpointer user_data)
{
BuildState *state = user_data;
const SpCaptureMark *mark = (const SpCaptureMark *)frame;
const SysprofCaptureMark *mark = (const SysprofCaptureMark *)frame;
g_assert (frame != NULL);
g_assert (frame->type == SP_CAPTURE_FRAME_MARK);
g_assert (frame->type == SYSPROF_CAPTURE_FRAME_MARK);
g_assert (state != NULL);
g_assert (state->rects != NULL);
@ -195,7 +195,7 @@ sp_mark_visualizer_row_add_rect (const SpCaptureFrame *frame,
}
static void
sp_mark_visualizer_row_worker (GTask *task,
sysprof_mark_visualizer_row_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
@ -206,11 +206,11 @@ sp_mark_visualizer_row_worker (GTask *task,
gint64 end_time;
g_assert (G_IS_TASK (task));
g_assert (SP_IS_MARK_VISUALIZER_ROW (source_object));
g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (source_object));
g_assert (state != NULL);
g_assert (state->cursor != NULL);
sp_capture_cursor_foreach (state->cursor, sp_mark_visualizer_row_add_rect, state);
sysprof_capture_cursor_foreach (state->cursor, sysprof_mark_visualizer_row_add_rect, state);
/* If any inferred rects are left incomplete, just drop them in as
* point events for now.
@ -224,22 +224,22 @@ sp_mark_visualizer_row_worker (GTask *task,
}
g_hash_table_remove_all (state->inferred_rects);
end_time = sp_capture_reader_get_end_time (sp_capture_cursor_get_reader (state->cursor));
end_time = sysprof_capture_reader_get_end_time (sysprof_capture_cursor_get_reader (state->cursor));
rectangles_set_end_time (state->rects, end_time);
g_task_return_pointer (task, g_steal_pointer (&state->rects), (GDestroyNotify)rectangles_free);
}
static gboolean
sp_mark_visualizer_row_query_tooltip (GtkWidget *widget,
sysprof_mark_visualizer_row_query_tooltip (GtkWidget *widget,
gint x,
gint y,
gboolean keyboard_mode,
GtkTooltip *tooltip)
{
SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)widget;
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)widget;
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
g_assert (SP_IS_MARK_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
if (priv->rectangles == NULL)
return FALSE;
@ -248,23 +248,23 @@ sp_mark_visualizer_row_query_tooltip (GtkWidget *widget,
}
static gboolean
sp_mark_visualizer_row_draw (GtkWidget *widget,
sysprof_mark_visualizer_row_draw (GtkWidget *widget,
cairo_t *cr)
{
SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)widget;
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)widget;
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
GtkStyleContext *style_context;
GtkStateFlags flags;
GdkRGBA foreground;
GtkAllocation alloc;
gboolean ret;
g_assert (SP_IS_MARK_VISUALIZER_ROW (widget));
g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (widget));
g_assert (cr != NULL);
gtk_widget_get_allocation (widget, &alloc);
ret = GTK_WIDGET_CLASS (sp_mark_visualizer_row_parent_class)->draw (widget, cr);
ret = GTK_WIDGET_CLASS (sysprof_mark_visualizer_row_parent_class)->draw (widget, cr);
if (priv->rectangles == NULL)
return ret;
@ -283,10 +283,10 @@ data_load_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)object;
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)object;
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
g_assert (SP_IS_MARK_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
g_assert (G_IS_TASK (result));
g_clear_pointer (&priv->rectangles, rectangles_free);
@ -295,21 +295,21 @@ data_load_cb (GObject *object,
}
static void
sp_mark_visualizer_row_reload (SpMarkVisualizerRow *self)
sysprof_mark_visualizer_row_reload (SysprofMarkVisualizerRow *self)
{
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
g_autoptr(SpCaptureCursor) cursor = NULL;
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
g_autoptr(SysprofCaptureCursor) cursor = NULL;
g_autoptr(GTask) task = NULL;
SpCaptureCondition *condition;
SysprofCaptureCondition *condition;
BuildState *state;
g_assert (SP_IS_MARK_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
g_clear_pointer (&priv->rectangles, rectangles_free);
condition = sp_capture_condition_new_where_type_in (1, (SpCaptureFrameType[]) { SP_CAPTURE_FRAME_MARK });
cursor = sp_capture_cursor_new (priv->reader);
sp_capture_cursor_add_condition (cursor, g_steal_pointer (&condition));
condition = sysprof_capture_condition_new_where_type_in (1, (SysprofCaptureFrameType[]) { SYSPROF_CAPTURE_FRAME_MARK });
cursor = sysprof_capture_cursor_new (priv->reader);
sysprof_capture_cursor_add_condition (cursor, g_steal_pointer (&condition));
state = g_slice_new0 (BuildState);
state->inferred_rects = g_hash_table_new_full (g_str_hash, g_str_equal,
@ -317,57 +317,57 @@ sp_mark_visualizer_row_reload (SpMarkVisualizerRow *self)
(GDestroyNotify)free_inferred_rect);
state->group = g_strdup (priv->group);
state->cursor = g_steal_pointer (&cursor);
state->rects = rectangles_new (sp_capture_reader_get_start_time (priv->reader),
sp_capture_reader_get_end_time (priv->reader));
state->rects = rectangles_new (sysprof_capture_reader_get_start_time (priv->reader),
sysprof_capture_reader_get_end_time (priv->reader));
task = g_task_new (self, NULL, data_load_cb, NULL);
g_task_set_task_data (task, state, (GDestroyNotify)build_state_free);
g_task_run_in_thread (task, sp_mark_visualizer_row_worker);
g_task_run_in_thread (task, sysprof_mark_visualizer_row_worker);
}
static void
sp_mark_visualizer_row_set_reader (SpVisualizerRow *row,
SpCaptureReader *reader)
sysprof_mark_visualizer_row_set_reader (SysprofVisualizerRow *row,
SysprofCaptureReader *reader)
{
SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)row;
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)row;
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
g_assert (SP_IS_MARK_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
if (reader != priv->reader)
{
g_clear_pointer (&priv->reader, sp_capture_reader_unref);
g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (reader != NULL)
priv->reader = sp_capture_reader_ref (reader);
sp_mark_visualizer_row_reload (self);
priv->reader = sysprof_capture_reader_ref (reader);
sysprof_mark_visualizer_row_reload (self);
}
}
static void
sp_mark_visualizer_row_finalize (GObject *object)
sysprof_mark_visualizer_row_finalize (GObject *object)
{
SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)object;
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)object;
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
g_clear_pointer (&priv->group, g_free);
g_clear_pointer (&priv->rectangles, rectangles_free);
G_OBJECT_CLASS (sp_mark_visualizer_row_parent_class)->finalize (object);
G_OBJECT_CLASS (sysprof_mark_visualizer_row_parent_class)->finalize (object);
}
static void
sp_mark_visualizer_row_get_property (GObject *object,
sysprof_mark_visualizer_row_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpMarkVisualizerRow *self = SP_MARK_VISUALIZER_ROW (object);
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRow *self = SYSPROF_MARK_VISUALIZER_ROW (object);
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
switch (prop_id)
{
case PROP_GROUP:
g_value_set_string (value, sp_mark_visualizer_row_get_group (self));
g_value_set_string (value, sysprof_mark_visualizer_row_get_group (self));
break;
case PROP_TITLE:
@ -380,18 +380,18 @@ sp_mark_visualizer_row_get_property (GObject *object,
}
static void
sp_mark_visualizer_row_set_property (GObject *object,
sysprof_mark_visualizer_row_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpMarkVisualizerRow *self = SP_MARK_VISUALIZER_ROW (object);
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRow *self = SYSPROF_MARK_VISUALIZER_ROW (object);
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
switch (prop_id)
{
case PROP_GROUP:
sp_mark_visualizer_row_set_group (self, g_value_get_string (value));
sysprof_mark_visualizer_row_set_group (self, g_value_get_string (value));
break;
case PROP_TITLE:
@ -404,20 +404,20 @@ sp_mark_visualizer_row_set_property (GObject *object,
}
static void
sp_mark_visualizer_row_class_init (SpMarkVisualizerRowClass *klass)
sysprof_mark_visualizer_row_class_init (SysprofMarkVisualizerRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
SpVisualizerRowClass *visualizer_class = SP_VISUALIZER_ROW_CLASS (klass);
SysprofVisualizerRowClass *visualizer_class = SYSPROF_VISUALIZER_ROW_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = sp_mark_visualizer_row_finalize;
object_class->get_property = sp_mark_visualizer_row_get_property;
object_class->set_property = sp_mark_visualizer_row_set_property;
object_class->finalize = sysprof_mark_visualizer_row_finalize;
object_class->get_property = sysprof_mark_visualizer_row_get_property;
object_class->set_property = sysprof_mark_visualizer_row_set_property;
widget_class->draw = sp_mark_visualizer_row_draw;
widget_class->query_tooltip = sp_mark_visualizer_row_query_tooltip;
widget_class->draw = sysprof_mark_visualizer_row_draw;
widget_class->query_tooltip = sysprof_mark_visualizer_row_query_tooltip;
visualizer_class->set_reader = sp_mark_visualizer_row_set_reader;
visualizer_class->set_reader = sysprof_mark_visualizer_row_set_reader;
properties [PROP_GROUP] =
g_param_spec_string ("group",
@ -437,9 +437,9 @@ sp_mark_visualizer_row_class_init (SpMarkVisualizerRowClass *klass)
}
static void
sp_mark_visualizer_row_init (SpMarkVisualizerRow *self)
sysprof_mark_visualizer_row_init (SysprofMarkVisualizerRow *self)
{
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
PangoAttrList *attrs = pango_attr_list_new ();
gtk_widget_set_has_tooltip (GTK_WIDGET (self), TRUE);
@ -458,28 +458,28 @@ sp_mark_visualizer_row_init (SpMarkVisualizerRow *self)
}
GtkWidget *
sp_mark_visualizer_row_new (void)
sysprof_mark_visualizer_row_new (void)
{
return g_object_new (SP_TYPE_MARK_VISUALIZER_ROW, NULL);
return g_object_new (SYSPROF_TYPE_MARK_VISUALIZER_ROW, NULL);
}
const gchar *
sp_mark_visualizer_row_get_group (SpMarkVisualizerRow *self)
sysprof_mark_visualizer_row_get_group (SysprofMarkVisualizerRow *self)
{
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
g_return_val_if_fail (SP_IS_MARK_VISUALIZER_ROW (self), NULL);
g_return_val_if_fail (SYSPROF_IS_MARK_VISUALIZER_ROW (self), NULL);
return priv->group;
}
void
sp_mark_visualizer_row_set_group (SpMarkVisualizerRow *self,
sysprof_mark_visualizer_row_set_group (SysprofMarkVisualizerRow *self,
const gchar *group)
{
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
g_return_if_fail (SP_IS_MARK_VISUALIZER_ROW (self));
g_return_if_fail (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
if (g_strcmp0 (priv->group, group) != 0)
{

View File

@ -1,4 +1,4 @@
/* sp-mark-visualizer-row.h
/* sysprof-mark-visualizer-row.h
*
* Copyright 2018-2019 Christian Hergert <chergert@redhat.com>
*
@ -20,30 +20,30 @@
#pragma once
#include "sp-visualizer-row.h"
#include "sysprof-visualizer-row.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_MARK_VISUALIZER_ROW (sp_mark_visualizer_row_get_type())
#define SYSPROF_TYPE_MARK_VISUALIZER_ROW (sysprof_mark_visualizer_row_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpMarkVisualizerRow, sp_mark_visualizer_row, SP, MARK_VISUALIZER_ROW, SpVisualizerRow)
G_DECLARE_DERIVABLE_TYPE (SysprofMarkVisualizerRow, sysprof_mark_visualizer_row, SYSPROF, MARK_VISUALIZER_ROW, SysprofVisualizerRow)
struct _SpMarkVisualizerRowClass
struct _SysprofMarkVisualizerRowClass
{
SpVisualizerRowClass parent_class;
SysprofVisualizerRowClass parent_class;
/*< private >*/
gpointer _reserved[16];
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_mark_visualizer_row_new (void);
GtkWidget *sysprof_mark_visualizer_row_new (void);
SYSPROF_AVAILABLE_IN_ALL
const gchar *sp_mark_visualizer_row_get_group (SpMarkVisualizerRow *self);
const gchar *sysprof_mark_visualizer_row_get_group (SysprofMarkVisualizerRow *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_mark_visualizer_row_set_group (SpMarkVisualizerRow *self,
void sysprof_mark_visualizer_row_set_group (SysprofMarkVisualizerRow *self,
const gchar *group);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-model-filter.c
/* sysprof-model-filter.c
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -20,13 +20,13 @@
#include "config.h"
#include "sp-model-filter.h"
#include "sysprof-model-filter.h"
typedef struct
{
GSequenceIter *child_iter;
GSequenceIter *filter_iter;
} SpModelFilterItem;
} SysprofModelFilterItem;
typedef struct
{
@ -34,7 +34,7 @@ typedef struct
GListModel *child_model;
/*
* Both sequences point to the same SpModelFilterItem which
* Both sequences point to the same SysprofModelFilterItem which
* contains cross-referencing stable GSequenceIter pointers.
* The child_seq is considered the "owner" and used to release
* allocated resources.
@ -46,7 +46,7 @@ typedef struct
* Typical set of callback/closure/free function pointers and data.
* Called for child items to determine visibility state.
*/
SpModelFilterFunc filter_func;
SysprofModelFilterFunc filter_func;
gpointer filter_func_data;
GDestroyNotify filter_func_data_destroy;
@ -56,12 +56,12 @@ typedef struct
* that have changed.
*/
guint supress_items_changed : 1;
} SpModelFilterPrivate;
} SysprofModelFilterPrivate;
static void list_model_iface_init (GListModelInterface *iface);
G_DEFINE_TYPE_EXTENDED (SpModelFilter, sp_model_filter, G_TYPE_OBJECT, 0,
G_ADD_PRIVATE (SpModelFilter)
G_DEFINE_TYPE_EXTENDED (SysprofModelFilter, sysprof_model_filter, G_TYPE_OBJECT, 0,
G_ADD_PRIVATE (SysprofModelFilter)
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
list_model_iface_init))
@ -75,17 +75,17 @@ static GParamSpec *properties [N_PROPS];
static guint signal_id;
static void
sp_model_filter_item_free (gpointer data)
sysprof_model_filter_item_free (gpointer data)
{
SpModelFilterItem *item = data;
SysprofModelFilterItem *item = data;
g_clear_pointer (&item->filter_iter, g_sequence_remove);
item->child_iter = NULL;
g_slice_free (SpModelFilterItem, item);
g_slice_free (SysprofModelFilterItem, item);
}
static gboolean
sp_model_filter_default_filter_func (GObject *item,
sysprof_model_filter_default_filter_func (GObject *item,
gpointer user_data)
{
return TRUE;
@ -101,17 +101,17 @@ sp_model_filter_default_filter_func (GObject *item,
* Returns: a #GSequenceIter from the filter sequence.
*/
static GSequenceIter *
find_next_visible_filter_iter (SpModelFilter *self,
find_next_visible_filter_iter (SysprofModelFilter *self,
GSequenceIter *iter)
{
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
g_assert (SP_IS_MODEL_FILTER (self));
g_assert (SYSPROF_IS_MODEL_FILTER (self));
g_assert (iter != NULL);
for (; !g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter))
{
SpModelFilterItem *item = g_sequence_get (iter);
SysprofModelFilterItem *item = g_sequence_get (iter);
g_assert (item->child_iter == iter);
g_assert (item->filter_iter == NULL ||
@ -125,16 +125,16 @@ find_next_visible_filter_iter (SpModelFilter *self,
}
static void
sp_model_filter_child_model_items_changed (SpModelFilter *self,
sysprof_model_filter_child_model_items_changed (SysprofModelFilter *self,
guint position,
guint n_removed,
guint n_added,
GListModel *child_model)
{
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
gboolean unblocked;
g_assert (SP_IS_MODEL_FILTER (self));
g_assert (SYSPROF_IS_MODEL_FILTER (self));
g_assert (G_IS_LIST_MODEL (child_model));
g_assert (priv->child_model == child_model);
g_assert (position <= (guint)g_sequence_get_length (priv->child_seq));
@ -164,7 +164,7 @@ sp_model_filter_child_model_items_changed (SpModelFilter *self,
for (guint i = 0; i < n_removed; i++)
{
GSequenceIter *to_remove = iter;
SpModelFilterItem *item = g_sequence_get (iter);
SysprofModelFilterItem *item = g_sequence_get (iter);
g_assert (item != NULL);
g_assert (item->child_iter == iter);
@ -207,9 +207,9 @@ add_new_items:
for (guint i = position + n_added; i > position; i--)
{
g_autoptr(GObject) instance = NULL;
SpModelFilterItem *item;
SysprofModelFilterItem *item;
item = g_slice_new0 (SpModelFilterItem);
item = g_slice_new0 (SysprofModelFilterItem);
item->filter_iter = NULL;
item->child_iter = g_sequence_insert_before (iter, item);
@ -240,10 +240,10 @@ add_new_items:
}
static void
sp_model_filter_finalize (GObject *object)
sysprof_model_filter_finalize (GObject *object)
{
SpModelFilter *self = (SpModelFilter *)object;
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SysprofModelFilter *self = (SysprofModelFilter *)object;
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
g_clear_pointer (&priv->child_seq, g_sequence_free);
g_clear_pointer (&priv->filter_seq, g_sequence_free);
@ -256,21 +256,21 @@ sp_model_filter_finalize (GObject *object)
g_clear_object (&priv->child_model);
G_OBJECT_CLASS (sp_model_filter_parent_class)->finalize (object);
G_OBJECT_CLASS (sysprof_model_filter_parent_class)->finalize (object);
}
static void
sp_model_filter_get_property (GObject *object,
sysprof_model_filter_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpModelFilter *self = SP_MODEL_FILTER (object);
SysprofModelFilter *self = SYSPROF_MODEL_FILTER (object);
switch (prop_id)
{
case PROP_CHILD_MODEL:
g_value_set_object (value, sp_model_filter_get_child_model (self));
g_value_set_object (value, sysprof_model_filter_get_child_model (self));
break;
default:
@ -279,12 +279,12 @@ sp_model_filter_get_property (GObject *object,
}
static void
sp_model_filter_class_init (SpModelFilterClass *klass)
sysprof_model_filter_class_init (SysprofModelFilterClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = sp_model_filter_finalize;
object_class->get_property = sp_model_filter_get_property;
object_class->finalize = sysprof_model_filter_finalize;
object_class->get_property = sysprof_model_filter_get_property;
properties [PROP_CHILD_MODEL] =
g_param_spec_object ("child-model",
@ -295,53 +295,53 @@ sp_model_filter_class_init (SpModelFilterClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
signal_id = g_signal_lookup ("items-changed", SP_TYPE_MODEL_FILTER);
signal_id = g_signal_lookup ("items-changed", SYSPROF_TYPE_MODEL_FILTER);
}
static void
sp_model_filter_init (SpModelFilter *self)
sysprof_model_filter_init (SysprofModelFilter *self)
{
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
priv->filter_func = sp_model_filter_default_filter_func;
priv->child_seq = g_sequence_new (sp_model_filter_item_free);
priv->filter_func = sysprof_model_filter_default_filter_func;
priv->child_seq = g_sequence_new (sysprof_model_filter_item_free);
priv->filter_seq = g_sequence_new (NULL);
}
static GType
sp_model_filter_get_item_type (GListModel *model)
sysprof_model_filter_get_item_type (GListModel *model)
{
SpModelFilter *self = (SpModelFilter *)model;
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SysprofModelFilter *self = (SysprofModelFilter *)model;
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
g_assert (SP_IS_MODEL_FILTER (self));
g_assert (SYSPROF_IS_MODEL_FILTER (self));
return g_list_model_get_item_type (priv->child_model);
}
static guint
sp_model_filter_get_n_items (GListModel *model)
sysprof_model_filter_get_n_items (GListModel *model)
{
SpModelFilter *self = (SpModelFilter *)model;
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SysprofModelFilter *self = (SysprofModelFilter *)model;
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
g_assert (SP_IS_MODEL_FILTER (self));
g_assert (SYSPROF_IS_MODEL_FILTER (self));
g_assert (priv->filter_seq != NULL);
return g_sequence_get_length (priv->filter_seq);
}
static gpointer
sp_model_filter_get_item (GListModel *model,
sysprof_model_filter_get_item (GListModel *model,
guint position)
{
SpModelFilter *self = (SpModelFilter *)model;
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SpModelFilterItem *item;
SysprofModelFilter *self = (SysprofModelFilter *)model;
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
SysprofModelFilterItem *item;
GSequenceIter *iter;
guint child_position;
g_assert (SP_IS_MODEL_FILTER (self));
g_assert (SYSPROF_IS_MODEL_FILTER (self));
g_assert (position < (guint)g_sequence_get_length (priv->filter_seq));
iter = g_sequence_get_iter_at_pos (priv->filter_seq, position);
@ -361,59 +361,59 @@ sp_model_filter_get_item (GListModel *model,
static void
list_model_iface_init (GListModelInterface *iface)
{
iface->get_item_type = sp_model_filter_get_item_type;
iface->get_n_items = sp_model_filter_get_n_items;
iface->get_item = sp_model_filter_get_item;
iface->get_item_type = sysprof_model_filter_get_item_type;
iface->get_n_items = sysprof_model_filter_get_n_items;
iface->get_item = sysprof_model_filter_get_item;
}
SpModelFilter *
sp_model_filter_new (GListModel *child_model)
SysprofModelFilter *
sysprof_model_filter_new (GListModel *child_model)
{
SpModelFilter *ret;
SpModelFilterPrivate *priv;
SysprofModelFilter *ret;
SysprofModelFilterPrivate *priv;
g_return_val_if_fail (G_IS_LIST_MODEL (child_model), NULL);
ret = g_object_new (SP_TYPE_MODEL_FILTER, NULL);
priv = sp_model_filter_get_instance_private (ret);
ret = g_object_new (SYSPROF_TYPE_MODEL_FILTER, NULL);
priv = sysprof_model_filter_get_instance_private (ret);
priv->child_model = g_object_ref (child_model);
g_signal_connect_object (child_model,
"items-changed",
G_CALLBACK (sp_model_filter_child_model_items_changed),
G_CALLBACK (sysprof_model_filter_child_model_items_changed),
ret,
G_CONNECT_SWAPPED);
sp_model_filter_invalidate (ret);
sysprof_model_filter_invalidate (ret);
return ret;
}
/**
* sp_model_filter_get_child_model:
* @self: A #SpModelFilter
* sysprof_model_filter_get_child_model:
* @self: A #SysprofModelFilter
*
* Gets the child model that is being filtered.
*
* Returns: (transfer none): A #GListModel.
*/
GListModel *
sp_model_filter_get_child_model (SpModelFilter *self)
sysprof_model_filter_get_child_model (SysprofModelFilter *self)
{
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
g_return_val_if_fail (SP_IS_MODEL_FILTER (self), NULL);
g_return_val_if_fail (SYSPROF_IS_MODEL_FILTER (self), NULL);
return priv->child_model;
}
void
sp_model_filter_invalidate (SpModelFilter *self)
sysprof_model_filter_invalidate (SysprofModelFilter *self)
{
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
guint n_items;
g_return_if_fail (SP_IS_MODEL_FILTER (self));
g_return_if_fail (SYSPROF_IS_MODEL_FILTER (self));
/* We block emission while in invalidate so that we can use
* a single larger items-changed rather lots of small emissions.
@ -448,7 +448,7 @@ sp_model_filter_invalidate (SpModelFilter *self)
* we get populate our sequence and filter sequence.
*/
child_n_items = g_list_model_get_n_items (priv->child_model);
sp_model_filter_child_model_items_changed (self, 0, 0, child_n_items, priv->child_model);
sysprof_model_filter_child_model_items_changed (self, 0, 0, child_n_items, priv->child_model);
g_assert ((guint)g_sequence_get_length (priv->child_seq) == child_n_items);
g_assert ((guint)g_sequence_get_length (priv->filter_seq) <= child_n_items);
@ -467,14 +467,14 @@ sp_model_filter_invalidate (SpModelFilter *self)
}
void
sp_model_filter_set_filter_func (SpModelFilter *self,
SpModelFilterFunc filter_func,
sysprof_model_filter_set_filter_func (SysprofModelFilter *self,
SysprofModelFilterFunc filter_func,
gpointer filter_func_data,
GDestroyNotify filter_func_data_destroy)
{
SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
g_return_if_fail (SP_IS_MODEL_FILTER (self));
g_return_if_fail (SYSPROF_IS_MODEL_FILTER (self));
g_return_if_fail (filter_func || (!filter_func_data && !filter_func_data_destroy));
if (priv->filter_func_data_destroy != NULL)
@ -488,10 +488,10 @@ sp_model_filter_set_filter_func (SpModelFilter *self,
}
else
{
priv->filter_func = sp_model_filter_default_filter_func;
priv->filter_func = sysprof_model_filter_default_filter_func;
priv->filter_func_data = NULL;
priv->filter_func_data_destroy = NULL;
}
sp_model_filter_invalidate (self);
sysprof_model_filter_invalidate (self);
}

View File

@ -1,4 +1,4 @@
/* sp-model-filter.h
/* sysprof-model-filter.h
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -26,15 +26,15 @@
G_BEGIN_DECLS
#define SP_TYPE_MODEL_FILTER (sp_model_filter_get_type())
#define SYSPROF_TYPE_MODEL_FILTER (sysprof_model_filter_get_type())
typedef gboolean (*SpModelFilterFunc) (GObject *object,
typedef gboolean (*SysprofModelFilterFunc) (GObject *object,
gpointer user_data);
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpModelFilter, sp_model_filter, SP, MODEL_FILTER, GObject)
G_DECLARE_DERIVABLE_TYPE (SysprofModelFilter, sysprof_model_filter, SYSPROF, MODEL_FILTER, GObject)
struct _SpModelFilterClass
struct _SysprofModelFilterClass
{
GObjectClass parent_class;
@ -42,14 +42,14 @@ struct _SpModelFilterClass
};
SYSPROF_AVAILABLE_IN_ALL
SpModelFilter *sp_model_filter_new (GListModel *child_model);
SysprofModelFilter *sysprof_model_filter_new (GListModel *child_model);
SYSPROF_AVAILABLE_IN_ALL
GListModel *sp_model_filter_get_child_model (SpModelFilter *self);
GListModel *sysprof_model_filter_get_child_model (SysprofModelFilter *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_model_filter_invalidate (SpModelFilter *self);
void sysprof_model_filter_invalidate (SysprofModelFilter *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_model_filter_set_filter_func (SpModelFilter *self,
SpModelFilterFunc filter_func,
void sysprof_model_filter_set_filter_func (SysprofModelFilter *self,
SysprofModelFilterFunc filter_func,
gpointer filter_func_data,
GDestroyNotify filter_func_data_destroy);

View File

@ -1,4 +1,4 @@
/* sp-multi-paned.h
/* sysprof-multi-paned.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -27,18 +27,18 @@
G_BEGIN_DECLS
#define SP_TYPE_MULTI_PANED (sp_multi_paned_get_type())
#define SYSPROF_TYPE_MULTI_PANED (sysprof_multi_paned_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpMultiPaned, sp_multi_paned, SP, MULTI_PANED, GtkContainer)
G_DECLARE_DERIVABLE_TYPE (SysprofMultiPaned, sysprof_multi_paned, SYSPROF, MULTI_PANED, GtkContainer)
struct _SpMultiPanedClass
struct _SysprofMultiPanedClass
{
GtkContainerClass parent;
void (*resize_drag_begin) (SpMultiPaned *self,
void (*resize_drag_begin) (SysprofMultiPaned *self,
GtkWidget *child);
void (*resize_drag_end) (SpMultiPaned *self,
void (*resize_drag_end) (SysprofMultiPaned *self,
GtkWidget *child);
gpointer _reserved1;
@ -52,8 +52,8 @@ struct _SpMultiPanedClass
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_multi_paned_new (void);
GtkWidget *sysprof_multi_paned_new (void);
SYSPROF_AVAILABLE_IN_ALL
guint sp_multi_paned_get_n_children (SpMultiPaned *self);
guint sysprof_multi_paned_get_n_children (SysprofMultiPaned *self);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-process-model-row.c
/* sysprof-process-model-row.c
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -20,20 +20,20 @@
#include "config.h"
#include "sp-process-model-row.h"
#include "sysprof-process-model-row.h"
typedef struct
{
SpProcessModelItem *item;
SysprofProcessModelItem *item;
GtkLabel *args_label;
GtkLabel *label;
GtkLabel *pid;
GtkImage *image;
GtkImage *check;
} SpProcessModelRowPrivate;
} SysprofProcessModelRowPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (SpProcessModelRow, sp_process_model_row, GTK_TYPE_LIST_BOX_ROW)
G_DEFINE_TYPE_WITH_PRIVATE (SysprofProcessModelRow, sysprof_process_model_row, GTK_TYPE_LIST_BOX_ROW)
enum {
PROP_0,
@ -45,31 +45,31 @@ enum {
static GParamSpec *properties [N_PROPS];
GtkWidget *
sp_process_model_row_new (SpProcessModelItem *item)
sysprof_process_model_row_new (SysprofProcessModelItem *item)
{
return g_object_new (SP_TYPE_PROCESS_MODEL_ROW,
return g_object_new (SYSPROF_TYPE_PROCESS_MODEL_ROW,
"item", item,
NULL);
}
SpProcessModelItem *
sp_process_model_row_get_item (SpProcessModelRow *self)
SysprofProcessModelItem *
sysprof_process_model_row_get_item (SysprofProcessModelRow *self)
{
SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
g_return_val_if_fail (SP_IS_PROCESS_MODEL_ROW (self), NULL);
g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL_ROW (self), NULL);
return priv->item;
}
static void
sp_process_model_row_set_item (SpProcessModelRow *self,
SpProcessModelItem *item)
sysprof_process_model_row_set_item (SysprofProcessModelRow *self,
SysprofProcessModelItem *item)
{
SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
g_assert (SP_IS_PROCESS_MODEL_ROW (self));
g_assert (SP_IS_PROCESS_MODEL_ITEM (item));
g_assert (SYSPROF_IS_PROCESS_MODEL_ROW (self));
g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (item));
if (g_set_object (&priv->item, item))
{
@ -79,11 +79,11 @@ sp_process_model_row_set_item (SpProcessModelRow *self,
const gchar * const *argv;
GPid pid;
command_line = sp_process_model_item_get_command_line (item);
command_line = sysprof_process_model_item_get_command_line (item);
parts = g_strsplit (command_line ?: "", "\n", 0);
gtk_label_set_label (priv->label, parts [0]);
if ((NULL != (argv = sp_process_model_item_get_argv (item))) && (argv[0] != NULL))
if ((NULL != (argv = sysprof_process_model_item_get_argv (item))) && (argv[0] != NULL))
{
g_autofree gchar *argvstr = g_strjoinv (" ", (gchar **)&argv[1]);
g_autofree gchar *escaped = g_markup_escape_text (argvstr, -1);
@ -91,7 +91,7 @@ sp_process_model_row_set_item (SpProcessModelRow *self,
gtk_label_set_label (priv->args_label, escaped);
}
pid = sp_process_model_item_get_pid (item);
pid = sysprof_process_model_item_get_pid (item);
pidstr = g_strdup_printf ("<small>%u</small>", pid);
gtk_label_set_label (priv->pid, pidstr);
gtk_label_set_use_markup (priv->pid, TRUE);
@ -99,26 +99,26 @@ sp_process_model_row_set_item (SpProcessModelRow *self,
}
gboolean
sp_process_model_row_get_selected (SpProcessModelRow *self)
sysprof_process_model_row_get_selected (SysprofProcessModelRow *self)
{
SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
g_return_val_if_fail (SP_IS_PROCESS_MODEL_ROW (self), FALSE);
g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL_ROW (self), FALSE);
return gtk_widget_get_visible (GTK_WIDGET (priv->check));
}
void
sp_process_model_row_set_selected (SpProcessModelRow *self,
sysprof_process_model_row_set_selected (SysprofProcessModelRow *self,
gboolean selected)
{
SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
g_return_if_fail (SP_IS_PROCESS_MODEL_ROW (self));
g_return_if_fail (SYSPROF_IS_PROCESS_MODEL_ROW (self));
selected = !!selected;
if (selected != sp_process_model_row_get_selected (self))
if (selected != sysprof_process_model_row_get_selected (self))
{
gtk_widget_set_visible (GTK_WIDGET (priv->check), selected);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SELECTED]);
@ -126,21 +126,21 @@ sp_process_model_row_set_selected (SpProcessModelRow *self,
}
static gboolean
sp_process_model_row_query_tooltip (GtkWidget *widget,
sysprof_process_model_row_query_tooltip (GtkWidget *widget,
gint x,
gint y,
gboolean keyboard_mode,
GtkTooltip *tooltip)
{
SpProcessModelRow *self = (SpProcessModelRow *)widget;
SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
SysprofProcessModelRow *self = (SysprofProcessModelRow *)widget;
SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
g_assert (SP_IS_PROCESS_MODEL_ROW (self));
g_assert (SYSPROF_IS_PROCESS_MODEL_ROW (self));
g_assert (GTK_IS_TOOLTIP (tooltip));
if (priv->item != NULL)
{
const gchar * const *argv = sp_process_model_item_get_argv (priv->item);
const gchar * const *argv = sysprof_process_model_item_get_argv (priv->item);
if (argv != NULL)
{
@ -154,32 +154,32 @@ sp_process_model_row_query_tooltip (GtkWidget *widget,
}
static void
sp_process_model_row_finalize (GObject *object)
sysprof_process_model_row_finalize (GObject *object)
{
SpProcessModelRow *self = (SpProcessModelRow *)object;
SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
SysprofProcessModelRow *self = (SysprofProcessModelRow *)object;
SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
g_clear_object (&priv->item);
G_OBJECT_CLASS (sp_process_model_row_parent_class)->finalize (object);
G_OBJECT_CLASS (sysprof_process_model_row_parent_class)->finalize (object);
}
static void
sp_process_model_row_get_property (GObject *object,
sysprof_process_model_row_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpProcessModelRow *self = SP_PROCESS_MODEL_ROW (object);
SysprofProcessModelRow *self = SYSPROF_PROCESS_MODEL_ROW (object);
switch (prop_id)
{
case PROP_ITEM:
g_value_set_object (value, sp_process_model_row_get_item (self));
g_value_set_object (value, sysprof_process_model_row_get_item (self));
break;
case PROP_SELECTED:
g_value_set_boolean (value, sp_process_model_row_get_selected (self));
g_value_set_boolean (value, sysprof_process_model_row_get_selected (self));
break;
default:
@ -188,21 +188,21 @@ sp_process_model_row_get_property (GObject *object,
}
static void
sp_process_model_row_set_property (GObject *object,
sysprof_process_model_row_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpProcessModelRow *self = SP_PROCESS_MODEL_ROW (object);
SysprofProcessModelRow *self = SYSPROF_PROCESS_MODEL_ROW (object);
switch (prop_id)
{
case PROP_ITEM:
sp_process_model_row_set_item (self, g_value_get_object (value));
sysprof_process_model_row_set_item (self, g_value_get_object (value));
break;
case PROP_SELECTED:
sp_process_model_row_set_selected (self, g_value_get_boolean (value));
sysprof_process_model_row_set_selected (self, g_value_get_boolean (value));
break;
default:
@ -211,22 +211,22 @@ sp_process_model_row_set_property (GObject *object,
}
static void
sp_process_model_row_class_init (SpProcessModelRowClass *klass)
sysprof_process_model_row_class_init (SysprofProcessModelRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = sp_process_model_row_finalize;
object_class->get_property = sp_process_model_row_get_property;
object_class->set_property = sp_process_model_row_set_property;
object_class->finalize = sysprof_process_model_row_finalize;
object_class->get_property = sysprof_process_model_row_get_property;
object_class->set_property = sysprof_process_model_row_set_property;
widget_class->query_tooltip = sp_process_model_row_query_tooltip;
widget_class->query_tooltip = sysprof_process_model_row_query_tooltip;
properties [PROP_ITEM] =
g_param_spec_object ("item",
"Item",
"Item",
SP_TYPE_PROCESS_MODEL_ITEM,
SYSPROF_TYPE_PROCESS_MODEL_ITEM,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_SELECTED] =
@ -239,16 +239,16 @@ sp_process_model_row_class_init (SpProcessModelRowClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/sysprof/ui/sp-process-model-row.ui");
gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, args_label);
gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, image);
gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, label);
gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, pid);
gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, check);
"/org/gnome/sysprof/ui/sysprof-process-model-row.ui");
gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, args_label);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, image);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, label);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, pid);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, check);
}
static void
sp_process_model_row_init (SpProcessModelRow *self)
sysprof_process_model_row_init (SysprofProcessModelRow *self)
{
gtk_widget_init_template (GTK_WIDGET (self));

View File

@ -1,4 +1,4 @@
/* sp-process-model-row.h
/* sysprof-process-model-row.h
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -22,17 +22,17 @@
#include <gtk/gtk.h>
#include "sp-process-model-item.h"
#include "sysprof-process-model-item.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_PROCESS_MODEL_ROW (sp_process_model_row_get_type())
#define SYSPROF_TYPE_PROCESS_MODEL_ROW (sysprof_process_model_row_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpProcessModelRow, sp_process_model_row, SP, PROCESS_MODEL_ROW, GtkListBoxRow)
G_DECLARE_DERIVABLE_TYPE (SysprofProcessModelRow, sysprof_process_model_row, SYSPROF, PROCESS_MODEL_ROW, GtkListBoxRow)
struct _SpProcessModelRowClass
struct _SysprofProcessModelRowClass
{
GtkListBoxRowClass parent;
@ -40,13 +40,13 @@ struct _SpProcessModelRowClass
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_process_model_row_new (SpProcessModelItem *item);
GtkWidget *sysprof_process_model_row_new (SysprofProcessModelItem *item);
SYSPROF_AVAILABLE_IN_ALL
SpProcessModelItem *sp_process_model_row_get_item (SpProcessModelRow *self);
SysprofProcessModelItem *sysprof_process_model_row_get_item (SysprofProcessModelRow *self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_process_model_row_get_selected (SpProcessModelRow *self);
gboolean sysprof_process_model_row_get_selected (SysprofProcessModelRow *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_process_model_row_set_selected (SpProcessModelRow *self,
void sysprof_process_model_row_set_selected (SysprofProcessModelRow *self,
gboolean selected);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-profiler-menu-button.c
/* sysprof-profiler-menu-button.c
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -23,16 +23,16 @@
#include <glib/gi18n.h>
#include <string.h>
#include "sp-model-filter.h"
#include "sp-process-model.h"
#include "sp-process-model-item.h"
#include "sp-process-model-row.h"
#include "sp-profiler-menu-button.h"
#include "sysprof-model-filter.h"
#include "sysprof-process-model.h"
#include "sysprof-process-model-item.h"
#include "sysprof-process-model-row.h"
#include "sysprof-profiler-menu-button.h"
typedef struct
{
SpProfiler *profiler;
SpModelFilter *process_filter;
SysprofProfiler *profiler;
SysprofModelFilter *process_filter;
/* Gtk template widgets */
GtkTreeModel *environment_model;
@ -40,7 +40,7 @@ typedef struct
GtkPopover *popover;
GtkEntry *process_filter_entry;
GtkListBox *process_list_box;
SpProcessModel *process_model;
SysprofProcessModel *process_model;
GtkBox *processes_box;
GtkEntry *spawn_entry;
GtkStack *stack;
@ -63,9 +63,9 @@ typedef struct
/* GSources */
guint save_env_source;
} SpProfilerMenuButtonPrivate;
} SysprofProfilerMenuButtonPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (SpProfilerMenuButton, sp_profiler_menu_button, GTK_TYPE_MENU_BUTTON)
G_DEFINE_TYPE_WITH_PRIVATE (SysprofProfilerMenuButton, sysprof_profiler_menu_button, GTK_TYPE_MENU_BUTTON)
enum {
PROP_0,
@ -73,32 +73,32 @@ enum {
N_PROPS
};
static void sp_profiler_menu_button_env_row_changed (SpProfilerMenuButton *self,
static void sysprof_profiler_menu_button_env_row_changed (SysprofProfilerMenuButton *self,
GtkTreePath *tree_path,
GtkTreeIter *tree_iter,
gpointer user_data);
static void sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
static void sysprof_profiler_menu_button_validate_spawn (SysprofProfilerMenuButton *self,
GtkEntry *entry);
static gboolean save_environ_to_gsettings (gpointer data);
static GParamSpec *properties [N_PROPS];
GtkWidget *
sp_profiler_menu_button_new (void)
sysprof_profiler_menu_button_new (void)
{
return g_object_new (SP_TYPE_PROFILER_MENU_BUTTON, NULL);
return g_object_new (SYSPROF_TYPE_PROFILER_MENU_BUTTON, NULL);
}
static void
sp_profiler_menu_button_update_label (SpProfilerMenuButton *self)
sysprof_profiler_menu_button_update_label (SysprofProfilerMenuButton *self)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_autofree gchar *str = NULL;
const gchar *visible_child;
const GPid *pids;
guint n_pids = 0;
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
if (priv->profiler == NULL)
{
@ -116,21 +116,21 @@ sp_profiler_menu_button_update_label (SpProfilerMenuButton *self)
if (text && *text)
gtk_label_set_label (priv->label, text);
else if (sp_profiler_get_whole_system (priv->profiler))
else if (sysprof_profiler_get_whole_system (priv->profiler))
gtk_label_set_label (priv->label, _("All Processes"));
else
gtk_label_set_label (priv->label, _("New Process"));
sp_profiler_set_spawn (priv->profiler, text && *text);
sysprof_profiler_set_spawn (priv->profiler, text && *text);
return;
}
sp_profiler_set_spawn (priv->profiler, FALSE);
sysprof_profiler_set_spawn (priv->profiler, FALSE);
pids = sp_profiler_get_pids (priv->profiler, &n_pids);
pids = sysprof_profiler_get_pids (priv->profiler, &n_pids);
if (n_pids == 0 || sp_profiler_get_whole_system (priv->profiler))
if (n_pids == 0 || sysprof_profiler_get_whole_system (priv->profiler))
{
gtk_label_set_label (priv->label, _("All Processes"));
return;
@ -153,7 +153,7 @@ static void
clear_selected_flags (GtkWidget *widget,
gpointer user_data)
{
sp_process_model_row_set_selected (SP_PROCESS_MODEL_ROW (widget), FALSE);
sysprof_process_model_row_set_selected (SYSPROF_PROCESS_MODEL_ROW (widget), FALSE);
}
static void
@ -192,12 +192,12 @@ clear_binding (GBinding **binding)
}
static void
sp_profiler_menu_button_connect (SpProfilerMenuButton *self)
sysprof_profiler_menu_button_connect (SysprofProfilerMenuButton *self)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SP_IS_PROFILER (priv->profiler));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER (priv->profiler));
add_binding (&priv->mutable_binding,
priv->profiler, "is-mutable",
@ -222,23 +222,23 @@ sp_profiler_menu_button_connect (SpProfilerMenuButton *self)
priv->notify_whole_system_handler =
g_signal_connect_object (priv->profiler,
"notify::whole-system",
G_CALLBACK (sp_profiler_menu_button_update_label),
G_CALLBACK (sysprof_profiler_menu_button_update_label),
self,
G_CONNECT_SWAPPED);
sp_profiler_menu_button_update_label (self);
sysprof_profiler_menu_button_update_label (self);
sp_profiler_menu_button_validate_spawn (self, priv->spawn_entry);
sp_profiler_menu_button_env_row_changed (self, NULL, NULL, NULL);
sysprof_profiler_menu_button_validate_spawn (self, priv->spawn_entry);
sysprof_profiler_menu_button_env_row_changed (self, NULL, NULL, NULL);
}
static void
sp_profiler_menu_button_disconnect (SpProfilerMenuButton *self)
sysprof_profiler_menu_button_disconnect (SysprofProfilerMenuButton *self)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SP_IS_PROFILER (priv->profiler));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER (priv->profiler));
clear_binding (&priv->mutable_binding);
clear_binding (&priv->whole_system_binding);
@ -259,45 +259,45 @@ sp_profiler_menu_button_disconnect (SpProfilerMenuButton *self)
clear_selected_flags,
NULL);
sp_profiler_menu_button_update_label (self);
sysprof_profiler_menu_button_update_label (self);
}
/**
* sp_profiler_menu_button_get_profiler:
* @self: An #SpProfilerMenuButton
* sysprof_profiler_menu_button_get_profiler:
* @self: An #SysprofProfilerMenuButton
*
* Gets the profiler instance that is being configured.
*
* Returns: (nullable) (transfer none): An #SpProfiler or %NULL.
* Returns: (nullable) (transfer none): An #SysprofProfiler or %NULL.
*/
SpProfiler *
sp_profiler_menu_button_get_profiler (SpProfilerMenuButton *self)
SysprofProfiler *
sysprof_profiler_menu_button_get_profiler (SysprofProfilerMenuButton *self)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_return_val_if_fail (SP_IS_PROFILER_MENU_BUTTON (self), NULL);
g_return_val_if_fail (SYSPROF_IS_PROFILER_MENU_BUTTON (self), NULL);
return priv->profiler;
}
void
sp_profiler_menu_button_set_profiler (SpProfilerMenuButton *self,
SpProfiler *profiler)
sysprof_profiler_menu_button_set_profiler (SysprofProfilerMenuButton *self,
SysprofProfiler *profiler)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_return_if_fail (SP_IS_PROFILER_MENU_BUTTON (self));
g_return_if_fail (!profiler || SP_IS_PROFILER (profiler));
g_return_if_fail (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_return_if_fail (!profiler || SYSPROF_IS_PROFILER (profiler));
if (priv->profiler != profiler)
{
if (priv->profiler != NULL)
sp_profiler_menu_button_disconnect (self);
sysprof_profiler_menu_button_disconnect (self);
if (profiler != NULL)
{
priv->profiler = g_object_ref (profiler);
sp_profiler_menu_button_connect (self);
sysprof_profiler_menu_button_connect (self);
}
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_PROFILER]);
@ -305,75 +305,75 @@ sp_profiler_menu_button_set_profiler (SpProfilerMenuButton *self,
}
static void
sp_profiler_menu_button_row_activated (SpProfilerMenuButton *self,
SpProcessModelRow *row,
sysprof_profiler_menu_button_row_activated (SysprofProfilerMenuButton *self,
SysprofProcessModelRow *row,
GtkListBox *list_box)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
gboolean selected;
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SP_IS_PROCESS_MODEL_ROW (row));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROCESS_MODEL_ROW (row));
g_assert (GTK_IS_LIST_BOX (list_box));
selected = !sp_process_model_row_get_selected (row);
sp_process_model_row_set_selected (row, selected);
selected = !sysprof_process_model_row_get_selected (row);
sysprof_process_model_row_set_selected (row, selected);
if (priv->profiler != NULL)
{
SpProcessModelItem *item = sp_process_model_row_get_item (row);
GPid pid = sp_process_model_item_get_pid (item);
SysprofProcessModelItem *item = sysprof_process_model_row_get_item (row);
GPid pid = sysprof_process_model_item_get_pid (item);
if (selected)
sp_profiler_add_pid (priv->profiler, pid);
sysprof_profiler_add_pid (priv->profiler, pid);
else
sp_profiler_remove_pid (priv->profiler, pid);
sysprof_profiler_remove_pid (priv->profiler, pid);
}
sp_profiler_menu_button_update_label (self);
sysprof_profiler_menu_button_update_label (self);
}
static GtkWidget *
sp_profiler_menu_button_create_row (gpointer itemptr,
sysprof_profiler_menu_button_create_row (gpointer itemptr,
gpointer user_data)
{
SpProcessModelItem *item = itemptr;
SysprofProcessModelItem *item = itemptr;
g_assert (SP_IS_PROCESS_MODEL_ITEM (item));
g_assert (SP_IS_PROFILER_MENU_BUTTON (user_data));
g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (item));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (user_data));
return g_object_new (SP_TYPE_PROCESS_MODEL_ROW,
return g_object_new (SYSPROF_TYPE_PROCESS_MODEL_ROW,
"item", item,
"visible", TRUE,
NULL);
}
static void
sp_profiler_menu_button_clicked (GtkButton *button)
sysprof_profiler_menu_button_clicked (GtkButton *button)
{
SpProfilerMenuButton *self = (SpProfilerMenuButton *)button;
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButton *self = (SysprofProfilerMenuButton *)button;
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
sp_process_model_queue_reload (priv->process_model);
sysprof_process_model_queue_reload (priv->process_model);
GTK_BUTTON_CLASS (sp_profiler_menu_button_parent_class)->clicked (button);
GTK_BUTTON_CLASS (sysprof_profiler_menu_button_parent_class)->clicked (button);
}
static gboolean
sp_profiler_menu_button_filter_func (GObject *object,
sysprof_profiler_menu_button_filter_func (GObject *object,
gpointer user_data)
{
const gchar *needle = user_data;
const gchar *haystack;
g_assert (SP_IS_PROCESS_MODEL_ITEM (object));
g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (object));
if (needle == NULL)
return TRUE;
haystack = sp_process_model_item_get_command_line (SP_PROCESS_MODEL_ITEM (object));
haystack = sysprof_process_model_item_get_command_line (SYSPROF_PROCESS_MODEL_ITEM (object));
if (haystack == NULL)
return FALSE;
@ -382,52 +382,52 @@ sp_profiler_menu_button_filter_func (GObject *object,
}
static void
sp_profiler_menu_button_filter_changed (SpProfilerMenuButton *self,
sysprof_profiler_menu_button_filter_changed (SysprofProfilerMenuButton *self,
GtkEntry *entry)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
const gchar *text;
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (GTK_IS_ENTRY (entry));
text = gtk_entry_get_text (entry);
if (text && *text == 0)
text = NULL;
sp_model_filter_set_filter_func (priv->process_filter,
sp_profiler_menu_button_filter_func,
sysprof_model_filter_set_filter_func (priv->process_filter,
sysprof_profiler_menu_button_filter_func,
g_strdup (text),
g_free);
}
static void
sp_profiler_menu_button_constructed (GObject *object)
sysprof_profiler_menu_button_constructed (GObject *object)
{
SpProfilerMenuButton *self = (SpProfilerMenuButton *)object;
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButton *self = (SysprofProfilerMenuButton *)object;
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
priv->process_filter = sp_model_filter_new (G_LIST_MODEL (priv->process_model));
priv->process_filter = sysprof_model_filter_new (G_LIST_MODEL (priv->process_model));
gtk_list_box_bind_model (priv->process_list_box,
G_LIST_MODEL (priv->process_filter),
sp_profiler_menu_button_create_row,
sysprof_profiler_menu_button_create_row,
self, NULL);
G_OBJECT_CLASS (sp_profiler_menu_button_parent_class)->constructed (object);
G_OBJECT_CLASS (sysprof_profiler_menu_button_parent_class)->constructed (object);
}
static void
sp_profiler_menu_button_realize (GtkWidget *widget)
sysprof_profiler_menu_button_realize (GtkWidget *widget)
{
SpProfilerMenuButton *self = (SpProfilerMenuButton *)widget;
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButton *self = (SysprofProfilerMenuButton *)widget;
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_autoptr(GSettings) settings = NULL;
g_auto(GStrv) env = NULL;
GTK_WIDGET_CLASS (sp_profiler_menu_button_parent_class)->realize (widget);
GTK_WIDGET_CLASS (sysprof_profiler_menu_button_parent_class)->realize (widget);
settings = g_settings_new ("org.gnome.sysprof2");
@ -475,13 +475,13 @@ sp_profiler_menu_button_realize (GtkWidget *widget)
static gboolean
save_environ_to_gsettings (gpointer data)
{
SpProfilerMenuButton *self = data;
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButton *self = data;
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_autoptr(GPtrArray) ar = NULL;
g_autoptr(GSettings) settings = NULL;
GtkTreeIter iter;
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
priv->save_env_source = 0;
@ -521,14 +521,14 @@ save_environ_to_gsettings (gpointer data)
static void
sp_profiler_menu_button_destroy (GtkWidget *widget)
sysprof_profiler_menu_button_destroy (GtkWidget *widget)
{
SpProfilerMenuButton *self = (SpProfilerMenuButton *)widget;
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButton *self = (SysprofProfilerMenuButton *)widget;
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
if (priv->profiler != NULL)
{
sp_profiler_menu_button_disconnect (self);
sysprof_profiler_menu_button_disconnect (self);
g_clear_object (&priv->profiler);
}
@ -540,21 +540,21 @@ sp_profiler_menu_button_destroy (GtkWidget *widget)
priv->save_env_source = 0;
}
GTK_WIDGET_CLASS (sp_profiler_menu_button_parent_class)->destroy (widget);
GTK_WIDGET_CLASS (sysprof_profiler_menu_button_parent_class)->destroy (widget);
}
static void
sp_profiler_menu_button_get_property (GObject *object,
sysprof_profiler_menu_button_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpProfilerMenuButton *self = SP_PROFILER_MENU_BUTTON (object);
SysprofProfilerMenuButton *self = SYSPROF_PROFILER_MENU_BUTTON (object);
switch (prop_id)
{
case PROP_PROFILER:
g_value_set_object (value, sp_profiler_menu_button_get_profiler (self));
g_value_set_object (value, sysprof_profiler_menu_button_get_profiler (self));
break;
default:
@ -563,17 +563,17 @@ sp_profiler_menu_button_get_property (GObject *object,
}
static void
sp_profiler_menu_button_set_property (GObject *object,
sysprof_profiler_menu_button_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpProfilerMenuButton *self = SP_PROFILER_MENU_BUTTON (object);
SysprofProfilerMenuButton *self = SYSPROF_PROFILER_MENU_BUTTON (object);
switch (prop_id)
{
case PROP_PROFILER:
sp_profiler_menu_button_set_profiler (self, g_value_get_object (value));
sysprof_profiler_menu_button_set_profiler (self, g_value_get_object (value));
break;
default:
@ -582,61 +582,61 @@ sp_profiler_menu_button_set_property (GObject *object,
}
static void
sp_profiler_menu_button_class_init (SpProfilerMenuButtonClass *klass)
sysprof_profiler_menu_button_class_init (SysprofProfilerMenuButtonClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass);
object_class->constructed = sp_profiler_menu_button_constructed;
object_class->get_property = sp_profiler_menu_button_get_property;
object_class->set_property = sp_profiler_menu_button_set_property;
object_class->constructed = sysprof_profiler_menu_button_constructed;
object_class->get_property = sysprof_profiler_menu_button_get_property;
object_class->set_property = sysprof_profiler_menu_button_set_property;
widget_class->destroy = sp_profiler_menu_button_destroy;
widget_class->realize = sp_profiler_menu_button_realize;
widget_class->destroy = sysprof_profiler_menu_button_destroy;
widget_class->realize = sysprof_profiler_menu_button_realize;
button_class->clicked = sp_profiler_menu_button_clicked;
button_class->clicked = sysprof_profiler_menu_button_clicked;
properties [PROP_PROFILER] =
g_param_spec_object ("profiler",
"Profiler",
"Profiler",
SP_TYPE_PROFILER,
SYSPROF_TYPE_PROFILER,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | 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/sp-profiler-menu-button.ui");
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, env_key_column);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, env_tree_view);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, env_value_column);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, environment_model);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, inherit_environ);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, key_cell);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, label);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, popover);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, process_filter_entry);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, process_list_box);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, process_model);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, processes_box);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, spawn_entry);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, stack);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, value_cell);
gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, whole_system_switch);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-profiler-menu-button.ui");
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, env_key_column);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, env_tree_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, env_value_column);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, environment_model);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, inherit_environ);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, key_cell);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, label);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, popover);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, process_filter_entry);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, process_list_box);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, process_model);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, processes_box);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, spawn_entry);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, stack);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, value_cell);
gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, whole_system_switch);
}
static void
sp_profiler_menu_button_env_row_changed (SpProfilerMenuButton *self,
sysprof_profiler_menu_button_env_row_changed (SysprofProfilerMenuButton *self,
GtkTreePath *tree_path,
GtkTreeIter *tree_iter,
gpointer user_data)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_autoptr(GPtrArray) env = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (GTK_IS_TREE_MODEL (priv->environment_model));
/* queue saving settings to gsettings */
@ -673,14 +673,14 @@ sp_profiler_menu_button_env_row_changed (SpProfilerMenuButton *self,
while (gtk_tree_model_iter_next (model, &iter));
}
g_ptr_array_add (env, NULL);
sp_profiler_set_spawn_env (priv->profiler, (const gchar * const *)env->pdata);
sysprof_profiler_set_spawn_env (priv->profiler, (const gchar * const *)env->pdata);
}
static void
on_backspace (SpProfilerMenuButton *self,
on_backspace (SysprofProfilerMenuButton *self,
GtkEntry *entry)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
if (g_object_get_data (G_OBJECT (entry), "CELL_WAS_EMPTY"))
{
@ -703,7 +703,7 @@ on_backspace (SpProfilerMenuButton *self,
}
static void
sp_profiler_menu_button_env_key_editing_started (SpProfilerMenuButton *self,
sysprof_profiler_menu_button_env_key_editing_started (SysprofProfilerMenuButton *self,
GtkCellEditable *editable,
const gchar *path,
GtkCellRenderer *cell)
@ -716,17 +716,17 @@ sp_profiler_menu_button_env_key_editing_started (SpProfilerMenuButton *self,
}
static void
sp_profiler_menu_button_env_key_edited (SpProfilerMenuButton *self,
sysprof_profiler_menu_button_env_key_edited (SysprofProfilerMenuButton *self,
const gchar *path,
const gchar *new_text,
GtkCellRendererText *cell)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
GtkTreeModel *model;
GtkTreePath *tree_path;
GtkTreeIter iter;
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (path != NULL);
g_assert (new_text != NULL);
g_assert (GTK_IS_CELL_RENDERER_TEXT (cell));
@ -755,18 +755,18 @@ sp_profiler_menu_button_env_key_edited (SpProfilerMenuButton *self,
}
static void
sp_profiler_menu_button_env_value_edited (SpProfilerMenuButton *self,
sysprof_profiler_menu_button_env_value_edited (SysprofProfilerMenuButton *self,
const gchar *path,
const gchar *new_text,
GtkCellRendererText *cell)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
GtkTreeModel *model;
GtkTreePath *tree_path;
GtkTreeIter iter;
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (path != NULL);
g_assert (new_text != NULL);
g_assert (GTK_IS_CELL_RENDERER_TEXT (cell));
@ -797,23 +797,23 @@ sp_profiler_menu_button_env_value_edited (SpProfilerMenuButton *self,
}
static void
sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
sysprof_profiler_menu_button_validate_spawn (SysprofProfilerMenuButton *self,
GtkEntry *entry)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_auto(GStrv) argv = NULL;
g_autoptr(GError) error = NULL;
const gchar *text;
gint argc;
g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (GTK_IS_ENTRY (entry));
text = gtk_entry_get_text (entry);
if (text && *text && !g_shell_parse_argv (text, &argc, &argv, &error))
{
sp_profiler_set_spawn_argv (priv->profiler, NULL);
sysprof_profiler_set_spawn_argv (priv->profiler, NULL);
g_object_set (entry,
"secondary-icon-name", "dialog-warning-symbolic",
"secondary-icon-tooltip-text", _("The command line arguments provided are invalid"),
@ -821,7 +821,7 @@ sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
}
else
{
sp_profiler_set_spawn_argv (priv->profiler, (const gchar * const *)argv);
sysprof_profiler_set_spawn_argv (priv->profiler, (const gchar * const *)argv);
g_object_set (entry,
"secondary-icon-name", NULL,
"secondary-icon-tooltip-text", NULL,
@ -830,63 +830,63 @@ sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
}
static void
sp_profiler_menu_button_init (SpProfilerMenuButton *self)
sysprof_profiler_menu_button_init (SysprofProfilerMenuButton *self)
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
gtk_widget_init_template (GTK_WIDGET (self));
g_signal_connect_object (priv->process_filter_entry,
"changed",
G_CALLBACK (sp_profiler_menu_button_filter_changed),
G_CALLBACK (sysprof_profiler_menu_button_filter_changed),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->spawn_entry,
"changed",
G_CALLBACK (sp_profiler_menu_button_update_label),
G_CALLBACK (sysprof_profiler_menu_button_update_label),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->spawn_entry,
"changed",
G_CALLBACK (sp_profiler_menu_button_validate_spawn),
G_CALLBACK (sysprof_profiler_menu_button_validate_spawn),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->stack,
"notify::visible-child",
G_CALLBACK (sp_profiler_menu_button_update_label),
G_CALLBACK (sysprof_profiler_menu_button_update_label),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->process_list_box,
"row-activated",
G_CALLBACK (sp_profiler_menu_button_row_activated),
G_CALLBACK (sysprof_profiler_menu_button_row_activated),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->key_cell,
"edited",
G_CALLBACK (sp_profiler_menu_button_env_key_edited),
G_CALLBACK (sysprof_profiler_menu_button_env_key_edited),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->value_cell,
"edited",
G_CALLBACK (sp_profiler_menu_button_env_value_edited),
G_CALLBACK (sysprof_profiler_menu_button_env_value_edited),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (gtk_tree_view_get_model (priv->env_tree_view),
"row-changed",
G_CALLBACK (sp_profiler_menu_button_env_row_changed),
G_CALLBACK (sysprof_profiler_menu_button_env_row_changed),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->key_cell,
"editing-started",
G_CALLBACK (sp_profiler_menu_button_env_key_editing_started),
G_CALLBACK (sysprof_profiler_menu_button_env_key_editing_started),
self,
G_CONNECT_SWAPPED);

View File

@ -1,4 +1,4 @@
/* sp-profiler-menu-button.h
/* sysprof-profiler-menu-button.h
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -22,17 +22,17 @@
#include <gtk/gtk.h>
#include "sp-profiler.h"
#include "sysprof-profiler.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_PROFILER_MENU_BUTTON (sp_profiler_menu_button_get_type())
#define SYSPROF_TYPE_PROFILER_MENU_BUTTON (sysprof_profiler_menu_button_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpProfilerMenuButton, sp_profiler_menu_button, SP, PROFILER_MENU_BUTTON, GtkMenuButton)
G_DECLARE_DERIVABLE_TYPE (SysprofProfilerMenuButton, sysprof_profiler_menu_button, SYSPROF, PROFILER_MENU_BUTTON, GtkMenuButton)
struct _SpProfilerMenuButtonClass
struct _SysprofProfilerMenuButtonClass
{
GtkMenuButtonClass parent_class;
@ -40,11 +40,11 @@ struct _SpProfilerMenuButtonClass
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_profiler_menu_button_new (void);
GtkWidget *sysprof_profiler_menu_button_new (void);
SYSPROF_AVAILABLE_IN_ALL
void sp_profiler_menu_button_set_profiler (SpProfilerMenuButton *self,
SpProfiler *profiler);
void sysprof_profiler_menu_button_set_profiler (SysprofProfilerMenuButton *self,
SysprofProfiler *profiler);
SYSPROF_AVAILABLE_IN_ALL
SpProfiler *sp_profiler_menu_button_get_profiler (SpProfilerMenuButton *self);
SysprofProfiler *sysprof_profiler_menu_button_get_profiler (SysprofProfilerMenuButton *self);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-recording-state-view.c
/* sysprof-recording-state-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -20,16 +20,16 @@
#include "config.h"
#include "sp-recording-state-view.h"
#include "sysprof-recording-state-view.h"
typedef struct
{
SpProfiler *profiler;
SysprofProfiler *profiler;
gulong notify_elapsed_handler;
GtkLabel *elapsed;
} SpRecordingStateViewPrivate;
} SysprofRecordingStateViewPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (SpRecordingStateView, sp_recording_state_view, GTK_TYPE_BIN)
G_DEFINE_TYPE_WITH_PRIVATE (SysprofRecordingStateView, sysprof_recording_state_view, GTK_TYPE_BIN)
enum {
PROP_0,
@ -40,27 +40,27 @@ enum {
static GParamSpec *properties [N_PROPS];
GtkWidget *
sp_recording_state_view_new (void)
sysprof_recording_state_view_new (void)
{
return g_object_new (SP_TYPE_RECORDING_STATE_VIEW, NULL);
return g_object_new (SYSPROF_TYPE_RECORDING_STATE_VIEW, NULL);
}
static void
sp_recording_state_view_notify_elapsed (SpRecordingStateView *self,
sysprof_recording_state_view_notify_elapsed (SysprofRecordingStateView *self,
GParamSpec *pspec,
SpProfiler *profiler)
SysprofProfiler *profiler)
{
SpRecordingStateViewPrivate *priv = sp_recording_state_view_get_instance_private (self);
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
g_autofree gchar *str = NULL;
gint64 elapsed;
guint hours;
guint minutes;
guint seconds;
g_assert (SP_IS_RECORDING_STATE_VIEW (self));
g_assert (SP_IS_PROFILER (profiler));
g_assert (SYSPROF_IS_RECORDING_STATE_VIEW (self));
g_assert (SYSPROF_IS_PROFILER (profiler));
elapsed = (gint64)sp_profiler_get_elapsed (profiler);
elapsed = (gint64)sysprof_profiler_get_elapsed (profiler);
hours = elapsed / (60 * 60);
if (hours > 0)
@ -78,10 +78,10 @@ sp_recording_state_view_notify_elapsed (SpRecordingStateView *self,
}
static void
sp_recording_state_view_destroy (GtkWidget *widget)
sysprof_recording_state_view_destroy (GtkWidget *widget)
{
SpRecordingStateView *self = (SpRecordingStateView *)widget;
SpRecordingStateViewPrivate *priv = sp_recording_state_view_get_instance_private (self);
SysprofRecordingStateView *self = (SysprofRecordingStateView *)widget;
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
if (priv->profiler != NULL)
{
@ -89,17 +89,17 @@ sp_recording_state_view_destroy (GtkWidget *widget)
g_clear_object (&priv->profiler);
}
GTK_WIDGET_CLASS (sp_recording_state_view_parent_class)->destroy (widget);
GTK_WIDGET_CLASS (sysprof_recording_state_view_parent_class)->destroy (widget);
}
static void
sp_recording_state_view_get_property (GObject *object,
sysprof_recording_state_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpRecordingStateView *self = SP_RECORDING_STATE_VIEW (object);
SpRecordingStateViewPrivate *priv = sp_recording_state_view_get_instance_private (self);
SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object);
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
switch (prop_id)
{
@ -113,17 +113,17 @@ sp_recording_state_view_get_property (GObject *object,
}
static void
sp_recording_state_view_set_property (GObject *object,
sysprof_recording_state_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpRecordingStateView *self = SP_RECORDING_STATE_VIEW (object);
SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object);
switch (prop_id)
{
case PROP_PROFILER:
sp_recording_state_view_set_profiler (self, g_value_get_object (value));
sysprof_recording_state_view_set_profiler (self, g_value_get_object (value));
break;
default:
@ -132,44 +132,44 @@ sp_recording_state_view_set_property (GObject *object,
}
static void
sp_recording_state_view_class_init (SpRecordingStateViewClass *klass)
sysprof_recording_state_view_class_init (SysprofRecordingStateViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->get_property = sp_recording_state_view_get_property;
object_class->set_property = sp_recording_state_view_set_property;
object_class->get_property = sysprof_recording_state_view_get_property;
object_class->set_property = sysprof_recording_state_view_set_property;
widget_class->destroy = sp_recording_state_view_destroy;
widget_class->destroy = sysprof_recording_state_view_destroy;
properties [PROP_PROFILER] =
g_param_spec_object ("profiler",
"Profiler",
"Profiler",
SP_TYPE_PROFILER,
SYSPROF_TYPE_PROFILER,
(G_PARAM_READWRITE | 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/sp-recording-state-view.ui");
gtk_widget_class_bind_template_child_private (widget_class, SpRecordingStateView, elapsed);
"/org/gnome/sysprof/ui/sysprof-recording-state-view.ui");
gtk_widget_class_bind_template_child_private (widget_class, SysprofRecordingStateView, elapsed);
}
static void
sp_recording_state_view_init (SpRecordingStateView *self)
sysprof_recording_state_view_init (SysprofRecordingStateView *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
}
void
sp_recording_state_view_set_profiler (SpRecordingStateView *self,
SpProfiler *profiler)
sysprof_recording_state_view_set_profiler (SysprofRecordingStateView *self,
SysprofProfiler *profiler)
{
SpRecordingStateViewPrivate *priv = sp_recording_state_view_get_instance_private (self);
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
g_assert (SP_IS_RECORDING_STATE_VIEW (self));
g_assert (!profiler || SP_IS_PROFILER (profiler));
g_assert (SYSPROF_IS_RECORDING_STATE_VIEW (self));
g_assert (!profiler || SYSPROF_IS_PROFILER (profiler));
gtk_label_set_label (priv->elapsed, "00:00");
@ -189,7 +189,7 @@ sp_recording_state_view_set_profiler (SpRecordingStateView *self,
priv->notify_elapsed_handler =
g_signal_connect_object (profiler,
"notify::elapsed",
G_CALLBACK (sp_recording_state_view_notify_elapsed),
G_CALLBACK (sysprof_recording_state_view_notify_elapsed),
self,
G_CONNECT_SWAPPED);
}

View File

@ -1,4 +1,4 @@
/* sp-recording-state-view.h
/* sysprof-recording-state-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -22,17 +22,17 @@
#include <gtk/gtk.h>
#include "sp-profiler.h"
#include "sysprof-profiler.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_RECORDING_STATE_VIEW (sp_recording_state_view_get_type())
#define SYSPROF_TYPE_RECORDING_STATE_VIEW (sysprof_recording_state_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpRecordingStateView, sp_recording_state_view, SP, RECORDING_STATE_VIEW, GtkBin)
G_DECLARE_DERIVABLE_TYPE (SysprofRecordingStateView, sysprof_recording_state_view, SYSPROF, RECORDING_STATE_VIEW, GtkBin)
struct _SpRecordingStateViewClass
struct _SysprofRecordingStateViewClass
{
GtkBinClass parent;
@ -40,9 +40,9 @@ struct _SpRecordingStateViewClass
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_recording_state_view_new (void);
GtkWidget *sysprof_recording_state_view_new (void);
SYSPROF_AVAILABLE_IN_ALL
void sp_recording_state_view_set_profiler (SpRecordingStateView *self,
SpProfiler *profiler);
void sysprof_recording_state_view_set_profiler (SysprofRecordingStateView *self,
SysprofProfiler *profiler);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-theme-manager.c
/* sysprof-theme-manager.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -18,13 +18,13 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sp-theme-manager"
#define G_LOG_DOMAIN "sysprof-theme-manager"
#include "config.h"
#include "sp-theme-manager.h"
#include "sysprof-theme-manager.h"
struct _SpThemeManager
struct _SysprofThemeManager
{
GObject parent_instance;
GHashTable *theme_resources;
@ -42,7 +42,7 @@ typedef struct
GtkCssProvider *provider;
} ThemeResource;
G_DEFINE_TYPE (SpThemeManager, sp_theme_manager, G_TYPE_OBJECT)
G_DEFINE_TYPE (SysprofThemeManager, sysprof_theme_manager, G_TYPE_OBJECT)
static void
theme_resource_free (gpointer data)
@ -98,14 +98,14 @@ theme_resource_matches (ThemeResource *theme_resource,
}
static gboolean
sp_theme_manager_do_reload (gpointer data)
sysprof_theme_manager_do_reload (gpointer data)
{
SpThemeManager *self = data;
SysprofThemeManager *self = data;
ThemeResource *theme_resource;
GHashTableIter iter;
GtkSettings *settings;
g_assert (SP_IS_THEME_MANAGER (self));
g_assert (SYSPROF_IS_THEME_MANAGER (self));
self->reload_source = 0;
@ -141,21 +141,21 @@ sp_theme_manager_do_reload (gpointer data)
}
static void
sp_theme_manager_queue_reload (SpThemeManager *self)
sysprof_theme_manager_queue_reload (SysprofThemeManager *self)
{
g_assert (SP_IS_THEME_MANAGER (self));
g_assert (SYSPROF_IS_THEME_MANAGER (self));
if (self->reload_source == 0)
self->reload_source = gdk_threads_add_idle_full (G_PRIORITY_LOW,
sp_theme_manager_do_reload,
sysprof_theme_manager_do_reload,
self,
NULL);
}
static void
sp_theme_manager_finalize (GObject *object)
sysprof_theme_manager_finalize (GObject *object)
{
SpThemeManager *self = (SpThemeManager *)object;
SysprofThemeManager *self = (SysprofThemeManager *)object;
if (self->reload_source != 0)
{
@ -165,19 +165,19 @@ sp_theme_manager_finalize (GObject *object)
g_clear_pointer (&self->theme_resources, g_hash_table_unref);
G_OBJECT_CLASS (sp_theme_manager_parent_class)->finalize (object);
G_OBJECT_CLASS (sysprof_theme_manager_parent_class)->finalize (object);
}
static void
sp_theme_manager_class_init (SpThemeManagerClass *klass)
sysprof_theme_manager_class_init (SysprofThemeManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = sp_theme_manager_finalize;
object_class->finalize = sysprof_theme_manager_finalize;
}
static void
sp_theme_manager_init (SpThemeManager *self)
sysprof_theme_manager_init (SysprofThemeManager *self)
{
self->theme_resources = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, theme_resource_free);
@ -185,23 +185,23 @@ sp_theme_manager_init (SpThemeManager *self)
}
/**
* sp_theme_manager_get_default:
* sysprof_theme_manager_get_default:
*
* Returns: (transfer none): An #SpThemeManager
* Returns: (transfer none): An #SysprofThemeManager
*/
SpThemeManager *
sp_theme_manager_get_default (void)
SysprofThemeManager *
sysprof_theme_manager_get_default (void)
{
static SpThemeManager *instance;
static SysprofThemeManager *instance;
if (instance == NULL)
instance = g_object_new (SP_TYPE_THEME_MANAGER, NULL);
instance = g_object_new (SYSPROF_TYPE_THEME_MANAGER, NULL);
return instance;
}
guint
sp_theme_manager_register_resource (SpThemeManager *self,
sysprof_theme_manager_register_resource (SysprofThemeManager *self,
const gchar *theme_name,
const gchar *variant,
const gchar *resource)
@ -210,7 +210,7 @@ sp_theme_manager_register_resource (SpThemeManager *self,
static guint counter;
guint id;
g_return_val_if_fail (SP_IS_THEME_MANAGER (self), 0);
g_return_val_if_fail (SYSPROF_IS_THEME_MANAGER (self), 0);
theme_resource = g_slice_new0 (ThemeResource);
theme_resource->id = id = ++counter;
@ -230,29 +230,29 @@ sp_theme_manager_register_resource (SpThemeManager *self,
self->registered_signals = TRUE;
g_signal_connect_object (gtk_settings_get_default (),
"notify::gtk-application-prefer-dark-theme",
G_CALLBACK (sp_theme_manager_queue_reload),
G_CALLBACK (sysprof_theme_manager_queue_reload),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (gtk_settings_get_default (),
"notify::gtk-theme-name",
G_CALLBACK (sp_theme_manager_queue_reload),
G_CALLBACK (sysprof_theme_manager_queue_reload),
self,
G_CONNECT_SWAPPED);
}
sp_theme_manager_queue_reload (self);
sysprof_theme_manager_queue_reload (self);
return id;
}
void
sp_theme_manager_unregister (SpThemeManager *self,
sysprof_theme_manager_unregister (SysprofThemeManager *self,
guint registration_id)
{
GHashTableIter iter;
ThemeResource *theme_resource;
g_return_if_fail (SP_IS_THEME_MANAGER (self));
g_return_if_fail (SYSPROF_IS_THEME_MANAGER (self));
g_hash_table_iter_init (&iter, self->theme_resources);

View File

@ -1,4 +1,4 @@
/* sp-theme-manager.h
/* sysprof-theme-manager.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -24,18 +24,18 @@
G_BEGIN_DECLS
#define SP_TYPE_THEME_MANAGER (sp_theme_manager_get_type())
#define SYSPROF_TYPE_THEME_MANAGER (sysprof_theme_manager_get_type())
G_GNUC_INTERNAL
G_DECLARE_FINAL_TYPE (SpThemeManager, sp_theme_manager, SP, THEME_MANAGER, GObject)
G_DECLARE_FINAL_TYPE (SysprofThemeManager, sysprof_theme_manager, SYSPROF, THEME_MANAGER, GObject)
G_GNUC_INTERNAL
SpThemeManager *sp_theme_manager_get_default (void);
SysprofThemeManager *sysprof_theme_manager_get_default (void);
G_GNUC_INTERNAL
void sp_theme_manager_unregister (SpThemeManager *self,
void sysprof_theme_manager_unregister (SysprofThemeManager *self,
guint registration_id);
G_GNUC_INTERNAL
guint sp_theme_manager_register_resource (SpThemeManager *self,
guint sysprof_theme_manager_register_resource (SysprofThemeManager *self,
const gchar *theme_name,
const gchar *variant,
const gchar *resource);

View File

@ -26,22 +26,22 @@ G_BEGIN_DECLS
#define SYSPROF_UI_INSIDE
# include "sp-callgraph-view.h"
# include "sp-cell-renderer-percent.h"
# include "sp-cpu-visualizer-row.h"
# include "sp-failed-state-view.h"
# include "sp-line-visualizer-row.h"
# include "sp-empty-state-view.h"
# include "sp-model-filter.h"
# include "sp-multi-paned.h"
# include "sp-recording-state-view.h"
# include "sp-process-model.h"
# include "sp-process-model-item.h"
# include "sp-process-model-row.h"
# include "sp-profiler-menu-button.h"
# include "sp-visualizer-row.h"
# include "sp-visualizer-view.h"
# include "sp-zoom-manager.h"
# include "sysprof-callgraph-view.h"
# include "sysprof-cell-renderer-percent.h"
# include "sysprof-cpu-visualizer-row.h"
# include "sysprof-failed-state-view.h"
# include "sysprof-line-visualizer-row.h"
# include "sysprof-empty-state-view.h"
# include "sysprof-model-filter.h"
# include "sysprof-multi-paned.h"
# include "sysprof-recording-state-view.h"
# include "sysprof-process-model.h"
# include "sysprof-process-model-item.h"
# include "sysprof-process-model-row.h"
# include "sysprof-profiler-menu-button.h"
# include "sysprof-visualizer-row.h"
# include "sysprof-visualizer-view.h"
# include "sysprof-zoom-manager.h"
#undef SYSPROF_UI_INSIDE

View File

@ -1,4 +1,4 @@
/* sp-visualizer-list.c
/* sysprof-visualizer-list.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -18,33 +18,33 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sp-visualizer-list"
#define G_LOG_DOMAIN "sysprof-visualizer-list"
#include "config.h"
#include <glib/gi18n.h>
#include <sysprof.h>
#include "sp-cpu-visualizer-row.h"
#include "sp-visualizer-list.h"
#include "sp-visualizer-row.h"
#include "sp-mark-visualizer-row.h"
#include "sp-zoom-manager.h"
#include "sysprof-cpu-visualizer-row.h"
#include "sysprof-visualizer-list.h"
#include "sysprof-visualizer-row.h"
#include "sysprof-mark-visualizer-row.h"
#include "sysprof-zoom-manager.h"
#define NSEC_PER_SEC G_GUINT64_CONSTANT(1000000000)
#define DEFAULT_PIXELS_PER_SECOND 20
typedef struct
{
SpCaptureReader *reader;
SpZoomManager *zoom_manager;
SysprofCaptureReader *reader;
SysprofZoomManager *zoom_manager;
gint64 begin_time;
gint64 end_time;
} SpVisualizerListPrivate;
} SysprofVisualizerListPrivate;
typedef struct
{
SpCaptureCursor *cursor;
SysprofCaptureCursor *cursor;
GHashTable *mark_groups;
guint fps_counter;
GArray *memory;
@ -58,7 +58,7 @@ enum {
N_PROPS
};
G_DEFINE_TYPE_WITH_PRIVATE (SpVisualizerList, sp_visualizer_list, GTK_TYPE_LIST_BOX)
G_DEFINE_TYPE_WITH_PRIVATE (SysprofVisualizerList, sysprof_visualizer_list, GTK_TYPE_LIST_BOX)
static GParamSpec *properties [N_PROPS];
@ -67,53 +67,53 @@ discovery_free (Discovery *state)
{
g_clear_pointer (&state->mark_groups, g_hash_table_unref);
g_clear_pointer (&state->memory, g_array_unref);
g_clear_pointer (&state->cursor, sp_capture_cursor_unref);
g_clear_pointer (&state->cursor, sysprof_capture_cursor_unref);
g_slice_free (Discovery, state);
}
static void
sp_visualizer_list_add (GtkContainer *container,
sysprof_visualizer_list_add (GtkContainer *container,
GtkWidget *widget)
{
SpVisualizerList *self = (SpVisualizerList *)container;
SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
SysprofVisualizerList *self = (SysprofVisualizerList *)container;
SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
GTK_CONTAINER_CLASS (sp_visualizer_list_parent_class)->add (container, widget);
GTK_CONTAINER_CLASS (sysprof_visualizer_list_parent_class)->add (container, widget);
if (SP_IS_VISUALIZER_ROW (widget))
if (SYSPROF_IS_VISUALIZER_ROW (widget))
{
sp_visualizer_row_set_reader (SP_VISUALIZER_ROW (widget), priv->reader);
sp_visualizer_row_set_zoom_manager (SP_VISUALIZER_ROW (widget), priv->zoom_manager);
sysprof_visualizer_row_set_reader (SYSPROF_VISUALIZER_ROW (widget), priv->reader);
sysprof_visualizer_row_set_zoom_manager (SYSPROF_VISUALIZER_ROW (widget), priv->zoom_manager);
}
}
static void
sp_visualizer_list_finalize (GObject *object)
sysprof_visualizer_list_finalize (GObject *object)
{
SpVisualizerList *self = (SpVisualizerList *)object;
SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
SysprofVisualizerList *self = (SysprofVisualizerList *)object;
SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
g_clear_pointer (&priv->reader, sp_capture_reader_unref);
g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
G_OBJECT_CLASS (sp_visualizer_list_parent_class)->finalize (object);
G_OBJECT_CLASS (sysprof_visualizer_list_parent_class)->finalize (object);
}
static void
sp_visualizer_list_get_property (GObject *object,
sysprof_visualizer_list_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpVisualizerList *self = SP_VISUALIZER_LIST (object);
SysprofVisualizerList *self = SYSPROF_VISUALIZER_LIST (object);
switch (prop_id)
{
case PROP_READER:
g_value_set_boxed (value, sp_visualizer_list_get_reader (self));
g_value_set_boxed (value, sysprof_visualizer_list_get_reader (self));
break;
case PROP_ZOOM_MANAGER:
g_value_set_object (value, sp_visualizer_list_get_zoom_manager (self));
g_value_set_object (value, sysprof_visualizer_list_get_zoom_manager (self));
break;
default:
@ -122,21 +122,21 @@ sp_visualizer_list_get_property (GObject *object,
}
static void
sp_visualizer_list_set_property (GObject *object,
sysprof_visualizer_list_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpVisualizerList *self = SP_VISUALIZER_LIST (object);
SysprofVisualizerList *self = SYSPROF_VISUALIZER_LIST (object);
switch (prop_id)
{
case PROP_READER:
sp_visualizer_list_set_reader (self, g_value_get_boxed (value));
sysprof_visualizer_list_set_reader (self, g_value_get_boxed (value));
break;
case PROP_ZOOM_MANAGER:
sp_visualizer_list_set_zoom_manager (self, g_value_get_object (value));
sysprof_visualizer_list_set_zoom_manager (self, g_value_get_object (value));
break;
default:
@ -145,64 +145,64 @@ sp_visualizer_list_set_property (GObject *object,
}
static void
sp_visualizer_list_class_init (SpVisualizerListClass *klass)
sysprof_visualizer_list_class_init (SysprofVisualizerListClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
object_class->finalize = sp_visualizer_list_finalize;
object_class->get_property = sp_visualizer_list_get_property;
object_class->set_property = sp_visualizer_list_set_property;
object_class->finalize = sysprof_visualizer_list_finalize;
object_class->get_property = sysprof_visualizer_list_get_property;
object_class->set_property = sysprof_visualizer_list_set_property;
container_class->add = sp_visualizer_list_add;
container_class->add = sysprof_visualizer_list_add;
properties [PROP_READER] =
g_param_spec_boxed ("reader",
"Reader",
"The capture reader",
SP_TYPE_CAPTURE_READER,
SYSPROF_TYPE_CAPTURE_READER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_ZOOM_MANAGER] =
g_param_spec_object ("zoom-manager",
"Zoom Manager",
"The zoom manager",
SP_TYPE_ZOOM_MANAGER,
SYSPROF_TYPE_ZOOM_MANAGER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
sp_visualizer_list_init (SpVisualizerList *self)
sysprof_visualizer_list_init (SysprofVisualizerList *self)
{
}
GtkWidget *
sp_visualizer_list_new (void)
sysprof_visualizer_list_new (void)
{
return g_object_new (SP_TYPE_VISUALIZER_ROW, NULL);
return g_object_new (SYSPROF_TYPE_VISUALIZER_ROW, NULL);
}
/**
* sp_visualizer_list_get_reader:
* sysprof_visualizer_list_get_reader:
*
* Gets the reader that is being used for the #SpVisualizerList.
* Gets the reader that is being used for the #SysprofVisualizerList.
*
* Returns: (transfer none): An #SpCaptureReader
* Returns: (transfer none): An #SysprofCaptureReader
*/
SpCaptureReader *
sp_visualizer_list_get_reader (SpVisualizerList *self)
SysprofCaptureReader *
sysprof_visualizer_list_get_reader (SysprofVisualizerList *self)
{
SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
g_return_val_if_fail (SP_IS_VISUALIZER_LIST (self), NULL);
g_return_val_if_fail (SYSPROF_IS_VISUALIZER_LIST (self), NULL);
return priv->reader;
}
static gboolean
discover_new_rows_frame_cb (const SpCaptureFrame *frame,
discover_new_rows_frame_cb (const SysprofCaptureFrame *frame,
gpointer user_data)
{
Discovery *state = user_data;
@ -218,21 +218,21 @@ discover_new_rows_frame_cb (const SpCaptureFrame *frame,
* and widget views to be displayed.
*/
if (frame->type == SP_CAPTURE_FRAME_MARK)
if (frame->type == SYSPROF_CAPTURE_FRAME_MARK)
{
const SpCaptureMark *mark = (const SpCaptureMark *)frame;
const SysprofCaptureMark *mark = (const SysprofCaptureMark *)frame;
if (!g_hash_table_contains (state->mark_groups, mark->group))
g_hash_table_add (state->mark_groups, g_strdup (mark->group));
}
if (frame->type == SP_CAPTURE_FRAME_CTRDEF)
if (frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF)
{
const SpCaptureFrameCounterDefine *def = (const SpCaptureFrameCounterDefine *)frame;
const SysprofCaptureFrameCounterDefine *def = (const SysprofCaptureFrameCounterDefine *)frame;
for (guint i = 0; i < def->n_counters; i++)
{
const SpCaptureCounter *ctr = &def->counters[i];
const SysprofCaptureCounter *ctr = &def->counters[i];
if (!state->has_cpu &&
strstr (ctr->category, "CPU Percent") != NULL)
@ -263,7 +263,7 @@ discover_new_rows_worker (GTask *task,
g_assert (state != NULL);
g_assert (state->cursor != NULL);
sp_capture_cursor_foreach (state->cursor, discover_new_rows_frame_cb, state);
sysprof_capture_cursor_foreach (state->cursor, discover_new_rows_frame_cb, state);
g_task_return_boolean (task, TRUE);
}
@ -272,11 +272,11 @@ handle_capture_results (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
SpVisualizerList *self = (SpVisualizerList *)object;
SysprofVisualizerList *self = (SysprofVisualizerList *)object;
Discovery *state;
const gchar *key;
g_assert (SP_IS_VISUALIZER_LIST (self));
g_assert (SYSPROF_IS_VISUALIZER_LIST (self));
g_assert (G_IS_TASK (result));
g_assert (user_data == NULL);
@ -292,7 +292,7 @@ handle_capture_results (GObject *object,
if (state->has_cpu)
{
GtkWidget *row = g_object_new (SP_TYPE_CPU_VISUALIZER_ROW,
GtkWidget *row = g_object_new (SYSPROF_TYPE_CPU_VISUALIZER_ROW,
/* Translators: CPU is the processor. */
"title", _("CPU"),
"height-request", 50,
@ -308,7 +308,7 @@ handle_capture_results (GObject *object,
{
guint counter_id = g_array_index (state->memory, guint, i);
GdkRGBA rgba;
GtkWidget *row = g_object_new (SP_TYPE_LINE_VISUALIZER_ROW,
GtkWidget *row = g_object_new (SYSPROF_TYPE_LINE_VISUALIZER_ROW,
"title", _("Memory Used"),
"height-request", 35,
"selectable", FALSE,
@ -316,16 +316,16 @@ handle_capture_results (GObject *object,
"y-lower", 0.0,
NULL);
gdk_rgba_parse (&rgba, "#204a87");
sp_line_visualizer_row_add_counter (SP_LINE_VISUALIZER_ROW (row), counter_id, &rgba);
sysprof_line_visualizer_row_add_counter (SYSPROF_LINE_VISUALIZER_ROW (row), counter_id, &rgba);
rgba.alpha = 0.3;
sp_line_visualizer_row_set_fill (SP_LINE_VISUALIZER_ROW (row), counter_id, &rgba);
sysprof_line_visualizer_row_set_fill (SYSPROF_LINE_VISUALIZER_ROW (row), counter_id, &rgba);
gtk_container_add (GTK_CONTAINER (self), row);
}
if (state->fps_counter)
{
GdkRGBA rgba;
GtkWidget *row = g_object_new (SP_TYPE_LINE_VISUALIZER_ROW,
GtkWidget *row = g_object_new (SYSPROF_TYPE_LINE_VISUALIZER_ROW,
/* Translators: FPS is frames per second. */
"title", _("FPS"),
"height-request", 35,
@ -335,9 +335,9 @@ handle_capture_results (GObject *object,
"y-upper", 150.0,
NULL);
gdk_rgba_parse (&rgba, "#204a87");
sp_line_visualizer_row_add_counter (SP_LINE_VISUALIZER_ROW (row), state->fps_counter, &rgba);
sysprof_line_visualizer_row_add_counter (SYSPROF_LINE_VISUALIZER_ROW (row), state->fps_counter, &rgba);
rgba.alpha = 0.3;
sp_line_visualizer_row_set_fill (SP_LINE_VISUALIZER_ROW (row), state->fps_counter, &rgba);
sysprof_line_visualizer_row_set_fill (SYSPROF_LINE_VISUALIZER_ROW (row), state->fps_counter, &rgba);
gtk_container_add (GTK_CONTAINER (self), row);
}
@ -349,7 +349,7 @@ handle_capture_results (GObject *object,
while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
{
GtkWidget *row = g_object_new (SP_TYPE_MARK_VISUALIZER_ROW,
GtkWidget *row = g_object_new (SYSPROF_TYPE_MARK_VISUALIZER_ROW,
"group", key,
"title", key,
"height-request", 50,
@ -362,16 +362,16 @@ handle_capture_results (GObject *object,
}
static void
discover_new_rows (SpVisualizerList *self,
SpCaptureReader *reader)
discover_new_rows (SysprofVisualizerList *self,
SysprofCaptureReader *reader)
{
static const SpCaptureFrameType types[] = { SP_CAPTURE_FRAME_CTRDEF, SP_CAPTURE_FRAME_MARK };
g_autoptr(SpCaptureCursor) cursor = NULL;
static const SysprofCaptureFrameType types[] = { SYSPROF_CAPTURE_FRAME_CTRDEF, SYSPROF_CAPTURE_FRAME_MARK };
g_autoptr(SysprofCaptureCursor) cursor = NULL;
g_autoptr(GTask) task = NULL;
SpCaptureCondition *condition;
SysprofCaptureCondition *condition;
Discovery *state;
g_assert (SP_IS_VISUALIZER_LIST (self));
g_assert (SYSPROF_IS_VISUALIZER_LIST (self));
g_assert (reader != NULL);
/*
@ -381,9 +381,9 @@ discover_new_rows (SpVisualizerList *self,
* denote capabilities at the beginning of the capture stream.
*/
cursor = sp_capture_cursor_new (reader);
condition = sp_capture_condition_new_where_type_in (G_N_ELEMENTS (types), types);
sp_capture_cursor_add_condition (cursor, g_steal_pointer (&condition));
cursor = sysprof_capture_cursor_new (reader);
condition = sysprof_capture_condition_new_where_type_in (G_N_ELEMENTS (types), types);
sysprof_capture_cursor_add_condition (cursor, g_steal_pointer (&condition));
state = g_slice_new0 (Discovery);
state->mark_groups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@ -396,25 +396,25 @@ discover_new_rows (SpVisualizerList *self,
}
void
sp_visualizer_list_set_reader (SpVisualizerList *self,
SpCaptureReader *reader)
sysprof_visualizer_list_set_reader (SysprofVisualizerList *self,
SysprofCaptureReader *reader)
{
SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
g_return_if_fail (SP_IS_VISUALIZER_LIST (self));
g_return_if_fail (SYSPROF_IS_VISUALIZER_LIST (self));
if (reader != priv->reader)
{
g_clear_pointer (&priv->reader, sp_capture_reader_unref);
g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (reader != NULL)
{
priv->reader = sp_capture_reader_ref (reader);
priv->reader = sysprof_capture_reader_ref (reader);
discover_new_rows (self, reader);
}
gtk_container_foreach (GTK_CONTAINER (self),
(GtkCallback)sp_visualizer_row_set_reader,
(GtkCallback)sysprof_visualizer_row_set_reader,
reader);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_READER]);
@ -422,34 +422,34 @@ sp_visualizer_list_set_reader (SpVisualizerList *self,
}
void
sp_visualizer_list_set_zoom_manager (SpVisualizerList *self,
SpZoomManager *zoom_manager)
sysprof_visualizer_list_set_zoom_manager (SysprofVisualizerList *self,
SysprofZoomManager *zoom_manager)
{
SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
g_return_if_fail (SP_IS_VISUALIZER_LIST (self));
g_return_if_fail (SP_IS_ZOOM_MANAGER (zoom_manager));
g_return_if_fail (SYSPROF_IS_VISUALIZER_LIST (self));
g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
if (g_set_object (&priv->zoom_manager, zoom_manager))
{
gtk_container_foreach (GTK_CONTAINER (self),
(GtkCallback)sp_visualizer_row_set_zoom_manager,
(GtkCallback)sysprof_visualizer_row_set_zoom_manager,
zoom_manager);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ZOOM_MANAGER]);
}
}
/**
* sp_visualizer_list_get_zoom_manager:
* sysprof_visualizer_list_get_zoom_manager:
*
* Returns: (nullable) (transfer): A #SpZoomManager or %NULL.
* Returns: (nullable) (transfer): A #SysprofZoomManager or %NULL.
*/
SpZoomManager *
sp_visualizer_list_get_zoom_manager (SpVisualizerList *self)
SysprofZoomManager *
sysprof_visualizer_list_get_zoom_manager (SysprofVisualizerList *self)
{
SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
g_return_val_if_fail (SP_IS_VISUALIZER_LIST (self), NULL);
g_return_val_if_fail (SYSPROF_IS_VISUALIZER_LIST (self), NULL);
return priv->zoom_manager;
}

View File

@ -1,4 +1,4 @@
/* sp-visualizer-list.h
/* sysprof-visualizer-list.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -22,16 +22,16 @@
#include <gtk/gtk.h>
#include "sp-capture-reader.h"
#include "sp-zoom-manager.h"
#include "sysprof-capture-reader.h"
#include "sysprof-zoom-manager.h"
G_BEGIN_DECLS
#define SP_TYPE_VISUALIZER_LIST (sp_visualizer_list_get_type())
#define SYSPROF_TYPE_VISUALIZER_LIST (sysprof_visualizer_list_get_type())
G_DECLARE_DERIVABLE_TYPE (SpVisualizerList, sp_visualizer_list, SP, VISUALIZER_LIST, GtkListBox)
G_DECLARE_DERIVABLE_TYPE (SysprofVisualizerList, sysprof_visualizer_list, SYSPROF, VISUALIZER_LIST, GtkListBox)
struct _SpVisualizerListClass
struct _SysprofVisualizerListClass
{
GtkListBoxClass parent_class;
@ -45,12 +45,12 @@ struct _SpVisualizerListClass
gpointer _reserved8;
};
GtkWidget *sp_visualizer_list_new (void);
void sp_visualizer_list_set_reader (SpVisualizerList *self,
SpCaptureReader *reader);
SpCaptureReader *sp_visualizer_list_get_reader (SpVisualizerList *self);
SpZoomManager *sp_visualizer_list_get_zoom_manager (SpVisualizerList *self);
void sp_visualizer_list_set_zoom_manager (SpVisualizerList *self,
SpZoomManager *zoom_manager);
GtkWidget *sysprof_visualizer_list_new (void);
void sysprof_visualizer_list_set_reader (SysprofVisualizerList *self,
SysprofCaptureReader *reader);
SysprofCaptureReader *sysprof_visualizer_list_get_reader (SysprofVisualizerList *self);
SysprofZoomManager *sysprof_visualizer_list_get_zoom_manager (SysprofVisualizerList *self);
void sysprof_visualizer_list_set_zoom_manager (SysprofVisualizerList *self,
SysprofZoomManager *zoom_manager);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-visualizer-row-private.h
/* sysprof-visualizer-row-private.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -20,10 +20,10 @@
#pragma once
#include "sp-visualizer-row.h"
#include "sysprof-visualizer-row.h"
G_BEGIN_DECLS
gint _sp_visualizer_row_get_graph_width (SpVisualizerRow *self);
gint _sysprof_visualizer_row_get_graph_width (SysprofVisualizerRow *self);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-visualizer-row.c
/* sysprof-visualizer-row.c
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -18,21 +18,21 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sp-visualizer-row"
#define G_LOG_DOMAIN "sysprof-visualizer-row"
#include "config.h"
#include "sp-visualizer-row.h"
#include "sp-visualizer-row-private.h"
#include "sysprof-visualizer-row.h"
#include "sysprof-visualizer-row-private.h"
#define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
#define DEFAULT_PIXELS_PER_SECOND 20
typedef struct
{
SpCaptureReader *reader;
SpZoomManager *zoom_manager;
} SpVisualizerRowPrivate;
SysprofCaptureReader *reader;
SysprofZoomManager *zoom_manager;
} SysprofVisualizerRowPrivate;
enum {
PROP_0,
@ -42,26 +42,26 @@ enum {
static GParamSpec *properties [N_PROPS];
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (SpVisualizerRow, sp_visualizer_row, GTK_TYPE_LIST_BOX_ROW)
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (SysprofVisualizerRow, sysprof_visualizer_row, GTK_TYPE_LIST_BOX_ROW)
gint
_sp_visualizer_row_get_graph_width (SpVisualizerRow *self)
_sysprof_visualizer_row_get_graph_width (SysprofVisualizerRow *self)
{
SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
gdouble zoom_level = 1.0;
gint64 begin_time;
gint64 end_time;
g_assert (SP_IS_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_VISUALIZER_ROW (self));
if (priv->reader == NULL)
return 0;
if (priv->zoom_manager != NULL)
zoom_level = sp_zoom_manager_get_zoom (priv->zoom_manager);
zoom_level = sysprof_zoom_manager_get_zoom (priv->zoom_manager);
begin_time = sp_capture_reader_get_start_time (priv->reader);
end_time = sp_capture_reader_get_end_time (priv->reader);
begin_time = sysprof_capture_reader_get_start_time (priv->reader);
end_time = sysprof_capture_reader_get_end_time (priv->reader);
return (end_time - begin_time)
/ (gdouble)NSEC_PER_SEC
@ -70,36 +70,36 @@ _sp_visualizer_row_get_graph_width (SpVisualizerRow *self)
}
static void
sp_visualizer_row_get_preferred_width (GtkWidget *widget,
sysprof_visualizer_row_get_preferred_width (GtkWidget *widget,
gint *min_width,
gint *nat_width)
{
SpVisualizerRow *self = (SpVisualizerRow *)widget;
SysprofVisualizerRow *self = (SysprofVisualizerRow *)widget;
gint graph_width;
gint real_min_width = 0;
gint real_nat_width = 0;
g_assert (SP_IS_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_VISUALIZER_ROW (self));
GTK_WIDGET_CLASS (sp_visualizer_row_parent_class)->get_preferred_width (widget, &real_min_width, &real_nat_width);
GTK_WIDGET_CLASS (sysprof_visualizer_row_parent_class)->get_preferred_width (widget, &real_min_width, &real_nat_width);
graph_width = _sp_visualizer_row_get_graph_width (self);
graph_width = _sysprof_visualizer_row_get_graph_width (self);
*min_width = *nat_width = real_min_width + graph_width;
}
static void
sp_visualizer_row_get_property (GObject *object,
sysprof_visualizer_row_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpVisualizerRow *self = SP_VISUALIZER_ROW (object);
SysprofVisualizerRow *self = SYSPROF_VISUALIZER_ROW (object);
switch (prop_id)
{
case PROP_ZOOM_MANAGER:
g_value_set_object (value, sp_visualizer_row_get_zoom_manager (self));
g_value_set_object (value, sysprof_visualizer_row_get_zoom_manager (self));
break;
default:
@ -108,17 +108,17 @@ sp_visualizer_row_get_property (GObject *object,
}
static void
sp_visualizer_row_set_property (GObject *object,
sysprof_visualizer_row_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpVisualizerRow *self = SP_VISUALIZER_ROW (object);
SysprofVisualizerRow *self = SYSPROF_VISUALIZER_ROW (object);
switch (prop_id)
{
case PROP_ZOOM_MANAGER:
sp_visualizer_row_set_zoom_manager (self, g_value_get_object (value));
sysprof_visualizer_row_set_zoom_manager (self, g_value_get_object (value));
break;
default:
@ -127,87 +127,87 @@ sp_visualizer_row_set_property (GObject *object,
}
static void
sp_visualizer_row_finalize (GObject *object)
sysprof_visualizer_row_finalize (GObject *object)
{
SpVisualizerRow *self = (SpVisualizerRow *)object;
SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
SysprofVisualizerRow *self = (SysprofVisualizerRow *)object;
SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
g_clear_pointer (&priv->reader, sp_capture_reader_unref);
g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
g_clear_object (&priv->zoom_manager);
G_OBJECT_CLASS (sp_visualizer_row_parent_class)->finalize (object);
G_OBJECT_CLASS (sysprof_visualizer_row_parent_class)->finalize (object);
}
static void
sp_visualizer_row_class_init (SpVisualizerRowClass *klass)
sysprof_visualizer_row_class_init (SysprofVisualizerRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = sp_visualizer_row_finalize;
object_class->get_property = sp_visualizer_row_get_property;
object_class->set_property = sp_visualizer_row_set_property;
object_class->finalize = sysprof_visualizer_row_finalize;
object_class->get_property = sysprof_visualizer_row_get_property;
object_class->set_property = sysprof_visualizer_row_set_property;
widget_class->get_preferred_width = sp_visualizer_row_get_preferred_width;
widget_class->get_preferred_width = sysprof_visualizer_row_get_preferred_width;
properties [PROP_ZOOM_MANAGER] =
g_param_spec_object ("zoom-manager",
"Zoom Manager",
"Zoom Manager",
SP_TYPE_ZOOM_MANAGER,
SYSPROF_TYPE_ZOOM_MANAGER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
sp_visualizer_row_init (SpVisualizerRow *self)
sysprof_visualizer_row_init (SysprofVisualizerRow *self)
{
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (self), FALSE);
gtk_list_box_row_set_selectable (GTK_LIST_BOX_ROW (self), FALSE);
}
static void
sp_visualizer_row_zoom_manager_notify_zoom (SpVisualizerRow *self,
sysprof_visualizer_row_zoom_manager_notify_zoom (SysprofVisualizerRow *self,
GParamSpec *pspec,
SpZoomManager *zoom_manager)
SysprofZoomManager *zoom_manager)
{
g_assert (SP_IS_VISUALIZER_ROW (self));
g_assert (SP_IS_ZOOM_MANAGER (zoom_manager));
g_assert (SYSPROF_IS_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
gtk_widget_queue_resize (GTK_WIDGET (self));
}
/**
* sp_visualizer_row_get_zoom_manager:
* sysprof_visualizer_row_get_zoom_manager:
*
* Returns: (transfer none) (nullable): A #SpZoomManager or %NULL.
* Returns: (transfer none) (nullable): A #SysprofZoomManager or %NULL.
*/
SpZoomManager *
sp_visualizer_row_get_zoom_manager (SpVisualizerRow *self)
SysprofZoomManager *
sysprof_visualizer_row_get_zoom_manager (SysprofVisualizerRow *self)
{
SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
g_return_val_if_fail (SP_IS_VISUALIZER_ROW (self), NULL);
g_return_val_if_fail (SYSPROF_IS_VISUALIZER_ROW (self), NULL);
return priv->zoom_manager;
}
void
sp_visualizer_row_set_zoom_manager (SpVisualizerRow *self,
SpZoomManager *zoom_manager)
sysprof_visualizer_row_set_zoom_manager (SysprofVisualizerRow *self,
SysprofZoomManager *zoom_manager)
{
SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
g_return_if_fail (SP_IS_VISUALIZER_ROW (self));
g_return_if_fail (!zoom_manager || SP_IS_ZOOM_MANAGER (zoom_manager));
g_return_if_fail (SYSPROF_IS_VISUALIZER_ROW (self));
g_return_if_fail (!zoom_manager || SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
if (priv->zoom_manager != zoom_manager)
{
if (priv->zoom_manager != NULL)
{
g_signal_handlers_disconnect_by_func (priv->zoom_manager,
G_CALLBACK (sp_visualizer_row_zoom_manager_notify_zoom),
G_CALLBACK (sysprof_visualizer_row_zoom_manager_notify_zoom),
self);
g_clear_object (&priv->zoom_manager);
}
@ -217,7 +217,7 @@ sp_visualizer_row_set_zoom_manager (SpVisualizerRow *self,
priv->zoom_manager = g_object_ref (zoom_manager);
g_signal_connect_object (priv->zoom_manager,
"notify::zoom",
G_CALLBACK (sp_visualizer_row_zoom_manager_notify_zoom),
G_CALLBACK (sysprof_visualizer_row_zoom_manager_notify_zoom),
self,
G_CONNECT_SWAPPED);
}
@ -228,22 +228,22 @@ sp_visualizer_row_set_zoom_manager (SpVisualizerRow *self,
}
void
sp_visualizer_row_set_reader (SpVisualizerRow *self,
SpCaptureReader *reader)
sysprof_visualizer_row_set_reader (SysprofVisualizerRow *self,
SysprofCaptureReader *reader)
{
SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
g_return_if_fail (SP_IS_VISUALIZER_ROW (self));
g_return_if_fail (SYSPROF_IS_VISUALIZER_ROW (self));
if (priv->reader != reader)
{
g_clear_pointer (&priv->reader, sp_capture_reader_unref);
g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (reader != NULL)
priv->reader = sp_capture_reader_ref (reader);
priv->reader = sysprof_capture_reader_ref (reader);
if (SP_VISUALIZER_ROW_GET_CLASS (self)->set_reader)
SP_VISUALIZER_ROW_GET_CLASS (self)->set_reader (self, reader);
if (SYSPROF_VISUALIZER_ROW_GET_CLASS (self)->set_reader)
SYSPROF_VISUALIZER_ROW_GET_CLASS (self)->set_reader (self, reader);
gtk_widget_queue_resize (GTK_WIDGET (self));
}
@ -264,14 +264,14 @@ subtract_border (GtkAllocation *alloc,
}
static void
adjust_alloc_for_borders (SpVisualizerRow *self,
adjust_alloc_for_borders (SysprofVisualizerRow *self,
GtkAllocation *alloc)
{
GtkStyleContext *style_context;
GtkBorder border;
GtkStateFlags state;
g_assert (SP_IS_VISUALIZER_ROW (self));
g_assert (SYSPROF_IS_VISUALIZER_ROW (self));
g_assert (alloc != NULL);
state = gtk_widget_get_state_flags (GTK_WIDGET (self));
@ -282,16 +282,16 @@ adjust_alloc_for_borders (SpVisualizerRow *self,
}
void
sp_visualizer_row_translate_points (SpVisualizerRow *self,
const SpVisualizerRowRelativePoint *in_points,
sysprof_visualizer_row_translate_points (SysprofVisualizerRow *self,
const SysprofVisualizerRowRelativePoint *in_points,
guint n_in_points,
SpVisualizerRowAbsolutePoint *out_points,
SysprofVisualizerRowAbsolutePoint *out_points,
guint n_out_points)
{
GtkAllocation alloc;
gint graph_width;
g_return_if_fail (SP_IS_VISUALIZER_ROW (self));
g_return_if_fail (SYSPROF_IS_VISUALIZER_ROW (self));
g_return_if_fail (in_points != NULL);
g_return_if_fail (out_points != NULL);
g_return_if_fail (n_in_points == n_out_points);
@ -299,7 +299,7 @@ sp_visualizer_row_translate_points (SpVisualizerRow *self,
gtk_widget_get_allocation (GTK_WIDGET (self), &alloc);
adjust_alloc_for_borders (self, &alloc);
graph_width = _sp_visualizer_row_get_graph_width (self);
graph_width = _sysprof_visualizer_row_get_graph_width (self);
for (guint i = 0; i < n_in_points; i++)
{

View File

@ -1,4 +1,4 @@
/* sp-visualizer-row.h
/* sysprof-visualizer-row.h
*
* Copyright 2016-2019 Christian Hergert <christian@hergert.me>
*
@ -22,54 +22,54 @@
#include <gtk/gtk.h>
#include "sp-capture-reader.h"
#include "sp-zoom-manager.h"
#include "sysprof-capture-reader.h"
#include "sysprof-zoom-manager.h"
G_BEGIN_DECLS
#define SP_TYPE_VISUALIZER_ROW (sp_visualizer_row_get_type())
#define SYSPROF_TYPE_VISUALIZER_ROW (sysprof_visualizer_row_get_type())
G_DECLARE_DERIVABLE_TYPE (SpVisualizerRow, sp_visualizer_row, SP, VISUALIZER_ROW, GtkListBoxRow)
G_DECLARE_DERIVABLE_TYPE (SysprofVisualizerRow, sysprof_visualizer_row, SYSPROF, VISUALIZER_ROW, GtkListBoxRow)
typedef struct
{
gdouble x;
gdouble y;
} SpVisualizerRowRelativePoint;
} SysprofVisualizerRowRelativePoint;
typedef struct
{
gint x;
gint y;
} SpVisualizerRowAbsolutePoint;
} SysprofVisualizerRowAbsolutePoint;
struct _SpVisualizerRowClass
struct _SysprofVisualizerRowClass
{
GtkListBoxRowClass parent_class;
/**
* SpVisualizerRow::set_reader:
* SysprofVisualizerRow::set_reader:
*
* Sets the reader that the row should use to extract counters.
* This reader is private to the row and should be freed when
* no longer in use with sp_capture_reader_unref().
* no longer in use with sysprof_capture_reader_unref().
*/
void (*set_reader) (SpVisualizerRow *self,
SpCaptureReader *reader);
void (*set_reader) (SysprofVisualizerRow *self,
SysprofCaptureReader *reader);
/*< private >*/
gpointer _reserved[16];
};
void sp_visualizer_row_set_reader (SpVisualizerRow *self,
SpCaptureReader *reader);
SpZoomManager *sp_visualizer_row_get_zoom_manager (SpVisualizerRow *self);
void sp_visualizer_row_set_zoom_manager (SpVisualizerRow *self,
SpZoomManager *zoom_manager);
void sp_visualizer_row_translate_points (SpVisualizerRow *self,
const SpVisualizerRowRelativePoint *in_points,
void sysprof_visualizer_row_set_reader (SysprofVisualizerRow *self,
SysprofCaptureReader *reader);
SysprofZoomManager *sysprof_visualizer_row_get_zoom_manager (SysprofVisualizerRow *self);
void sysprof_visualizer_row_set_zoom_manager (SysprofVisualizerRow *self,
SysprofZoomManager *zoom_manager);
void sysprof_visualizer_row_translate_points (SysprofVisualizerRow *self,
const SysprofVisualizerRowRelativePoint *in_points,
guint n_in_points,
SpVisualizerRowAbsolutePoint *out_points,
SysprofVisualizerRowAbsolutePoint *out_points,
guint n_out_points);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-visualizer-ticks.c
/* sysprof-visualizer-ticks.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -22,7 +22,7 @@
#include <glib/gi18n.h>
#include "sp-visualizer-ticks.h"
#include "sysprof-visualizer-ticks.h"
#define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
#define NSEC_PER_HOUR (NSEC_PER_SEC * 60 * 60)
@ -31,7 +31,7 @@
#define MIN_TICK_DISTANCE 20
#define LABEL_HEIGHT_PX 8
struct _SpVisualizerTicks
struct _SysprofVisualizerTicks
{
GtkDrawingArea parent_instance;
@ -69,7 +69,7 @@ struct {
{ 1, 3, NSEC_PER_SEC / 1000 },
};
G_DEFINE_TYPE (SpVisualizerTicks, sp_visualizer_ticks, GTK_TYPE_DRAWING_AREA)
G_DEFINE_TYPE (SysprofVisualizerTicks, sysprof_visualizer_ticks, GTK_TYPE_DRAWING_AREA)
static void
update_label_text (PangoLayout *layout,
@ -126,7 +126,7 @@ update_label_text (PangoLayout *layout,
}
static inline gdouble
get_x_for_time (SpVisualizerTicks *self,
get_x_for_time (SysprofVisualizerTicks *self,
const GtkAllocation *alloc,
gint64 t)
{
@ -137,7 +137,7 @@ get_x_for_time (SpVisualizerTicks *self,
#if 0
static inline gint64
get_time_at_x (SpVisualizerTicks *self,
get_time_at_x (SysprofVisualizerTicks *self,
const GtkAllocation *alloc,
gdouble x)
{
@ -148,7 +148,7 @@ get_time_at_x (SpVisualizerTicks *self,
#endif
static gboolean
draw_ticks (SpVisualizerTicks *self,
draw_ticks (SysprofVisualizerTicks *self,
cairo_t *cr,
GtkAllocation *area,
gint ticks,
@ -159,7 +159,7 @@ draw_ticks (SpVisualizerTicks *self,
gint64 x_offset;
gint count = 0;
g_assert (SP_IS_VISUALIZER_TICKS (self));
g_assert (SYSPROF_IS_VISUALIZER_TICKS (self));
g_assert (cr != NULL);
g_assert (area != NULL);
g_assert (ticks >= 0);
@ -234,17 +234,17 @@ draw_ticks (SpVisualizerTicks *self,
}
static gboolean
sp_visualizer_ticks_draw (GtkWidget *widget,
sysprof_visualizer_ticks_draw (GtkWidget *widget,
cairo_t *cr)
{
SpVisualizerTicks *self = SP_VISUALIZER_TICKS (widget);
SysprofVisualizerTicks *self = SYSPROF_VISUALIZER_TICKS (widget);
GtkStyleContext *style;
GtkAllocation alloc;
GtkStateFlags state;
gint64 timespan;
GdkRGBA color;
g_assert (SP_IS_VISUALIZER_TICKS (self));
g_assert (SYSPROF_IS_VISUALIZER_TICKS (self));
g_assert (cr != NULL);
if (0 == (timespan = self->end_time - self->begin_time))
@ -289,28 +289,28 @@ sp_visualizer_ticks_draw (GtkWidget *widget,
}
static void
sp_visualizer_ticks_get_preferred_height (GtkWidget *widget,
sysprof_visualizer_ticks_get_preferred_height (GtkWidget *widget,
gint *min_height,
gint *nat_height)
{
g_assert (SP_IS_VISUALIZER_TICKS (widget));
g_assert (SYSPROF_IS_VISUALIZER_TICKS (widget));
*min_height = *nat_height = tick_sizing[0].height + LABEL_HEIGHT_PX;
}
static void
sp_visualizer_ticks_class_init (SpVisualizerTicksClass *klass)
sysprof_visualizer_ticks_class_init (SysprofVisualizerTicksClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->draw = sp_visualizer_ticks_draw;
widget_class->get_preferred_height = sp_visualizer_ticks_get_preferred_height;
widget_class->draw = sysprof_visualizer_ticks_draw;
widget_class->get_preferred_height = sysprof_visualizer_ticks_get_preferred_height;
gtk_widget_class_set_css_name (widget_class, "ticks");
}
static void
sp_visualizer_ticks_init (SpVisualizerTicks *self)
sysprof_visualizer_ticks_init (SysprofVisualizerTicks *self)
{
self->end_time = G_GINT64_CONSTANT (1000000000) * 60;
@ -318,17 +318,17 @@ sp_visualizer_ticks_init (SpVisualizerTicks *self)
}
GtkWidget *
sp_visualizer_ticks_new (void)
sysprof_visualizer_ticks_new (void)
{
return g_object_new (SP_TYPE_VISUALIZER_TICKS, NULL);
return g_object_new (SYSPROF_TYPE_VISUALIZER_TICKS, NULL);
}
void
sp_visualizer_ticks_get_time_range (SpVisualizerTicks *self,
sysprof_visualizer_ticks_get_time_range (SysprofVisualizerTicks *self,
gint64 *begin_time,
gint64 *end_time)
{
g_return_if_fail (SP_IS_VISUALIZER_TICKS (self));
g_return_if_fail (SYSPROF_IS_VISUALIZER_TICKS (self));
g_return_if_fail (begin_time != NULL || end_time != NULL);
if (begin_time != NULL)
@ -339,11 +339,11 @@ sp_visualizer_ticks_get_time_range (SpVisualizerTicks *self,
}
void
sp_visualizer_ticks_set_time_range (SpVisualizerTicks *self,
sysprof_visualizer_ticks_set_time_range (SysprofVisualizerTicks *self,
gint64 begin_time,
gint64 end_time)
{
g_return_if_fail (SP_IS_VISUALIZER_TICKS (self));
g_return_if_fail (SYSPROF_IS_VISUALIZER_TICKS (self));
if (begin_time > end_time)
{
@ -359,9 +359,9 @@ sp_visualizer_ticks_set_time_range (SpVisualizerTicks *self,
}
gint64
sp_visualizer_ticks_get_epoch (SpVisualizerTicks *self)
sysprof_visualizer_ticks_get_epoch (SysprofVisualizerTicks *self)
{
g_return_val_if_fail (SP_IS_VISUALIZER_TICKS (self), 0);
g_return_val_if_fail (SYSPROF_IS_VISUALIZER_TICKS (self), 0);
return self->epoch;
}
@ -370,7 +370,7 @@ sp_visualizer_ticks_get_epoch (SpVisualizerTicks *self)
* Sets the epoch for the visualizer ticks.
*
* The epoch is the "real" starting time of the capture, where as the
* sp_visualizer_ticks_set_time_range() function sets the visible range
* sysprof_visualizer_ticks_set_time_range() function sets the visible range
* of the capture.
*
* This is used to calculate the offset of the beginning of the capture
@ -379,10 +379,10 @@ sp_visualizer_ticks_get_epoch (SpVisualizerTicks *self)
* This function should only need to be called when the reader is changed.
*/
void
sp_visualizer_ticks_set_epoch (SpVisualizerTicks *self,
sysprof_visualizer_ticks_set_epoch (SysprofVisualizerTicks *self,
gint64 epoch)
{
g_return_if_fail (SP_IS_VISUALIZER_TICKS (self));
g_return_if_fail (SYSPROF_IS_VISUALIZER_TICKS (self));
if (self->epoch != epoch)
{

View File

@ -1,4 +1,4 @@
/* sp-visualizer-ticks.h
/* sysprof-visualizer-ticks.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -24,18 +24,18 @@
G_BEGIN_DECLS
#define SP_TYPE_VISUALIZER_TICKS (sp_visualizer_ticks_get_type())
#define SYSPROF_TYPE_VISUALIZER_TICKS (sysprof_visualizer_ticks_get_type())
G_DECLARE_FINAL_TYPE (SpVisualizerTicks, sp_visualizer_ticks, SP, VISUALIZER_TICKS, GtkDrawingArea)
G_DECLARE_FINAL_TYPE (SysprofVisualizerTicks, sysprof_visualizer_ticks, SYSPROF, VISUALIZER_TICKS, GtkDrawingArea)
GtkWidget *sp_visualizer_ticks_new (void);
void sp_visualizer_ticks_set_epoch (SpVisualizerTicks *self,
GtkWidget *sysprof_visualizer_ticks_new (void);
void sysprof_visualizer_ticks_set_epoch (SysprofVisualizerTicks *self,
gint64 epoch);
gint64 sp_visualizer_ticks_get_epoch (SpVisualizerTicks *self);
void sp_visualizer_ticks_get_time_range (SpVisualizerTicks *self,
gint64 sysprof_visualizer_ticks_get_epoch (SysprofVisualizerTicks *self);
void sysprof_visualizer_ticks_get_time_range (SysprofVisualizerTicks *self,
gint64 *begin_time,
gint64 *end_time);
void sp_visualizer_ticks_set_time_range (SpVisualizerTicks *self,
void sysprof_visualizer_ticks_set_time_range (SysprofVisualizerTicks *self,
gint64 begin_time,
gint64 end_time);

View File

@ -1,4 +1,4 @@
/* sp-visualizer-view.c
/* sysprof-visualizer-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -18,42 +18,42 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sp-visualizer-view"
#define G_LOG_DOMAIN "sysprof-visualizer-view"
#include "config.h"
#include <glib/gi18n.h>
#include "sp-theme-manager.h"
#include "sp-visualizer-list.h"
#include "sp-visualizer-row.h"
#include "sp-visualizer-row-private.h"
#include "sp-selection.h"
#include "sp-visualizer-ticks.h"
#include "sp-visualizer-view.h"
#include "sysprof-theme-manager.h"
#include "sysprof-visualizer-list.h"
#include "sysprof-visualizer-row.h"
#include "sysprof-visualizer-row-private.h"
#include "sysprof-selection.h"
#include "sysprof-visualizer-ticks.h"
#include "sysprof-visualizer-view.h"
#define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
#define DEFAULT_PIXELS_PER_SECOND 20
typedef struct
{
SpCaptureReader *reader;
SpZoomManager *zoom_manager;
SpSelection *selection;
SysprofCaptureReader *reader;
SysprofZoomManager *zoom_manager;
SysprofSelection *selection;
SpVisualizerList *list;
SysprofVisualizerList *list;
GtkScrolledWindow *scroller;
SpVisualizerTicks *ticks;
SysprofVisualizerTicks *ticks;
gint64 drag_begin_at;
gint64 drag_selection_at;
guint button_pressed : 1;
} SpVisualizerViewPrivate;
} SysprofVisualizerViewPrivate;
typedef struct
{
SpVisualizerView *self;
SysprofVisualizerView *self;
GtkStyleContext *style_context;
cairo_t *cr;
GtkAllocation alloc;
@ -74,8 +74,8 @@ enum {
static void buildable_iface_init (GtkBuildableIface *iface);
G_DEFINE_TYPE_EXTENDED (SpVisualizerView, sp_visualizer_view, GTK_TYPE_BIN, 0,
G_ADD_PRIVATE (SpVisualizerView)
G_DEFINE_TYPE_EXTENDED (SysprofVisualizerView, sysprof_visualizer_view, GTK_TYPE_BIN, 0,
G_ADD_PRIVATE (SysprofVisualizerView)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init))
static GParamSpec *properties [N_PROPS];
@ -88,23 +88,23 @@ find_row1 (GtkWidget *widget,
{
GtkWidget **row1 = data;
if (*row1 == NULL && SP_IS_VISUALIZER_ROW (widget))
if (*row1 == NULL && SYSPROF_IS_VISUALIZER_ROW (widget))
*row1 = widget;
}
static gint64
get_time_from_coordinates (SpVisualizerView *self,
get_time_from_coordinates (SysprofVisualizerView *self,
gint x,
gint y)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SpVisualizerRow *row1 = NULL;
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
SysprofVisualizerRow *row1 = NULL;
GtkAllocation alloc;
gint64 begin_time;
gint64 end_time;
gint graph_width;
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
if (priv->reader == NULL)
return 0;
@ -119,23 +119,23 @@ get_time_from_coordinates (SpVisualizerView *self,
* (ignoring spacing caused by the widget being wider than the data points.
*/
gtk_container_foreach (GTK_CONTAINER (priv->list), find_row1, &row1);
if (!SP_IS_VISUALIZER_ROW (row1))
if (!SYSPROF_IS_VISUALIZER_ROW (row1))
return 0;
begin_time = sp_capture_reader_get_start_time (priv->reader);
end_time = sp_capture_reader_get_end_time (priv->reader);
graph_width = _sp_visualizer_row_get_graph_width (row1);
begin_time = sysprof_capture_reader_get_start_time (priv->reader);
end_time = sysprof_capture_reader_get_end_time (priv->reader);
graph_width = _sysprof_visualizer_row_get_graph_width (row1);
return begin_time + ((end_time - begin_time) * (x / (gdouble)graph_width));
}
static gint
get_x_for_time_at (SpVisualizerView *self,
get_x_for_time_at (SysprofVisualizerView *self,
const GtkAllocation *alloc,
gint64 time_at)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SpVisualizerRow *row1 = NULL;
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
SysprofVisualizerRow *row1 = NULL;
GtkAdjustment *hadjustment;
gdouble nsec_per_pixel;
gdouble value;
@ -143,7 +143,7 @@ get_x_for_time_at (SpVisualizerView *self,
gint64 end_time;
gint graph_width;
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (alloc != NULL);
/*
@ -151,16 +151,16 @@ get_x_for_time_at (SpVisualizerView *self,
* (ignoring spacing caused by the widget being wider than the data points.
*/
gtk_container_foreach (GTK_CONTAINER (priv->list), find_row1, &row1);
if (!SP_IS_VISUALIZER_ROW (row1))
if (!SYSPROF_IS_VISUALIZER_ROW (row1))
return 0;
hadjustment = gtk_scrolled_window_get_hadjustment (priv->scroller);
value = gtk_adjustment_get_value (hadjustment);
begin_time = sp_capture_reader_get_start_time (priv->reader);
end_time = sp_capture_reader_get_end_time (priv->reader);
begin_time = sysprof_capture_reader_get_start_time (priv->reader);
end_time = sysprof_capture_reader_get_end_time (priv->reader);
graph_width = _sp_visualizer_row_get_graph_width (row1);
graph_width = _sysprof_visualizer_row_get_graph_width (row1);
nsec_per_pixel = (end_time - begin_time) / (gdouble)graph_width;
begin_time += value * nsec_per_pixel;
@ -168,42 +168,42 @@ get_x_for_time_at (SpVisualizerView *self,
}
static void
sp_visualizer_view_row_added (SpVisualizerView *self,
sysprof_visualizer_view_row_added (SysprofVisualizerView *self,
GtkWidget *widget,
SpVisualizerList *list)
SysprofVisualizerList *list)
{
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (GTK_IS_WIDGET (widget));
g_assert (SP_IS_VISUALIZER_LIST (list));
g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
if (SP_IS_VISUALIZER_ROW (widget))
if (SYSPROF_IS_VISUALIZER_ROW (widget))
g_signal_emit (self, signals [VISUALIZER_ADDED], 0, widget);
}
static void
sp_visualizer_view_row_removed (SpVisualizerView *self,
sysprof_visualizer_view_row_removed (SysprofVisualizerView *self,
GtkWidget *widget,
SpVisualizerList *list)
SysprofVisualizerList *list)
{
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (GTK_IS_WIDGET (widget));
g_assert (SP_IS_VISUALIZER_LIST (list));
g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
if (SP_IS_VISUALIZER_ROW (widget))
if (SYSPROF_IS_VISUALIZER_ROW (widget))
g_signal_emit (self, signals [VISUALIZER_REMOVED], 0, widget);
}
static void
sp_visualizer_view_update_ticks (SpVisualizerView *self)
sysprof_visualizer_view_update_ticks (SysprofVisualizerView *self)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
GtkAdjustment *hadjustment;
GtkAllocation alloc;
gdouble value;
gint64 begin_time;
gint64 end_time;
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
hadjustment = gtk_scrolled_window_get_hadjustment (priv->scroller);
value = gtk_adjustment_get_value (hadjustment);
@ -213,35 +213,35 @@ sp_visualizer_view_update_ticks (SpVisualizerView *self)
begin_time = get_time_from_coordinates (self, alloc.x + value, alloc.y);
end_time = get_time_from_coordinates (self, alloc.x + value + alloc.width, alloc.y);
sp_visualizer_ticks_set_time_range (priv->ticks, begin_time, end_time);
sysprof_visualizer_ticks_set_time_range (priv->ticks, begin_time, end_time);
}
static void
sp_visualizer_view_hadjustment_value_changed (SpVisualizerView *self,
sysprof_visualizer_view_hadjustment_value_changed (SysprofVisualizerView *self,
GtkAdjustment *adjustment)
{
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (GTK_IS_ADJUSTMENT (adjustment));
sp_visualizer_view_update_ticks (self);
sysprof_visualizer_view_update_ticks (self);
}
static void
sp_visualizer_view_size_allocate (GtkWidget *widget,
sysprof_visualizer_view_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
SpVisualizerView *self = (SpVisualizerView *)widget;
SysprofVisualizerView *self = (SysprofVisualizerView *)widget;
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (allocation != NULL);
GTK_WIDGET_CLASS (sp_visualizer_view_parent_class)->size_allocate (widget, allocation);
GTK_WIDGET_CLASS (sysprof_visualizer_view_parent_class)->size_allocate (widget, allocation);
sp_visualizer_view_update_ticks (self);
sysprof_visualizer_view_update_ticks (self);
}
static void
draw_selection_cb (SpSelection *selection,
draw_selection_cb (SysprofSelection *selection,
gint64 range_begin,
gint64 range_end,
gpointer user_data)
@ -249,10 +249,10 @@ draw_selection_cb (SpSelection *selection,
SelectionDraw *draw = user_data;
GdkRectangle area;
g_assert (SP_IS_SELECTION (selection));
g_assert (SYSPROF_IS_SELECTION (selection));
g_assert (draw != NULL);
g_assert (draw->cr != NULL);
g_assert (SP_IS_VISUALIZER_VIEW (draw->self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (draw->self));
area.x = get_x_for_time_at (draw->self, &draw->alloc, range_begin);
area.width = get_x_for_time_at (draw->self, &draw->alloc, range_end) - area.x;
@ -269,11 +269,11 @@ draw_selection_cb (SpSelection *selection,
}
static gboolean
sp_visualizer_view_draw (GtkWidget *widget,
sysprof_visualizer_view_draw (GtkWidget *widget,
cairo_t *cr)
{
SpVisualizerView *self = (SpVisualizerView *)widget;
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerView *self = (SysprofVisualizerView *)widget;
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
SelectionDraw draw = { 0 };
gboolean ret;
@ -286,12 +286,12 @@ sp_visualizer_view_draw (GtkWidget *widget,
gtk_widget_get_allocation (widget, &draw.alloc);
ret = GTK_WIDGET_CLASS (sp_visualizer_view_parent_class)->draw (widget, cr);
ret = GTK_WIDGET_CLASS (sysprof_visualizer_view_parent_class)->draw (widget, cr);
if (sp_selection_get_has_selection (priv->selection) || priv->button_pressed)
if (sysprof_selection_get_has_selection (priv->selection) || priv->button_pressed)
{
gtk_style_context_add_class (draw.style_context, "selection");
sp_selection_foreach (priv->selection, draw_selection_cb, &draw);
sysprof_selection_foreach (priv->selection, draw_selection_cb, &draw);
if (priv->button_pressed)
draw_selection_cb (priv->selection, priv->drag_begin_at, priv->drag_selection_at, &draw);
gtk_style_context_remove_class (draw.style_context, "selection");
@ -301,31 +301,31 @@ sp_visualizer_view_draw (GtkWidget *widget,
}
static gboolean
sp_visualizer_view_list_button_press_event (SpVisualizerView *self,
sysprof_visualizer_view_list_button_press_event (SysprofVisualizerView *self,
GdkEventButton *ev,
SpVisualizerList *list)
SysprofVisualizerList *list)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (ev != NULL);
g_assert (SP_IS_VISUALIZER_LIST (list));
g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
if (priv->reader == NULL)
return GDK_EVENT_PROPAGATE;
if (ev->button != GDK_BUTTON_PRIMARY)
{
if (sp_selection_get_has_selection (priv->selection))
if (sysprof_selection_get_has_selection (priv->selection))
{
sp_selection_unselect_all (priv->selection);
sysprof_selection_unselect_all (priv->selection);
return GDK_EVENT_STOP;
}
return GDK_EVENT_PROPAGATE;
}
if ((ev->state & GDK_SHIFT_MASK) == 0)
sp_selection_unselect_all (priv->selection);
sysprof_selection_unselect_all (priv->selection);
priv->button_pressed = TRUE;
@ -338,15 +338,15 @@ sp_visualizer_view_list_button_press_event (SpVisualizerView *self,
}
static gboolean
sp_visualizer_view_list_button_release_event (SpVisualizerView *self,
sysprof_visualizer_view_list_button_release_event (SysprofVisualizerView *self,
GdkEventButton *ev,
SpVisualizerList *list)
SysprofVisualizerList *list)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (ev != NULL);
g_assert (SP_IS_VISUALIZER_LIST (list));
g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
if (!priv->button_pressed || ev->button != GDK_BUTTON_PRIMARY)
return GDK_EVENT_PROPAGATE;
@ -355,7 +355,7 @@ sp_visualizer_view_list_button_release_event (SpVisualizerView *self,
if (priv->drag_begin_at != priv->drag_selection_at)
{
sp_selection_select_range (priv->selection,
sysprof_selection_select_range (priv->selection,
priv->drag_begin_at,
priv->drag_selection_at);
priv->drag_begin_at = -1;
@ -368,15 +368,15 @@ sp_visualizer_view_list_button_release_event (SpVisualizerView *self,
}
static gboolean
sp_visualizer_view_list_motion_notify_event (SpVisualizerView *self,
sysprof_visualizer_view_list_motion_notify_event (SysprofVisualizerView *self,
GdkEventMotion *ev,
SpVisualizerList *list)
SysprofVisualizerList *list)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (ev != NULL);
g_assert (SP_IS_VISUALIZER_LIST (list));
g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
if (!priv->button_pressed)
return GDK_EVENT_PROPAGATE;
@ -389,15 +389,15 @@ sp_visualizer_view_list_motion_notify_event (SpVisualizerView *self,
}
static void
sp_visualizer_view_list_realize_after (SpVisualizerView *self,
SpVisualizerList *list)
sysprof_visualizer_view_list_realize_after (SysprofVisualizerView *self,
SysprofVisualizerList *list)
{
GdkDisplay *display;
GdkWindow *window;
GdkCursor *cursor;
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SP_IS_VISUALIZER_LIST (list));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
window = gtk_widget_get_window (GTK_WIDGET (list));
display = gdk_window_get_display (window);
@ -407,44 +407,44 @@ sp_visualizer_view_list_realize_after (SpVisualizerView *self,
}
static void
sp_visualizer_view_selection_changed (SpVisualizerView *self,
SpSelection *selection)
sysprof_visualizer_view_selection_changed (SysprofVisualizerView *self,
SysprofSelection *selection)
{
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SP_IS_SELECTION (selection));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_SELECTION (selection));
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
sp_visualizer_view_finalize (GObject *object)
sysprof_visualizer_view_finalize (GObject *object)
{
SpVisualizerView *self = (SpVisualizerView *)object;
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerView *self = (SysprofVisualizerView *)object;
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_clear_pointer (&priv->reader, sp_capture_reader_unref);
g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
g_clear_object (&priv->zoom_manager);
g_clear_object (&priv->selection);
G_OBJECT_CLASS (sp_visualizer_view_parent_class)->finalize (object);
G_OBJECT_CLASS (sysprof_visualizer_view_parent_class)->finalize (object);
}
static void
sp_visualizer_view_get_property (GObject *object,
sysprof_visualizer_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpVisualizerView *self = SP_VISUALIZER_VIEW (object);
SysprofVisualizerView *self = SYSPROF_VISUALIZER_VIEW (object);
switch (prop_id)
{
case PROP_READER:
g_value_set_boxed (value, sp_visualizer_view_get_reader (self));
g_value_set_boxed (value, sysprof_visualizer_view_get_reader (self));
break;
case PROP_ZOOM_MANAGER:
g_value_set_object (value, sp_visualizer_view_get_zoom_manager (self));
g_value_set_object (value, sysprof_visualizer_view_get_zoom_manager (self));
break;
default:
@ -453,21 +453,21 @@ sp_visualizer_view_get_property (GObject *object,
}
static void
sp_visualizer_view_set_property (GObject *object,
sysprof_visualizer_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpVisualizerView *self = SP_VISUALIZER_VIEW (object);
SysprofVisualizerView *self = SYSPROF_VISUALIZER_VIEW (object);
switch (prop_id)
{
case PROP_READER:
sp_visualizer_view_set_reader (self, g_value_get_boxed (value));
sysprof_visualizer_view_set_reader (self, g_value_get_boxed (value));
break;
case PROP_ZOOM_MANAGER:
sp_visualizer_view_set_zoom_manager (self, g_value_get_object (value));
sysprof_visualizer_view_set_zoom_manager (self, g_value_get_object (value));
break;
default:
@ -476,31 +476,31 @@ sp_visualizer_view_set_property (GObject *object,
}
static void
sp_visualizer_view_class_init (SpVisualizerViewClass *klass)
sysprof_visualizer_view_class_init (SysprofVisualizerViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
SpThemeManager *theme_manager = sp_theme_manager_get_default ();
SysprofThemeManager *theme_manager = sysprof_theme_manager_get_default ();
object_class->finalize = sp_visualizer_view_finalize;
object_class->get_property = sp_visualizer_view_get_property;
object_class->set_property = sp_visualizer_view_set_property;
object_class->finalize = sysprof_visualizer_view_finalize;
object_class->get_property = sysprof_visualizer_view_get_property;
object_class->set_property = sysprof_visualizer_view_set_property;
widget_class->draw = sp_visualizer_view_draw;
widget_class->size_allocate = sp_visualizer_view_size_allocate;
widget_class->draw = sysprof_visualizer_view_draw;
widget_class->size_allocate = sysprof_visualizer_view_size_allocate;
properties [PROP_READER] =
g_param_spec_boxed ("reader",
"Reader",
"The reader for the visualizers",
SP_TYPE_CAPTURE_READER,
SYSPROF_TYPE_CAPTURE_READER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_ZOOM_MANAGER] =
g_param_spec_object ("zoom-manager",
"Zoom Manager",
"The zoom manager for the view",
SP_TYPE_ZOOM_MANAGER,
SYSPROF_TYPE_ZOOM_MANAGER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
@ -509,37 +509,37 @@ sp_visualizer_view_class_init (SpVisualizerViewClass *klass)
g_signal_new ("visualizer-added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (SpVisualizerViewClass, visualizer_added),
G_STRUCT_OFFSET (SysprofVisualizerViewClass, visualizer_added),
NULL, NULL, NULL,
G_TYPE_NONE, 1, SP_TYPE_VISUALIZER_ROW);
G_TYPE_NONE, 1, SYSPROF_TYPE_VISUALIZER_ROW);
signals [VISUALIZER_REMOVED] =
g_signal_new ("visualizer-removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (SpVisualizerViewClass, visualizer_removed),
G_STRUCT_OFFSET (SysprofVisualizerViewClass, visualizer_removed),
NULL, NULL, NULL,
G_TYPE_NONE, 1, SP_TYPE_VISUALIZER_ROW);
G_TYPE_NONE, 1, SYSPROF_TYPE_VISUALIZER_ROW);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sp-visualizer-view.ui");
gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, list);
gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, scroller);
gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, ticks);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-visualizer-view.ui");
gtk_widget_class_bind_template_child_private (widget_class, SysprofVisualizerView, list);
gtk_widget_class_bind_template_child_private (widget_class, SysprofVisualizerView, scroller);
gtk_widget_class_bind_template_child_private (widget_class, SysprofVisualizerView, ticks);
gtk_widget_class_set_css_name (widget_class, "visualizers");
sp_theme_manager_register_resource (theme_manager, NULL, NULL, "/org/gnome/sysprof/css/SpVisualizerView-shared.css");
sp_theme_manager_register_resource (theme_manager, "Adwaita", NULL, "/org/gnome/sysprof/css/SpVisualizerView-Adwaita.css");
sp_theme_manager_register_resource (theme_manager, "Adwaita", "dark", "/org/gnome/sysprof/css/SpVisualizerView-Adwaita-dark.css");
sysprof_theme_manager_register_resource (theme_manager, NULL, NULL, "/org/gnome/sysprof/css/SysprofVisualizerView-shared.css");
sysprof_theme_manager_register_resource (theme_manager, "Adwaita", NULL, "/org/gnome/sysprof/css/SysprofVisualizerView-Adwaita.css");
sysprof_theme_manager_register_resource (theme_manager, "Adwaita", "dark", "/org/gnome/sysprof/css/SysprofVisualizerView-Adwaita-dark.css");
g_type_ensure (SP_TYPE_VISUALIZER_LIST);
g_type_ensure (SP_TYPE_VISUALIZER_TICKS);
g_type_ensure (SYSPROF_TYPE_VISUALIZER_LIST);
g_type_ensure (SYSPROF_TYPE_VISUALIZER_TICKS);
}
static void
sp_visualizer_view_init (SpVisualizerView *self)
sysprof_visualizer_view_init (SysprofVisualizerView *self)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
GtkAdjustment *hadjustment;
priv->drag_begin_at = -1;
@ -547,47 +547,47 @@ sp_visualizer_view_init (SpVisualizerView *self)
gtk_widget_init_template (GTK_WIDGET (self));
priv->selection = g_object_new (SP_TYPE_SELECTION, NULL);
priv->selection = g_object_new (SYSPROF_TYPE_SELECTION, NULL);
g_signal_connect_object (priv->selection,
"changed",
G_CALLBACK (sp_visualizer_view_selection_changed),
G_CALLBACK (sysprof_visualizer_view_selection_changed),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"button-press-event",
G_CALLBACK (sp_visualizer_view_list_button_press_event),
G_CALLBACK (sysprof_visualizer_view_list_button_press_event),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"button-release-event",
G_CALLBACK (sp_visualizer_view_list_button_release_event),
G_CALLBACK (sysprof_visualizer_view_list_button_release_event),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"motion-notify-event",
G_CALLBACK (sp_visualizer_view_list_motion_notify_event),
G_CALLBACK (sysprof_visualizer_view_list_motion_notify_event),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"realize",
G_CALLBACK (sp_visualizer_view_list_realize_after),
G_CALLBACK (sysprof_visualizer_view_list_realize_after),
self,
G_CONNECT_SWAPPED | G_CONNECT_AFTER);
g_signal_connect_object (priv->list,
"add",
G_CALLBACK (sp_visualizer_view_row_added),
G_CALLBACK (sysprof_visualizer_view_row_added),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"remove",
G_CALLBACK (sp_visualizer_view_row_removed),
G_CALLBACK (sysprof_visualizer_view_row_removed),
self,
G_CONNECT_SWAPPED);
@ -595,69 +595,69 @@ sp_visualizer_view_init (SpVisualizerView *self)
g_signal_connect_object (hadjustment,
"value-changed",
G_CALLBACK (sp_visualizer_view_hadjustment_value_changed),
G_CALLBACK (sysprof_visualizer_view_hadjustment_value_changed),
self,
G_CONNECT_SWAPPED);
}
/**
* sp_visualizer_view_get_reader:
* sysprof_visualizer_view_get_reader:
*
* Returns: (transfer none): An #SpCaptureReader
* Returns: (transfer none): An #SysprofCaptureReader
*/
SpCaptureReader *
sp_visualizer_view_get_reader (SpVisualizerView *self)
SysprofCaptureReader *
sysprof_visualizer_view_get_reader (SysprofVisualizerView *self)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_return_val_if_fail (SP_IS_VISUALIZER_VIEW (self), NULL);
g_return_val_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self), NULL);
return priv->reader;
}
void
sp_visualizer_view_set_reader (SpVisualizerView *self,
SpCaptureReader *reader)
sysprof_visualizer_view_set_reader (SysprofVisualizerView *self,
SysprofCaptureReader *reader)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_return_if_fail (SP_IS_VISUALIZER_VIEW (self));
g_return_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self));
if (priv->reader != reader)
{
g_clear_pointer (&priv->reader, sp_capture_reader_unref);
g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (reader != NULL)
{
gint64 begin_time;
priv->reader = sp_capture_reader_ref (reader);
priv->reader = sysprof_capture_reader_ref (reader);
begin_time = sp_capture_reader_get_start_time (priv->reader);
begin_time = sysprof_capture_reader_get_start_time (priv->reader);
sp_visualizer_ticks_set_epoch (priv->ticks, begin_time);
sp_visualizer_ticks_set_time_range (priv->ticks, begin_time, begin_time);
sysprof_visualizer_ticks_set_epoch (priv->ticks, begin_time);
sysprof_visualizer_ticks_set_time_range (priv->ticks, begin_time, begin_time);
sp_selection_unselect_all (priv->selection);
sysprof_selection_unselect_all (priv->selection);
}
sp_visualizer_list_set_reader (priv->list, reader);
sp_visualizer_view_update_ticks (self);
sysprof_visualizer_list_set_reader (priv->list, reader);
sysprof_visualizer_view_update_ticks (self);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_READER]);
}
}
static void
sp_visualizer_view_add_child (GtkBuildable *buildable,
sysprof_visualizer_view_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const gchar *type)
{
SpVisualizerView *self = (SpVisualizerView *)buildable;
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerView *self = (SysprofVisualizerView *)buildable;
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (GTK_IS_BUILDER (builder));
g_assert (G_IS_OBJECT (child));
@ -674,50 +674,50 @@ static void
buildable_iface_init (GtkBuildableIface *iface)
{
parent_buildable = g_type_interface_peek_parent (iface);
iface->add_child = sp_visualizer_view_add_child;
iface->add_child = sysprof_visualizer_view_add_child;
}
static void
sp_visualizer_view_zoom_manager_notify_zoom (SpVisualizerView *self,
sysprof_visualizer_view_zoom_manager_notify_zoom (SysprofVisualizerView *self,
GParamSpec *pspec,
SpZoomManager *zoom_manager)
SysprofZoomManager *zoom_manager)
{
g_assert (SP_IS_VISUALIZER_VIEW (self));
g_assert (SP_IS_ZOOM_MANAGER (zoom_manager));
g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
sp_visualizer_view_update_ticks (self);
sysprof_visualizer_view_update_ticks (self);
}
/**
* sp_visualizer_view_get_zoom_manager:
* sysprof_visualizer_view_get_zoom_manager:
*
* Returns: (transfer none) (nullable): An #SpZoomManager or %NULL
* Returns: (transfer none) (nullable): An #SysprofZoomManager or %NULL
*/
SpZoomManager *
sp_visualizer_view_get_zoom_manager (SpVisualizerView *self)
SysprofZoomManager *
sysprof_visualizer_view_get_zoom_manager (SysprofVisualizerView *self)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_return_val_if_fail (SP_IS_VISUALIZER_VIEW (self), NULL);
g_return_val_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self), NULL);
return priv->zoom_manager;
}
void
sp_visualizer_view_set_zoom_manager (SpVisualizerView *self,
SpZoomManager *zoom_manager)
sysprof_visualizer_view_set_zoom_manager (SysprofVisualizerView *self,
SysprofZoomManager *zoom_manager)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_return_if_fail (SP_IS_VISUALIZER_VIEW (self));
g_return_if_fail (!zoom_manager || SP_IS_ZOOM_MANAGER (zoom_manager));
g_return_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self));
g_return_if_fail (!zoom_manager || SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
if (priv->zoom_manager != zoom_manager)
{
if (priv->zoom_manager != NULL)
{
g_signal_handlers_disconnect_by_func (priv->zoom_manager,
G_CALLBACK (sp_visualizer_view_zoom_manager_notify_zoom),
G_CALLBACK (sysprof_visualizer_view_zoom_manager_notify_zoom),
self);
g_clear_object (&priv->zoom_manager);
}
@ -727,12 +727,12 @@ sp_visualizer_view_set_zoom_manager (SpVisualizerView *self,
priv->zoom_manager = g_object_ref (zoom_manager);
g_signal_connect_object (priv->zoom_manager,
"notify::zoom",
G_CALLBACK (sp_visualizer_view_zoom_manager_notify_zoom),
G_CALLBACK (sysprof_visualizer_view_zoom_manager_notify_zoom),
self,
G_CONNECT_SWAPPED);
}
sp_visualizer_list_set_zoom_manager (priv->list, zoom_manager);
sysprof_visualizer_list_set_zoom_manager (priv->list, zoom_manager);
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ZOOM_MANAGER]);
@ -740,19 +740,19 @@ sp_visualizer_view_set_zoom_manager (SpVisualizerView *self,
}
/**
* sp_visualizer_view_get_selection:
* sysprof_visualizer_view_get_selection:
*
* Gets the #SpSelection instance for the visualizer view.
* Gets the #SysprofSelection instance for the visualizer view.
* This can be used to alter the selection or selections of the visualizers.
*
* Returns: (transfer none): An #SpSelection.
* Returns: (transfer none): An #SysprofSelection.
*/
SpSelection *
sp_visualizer_view_get_selection (SpVisualizerView *self)
SysprofSelection *
sysprof_visualizer_view_get_selection (SysprofVisualizerView *self)
{
SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
g_return_val_if_fail (SP_IS_VISUALIZER_VIEW (self), NULL);
g_return_val_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self), NULL);
return priv->selection;
}

View File

@ -1,4 +1,4 @@
/* sp-visualizer-view.h
/* sysprof-visualizer-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -23,26 +23,26 @@
#include <gtk/gtk.h>
#include <sysprof.h>
#include "sp-visualizer-row.h"
#include "sp-selection.h"
#include "sp-zoom-manager.h"
#include "sysprof-visualizer-row.h"
#include "sysprof-selection.h"
#include "sysprof-zoom-manager.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
#define SP_TYPE_VISUALIZER_VIEW (sp_visualizer_view_get_type())
#define SYSPROF_TYPE_VISUALIZER_VIEW (sysprof_visualizer_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SpVisualizerView, sp_visualizer_view, SP, VISUALIZER_VIEW, GtkBin)
G_DECLARE_DERIVABLE_TYPE (SysprofVisualizerView, sysprof_visualizer_view, SYSPROF, VISUALIZER_VIEW, GtkBin)
struct _SpVisualizerViewClass
struct _SysprofVisualizerViewClass
{
GtkBinClass parent_class;
void (*visualizer_added) (SpVisualizerView *self,
SpVisualizerRow *visualizer);
void (*visualizer_removed) (SpVisualizerView *self,
SpVisualizerRow *visualizer);
void (*visualizer_added) (SysprofVisualizerView *self,
SysprofVisualizerRow *visualizer);
void (*visualizer_removed) (SysprofVisualizerView *self,
SysprofVisualizerRow *visualizer);
gpointer _reserved1;
gpointer _reserved2;
@ -63,18 +63,18 @@ struct _SpVisualizerViewClass
};
SYSPROF_AVAILABLE_IN_ALL
GtkWidget *sp_visualizer_view_new (void);
GtkWidget *sysprof_visualizer_view_new (void);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureReader *sp_visualizer_view_get_reader (SpVisualizerView *self);
SysprofCaptureReader *sysprof_visualizer_view_get_reader (SysprofVisualizerView *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_visualizer_view_set_reader (SpVisualizerView *self,
SpCaptureReader *reader);
void sysprof_visualizer_view_set_reader (SysprofVisualizerView *self,
SysprofCaptureReader *reader);
SYSPROF_AVAILABLE_IN_ALL
SpZoomManager *sp_visualizer_view_get_zoom_manager (SpVisualizerView *self);
SysprofZoomManager *sysprof_visualizer_view_get_zoom_manager (SysprofVisualizerView *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_visualizer_view_set_zoom_manager (SpVisualizerView *self,
SpZoomManager *zoom_manager);
void sysprof_visualizer_view_set_zoom_manager (SysprofVisualizerView *self,
SysprofZoomManager *zoom_manager);
SYSPROF_AVAILABLE_IN_ALL
SpSelection *sp_visualizer_view_get_selection (SpVisualizerView *self);
SysprofSelection *sysprof_visualizer_view_get_selection (SysprofVisualizerView *self);
G_END_DECLS

View File

@ -1,4 +1,4 @@
/* sp-zoom-manager.c
/* sysprof-zoom-manager.c
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -18,16 +18,16 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sp-zoom-manager"
#define G_LOG_DOMAIN "sysprof-zoom-manager"
#include "config.h"
#include <glib/gi18n.h>
#include <gio/gio.h>
#include "sp-zoom-manager.h"
#include "sysprof-zoom-manager.h"
struct _SpZoomManager
struct _SysprofZoomManager
{
GObject parent_instance;
@ -50,7 +50,7 @@ enum {
static void action_group_iface_init (GActionGroupInterface *iface);
G_DEFINE_TYPE_EXTENDED (SpZoomManager, sp_zoom_manager, G_TYPE_OBJECT, 0,
G_DEFINE_TYPE_EXTENDED (SysprofZoomManager, sysprof_zoom_manager, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, action_group_iface_init))
static GParamSpec *properties [N_PROPS];
@ -77,63 +77,63 @@ static gdouble zoom_levels[] = {
};
static void
sp_zoom_manager_zoom_in_action (GSimpleAction *action,
sysprof_zoom_manager_zoom_in_action (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
SpZoomManager *self = user_data;
g_assert (SP_IS_ZOOM_MANAGER (self));
sp_zoom_manager_zoom_in (self);
SysprofZoomManager *self = user_data;
g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
sysprof_zoom_manager_zoom_in (self);
}
static void
sp_zoom_manager_zoom_out_action (GSimpleAction *action,
sysprof_zoom_manager_zoom_out_action (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
SpZoomManager *self = user_data;
g_assert (SP_IS_ZOOM_MANAGER (self));
sp_zoom_manager_zoom_out (self);
SysprofZoomManager *self = user_data;
g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
sysprof_zoom_manager_zoom_out (self);
}
static void
sp_zoom_manager_zoom_one_action (GSimpleAction *action,
sysprof_zoom_manager_zoom_one_action (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
SpZoomManager *self = user_data;
g_assert (SP_IS_ZOOM_MANAGER (self));
sp_zoom_manager_reset (self);
SysprofZoomManager *self = user_data;
g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
sysprof_zoom_manager_reset (self);
}
static void
sp_zoom_manager_get_property (GObject *object,
sysprof_zoom_manager_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpZoomManager *self = SP_ZOOM_MANAGER (object);
SysprofZoomManager *self = SYSPROF_ZOOM_MANAGER (object);
switch (prop_id)
{
case PROP_MIN_ZOOM:
g_value_set_double (value, sp_zoom_manager_get_min_zoom (self));
g_value_set_double (value, sysprof_zoom_manager_get_min_zoom (self));
break;
case PROP_MAX_ZOOM:
g_value_set_double (value, sp_zoom_manager_get_max_zoom (self));
g_value_set_double (value, sysprof_zoom_manager_get_max_zoom (self));
break;
case PROP_ZOOM:
g_value_set_double (value, sp_zoom_manager_get_zoom (self));
g_value_set_double (value, sysprof_zoom_manager_get_zoom (self));
break;
case PROP_CAN_ZOOM_IN:
g_value_set_boolean (value, sp_zoom_manager_get_can_zoom_in (self));
g_value_set_boolean (value, sysprof_zoom_manager_get_can_zoom_in (self));
break;
case PROP_CAN_ZOOM_OUT:
g_value_set_boolean (value, sp_zoom_manager_get_can_zoom_out (self));
g_value_set_boolean (value, sysprof_zoom_manager_get_can_zoom_out (self));
break;
default:
@ -142,25 +142,25 @@ sp_zoom_manager_get_property (GObject *object,
}
static void
sp_zoom_manager_set_property (GObject *object,
sysprof_zoom_manager_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SpZoomManager *self = SP_ZOOM_MANAGER (object);
SysprofZoomManager *self = SYSPROF_ZOOM_MANAGER (object);
switch (prop_id)
{
case PROP_MIN_ZOOM:
sp_zoom_manager_set_min_zoom (self, g_value_get_double (value));
sysprof_zoom_manager_set_min_zoom (self, g_value_get_double (value));
break;
case PROP_MAX_ZOOM:
sp_zoom_manager_set_max_zoom (self, g_value_get_double (value));
sysprof_zoom_manager_set_max_zoom (self, g_value_get_double (value));
break;
case PROP_ZOOM:
sp_zoom_manager_set_zoom (self, g_value_get_double (value));
sysprof_zoom_manager_set_zoom (self, g_value_get_double (value));
break;
default:
@ -169,12 +169,12 @@ sp_zoom_manager_set_property (GObject *object,
}
static void
sp_zoom_manager_class_init (SpZoomManagerClass *klass)
sysprof_zoom_manager_class_init (SysprofZoomManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = sp_zoom_manager_get_property;
object_class->set_property = sp_zoom_manager_set_property;
object_class->get_property = sysprof_zoom_manager_get_property;
object_class->set_property = sysprof_zoom_manager_set_property;
properties [PROP_CAN_ZOOM_IN] =
g_param_spec_boolean ("can-zoom-in",
@ -221,12 +221,12 @@ sp_zoom_manager_class_init (SpZoomManagerClass *klass)
}
static void
sp_zoom_manager_init (SpZoomManager *self)
sysprof_zoom_manager_init (SysprofZoomManager *self)
{
static const GActionEntry entries[] = {
{ "zoom-in", sp_zoom_manager_zoom_in_action },
{ "zoom-out", sp_zoom_manager_zoom_out_action },
{ "zoom-one", sp_zoom_manager_zoom_one_action },
{ "zoom-in", sysprof_zoom_manager_zoom_in_action },
{ "zoom-out", sysprof_zoom_manager_zoom_out_action },
{ "zoom-one", sysprof_zoom_manager_zoom_one_action },
};
GAction *action;
@ -247,49 +247,49 @@ sp_zoom_manager_init (SpZoomManager *self)
g_object_bind_property (self, "can-zoom-out", action, "enabled", G_BINDING_SYNC_CREATE);
}
SpZoomManager *
sp_zoom_manager_new (void)
SysprofZoomManager *
sysprof_zoom_manager_new (void)
{
return g_object_new (SP_TYPE_ZOOM_MANAGER, NULL);
return g_object_new (SYSPROF_TYPE_ZOOM_MANAGER, NULL);
}
gboolean
sp_zoom_manager_get_can_zoom_in (SpZoomManager *self)
sysprof_zoom_manager_get_can_zoom_in (SysprofZoomManager *self)
{
g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), FALSE);
g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), FALSE);
return self->max_zoom == 0.0 || self->zoom < self->max_zoom;
}
gboolean
sp_zoom_manager_get_can_zoom_out (SpZoomManager *self)
sysprof_zoom_manager_get_can_zoom_out (SysprofZoomManager *self)
{
g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), FALSE);
g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), FALSE);
return self->min_zoom == 0.0 || self->zoom > self->min_zoom;
}
gboolean
sp_zoom_manager_get_min_zoom (SpZoomManager *self)
sysprof_zoom_manager_get_min_zoom (SysprofZoomManager *self)
{
g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), FALSE);
g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), FALSE);
return self->min_zoom;
}
gboolean
sp_zoom_manager_get_max_zoom (SpZoomManager *self)
sysprof_zoom_manager_get_max_zoom (SysprofZoomManager *self)
{
g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), FALSE);
g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), FALSE);
return self->max_zoom;
}
void
sp_zoom_manager_set_min_zoom (SpZoomManager *self,
sysprof_zoom_manager_set_min_zoom (SysprofZoomManager *self,
gdouble min_zoom)
{
g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
if (min_zoom != self->min_zoom)
{
@ -300,10 +300,10 @@ sp_zoom_manager_set_min_zoom (SpZoomManager *self,
}
void
sp_zoom_manager_set_max_zoom (SpZoomManager *self,
sysprof_zoom_manager_set_max_zoom (SysprofZoomManager *self,
gdouble max_zoom)
{
g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
if (max_zoom != self->max_zoom)
{
@ -314,13 +314,13 @@ sp_zoom_manager_set_max_zoom (SpZoomManager *self,
}
void
sp_zoom_manager_zoom_in (SpZoomManager *self)
sysprof_zoom_manager_zoom_in (SysprofZoomManager *self)
{
gdouble zoom;
g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
if (!sp_zoom_manager_get_can_zoom_in (self))
if (!sysprof_zoom_manager_get_can_zoom_in (self))
return;
zoom = self->zoom;
@ -337,17 +337,17 @@ sp_zoom_manager_zoom_in (SpZoomManager *self)
if (zoom == self->zoom)
zoom *= 2;
sp_zoom_manager_set_zoom (self, zoom);
sysprof_zoom_manager_set_zoom (self, zoom);
}
void
sp_zoom_manager_zoom_out (SpZoomManager *self)
sysprof_zoom_manager_zoom_out (SysprofZoomManager *self)
{
gdouble zoom;
g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
if (!sp_zoom_manager_get_can_zoom_out (self))
if (!sysprof_zoom_manager_get_can_zoom_out (self))
return;
zoom = self->zoom;
@ -364,33 +364,33 @@ sp_zoom_manager_zoom_out (SpZoomManager *self)
if (zoom == self->zoom)
zoom /= 2.0;
sp_zoom_manager_set_zoom (self, zoom);
sysprof_zoom_manager_set_zoom (self, zoom);
}
void
sp_zoom_manager_reset (SpZoomManager *self)
sysprof_zoom_manager_reset (SysprofZoomManager *self)
{
g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
sp_zoom_manager_set_zoom (self, 1.0);
sysprof_zoom_manager_set_zoom (self, 1.0);
}
gdouble
sp_zoom_manager_get_zoom (SpZoomManager *self)
sysprof_zoom_manager_get_zoom (SysprofZoomManager *self)
{
g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), 0.0);
g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), 0.0);
return self->zoom;
}
void
sp_zoom_manager_set_zoom (SpZoomManager *self,
sysprof_zoom_manager_set_zoom (SysprofZoomManager *self,
gdouble zoom)
{
gdouble min_zoom;
gdouble max_zoom;
g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
min_zoom = (self->min_zoom == 0.0) ? -G_MAXDOUBLE : self->min_zoom;
max_zoom = (self->max_zoom == 0.0) ? G_MAXDOUBLE : self->max_zoom;
@ -410,17 +410,17 @@ sp_zoom_manager_set_zoom (SpZoomManager *self,
}
static gchar **
sp_zoom_manager_list_actions (GActionGroup *action_group)
sysprof_zoom_manager_list_actions (GActionGroup *action_group)
{
SpZoomManager *self = (SpZoomManager *)action_group;
SysprofZoomManager *self = (SysprofZoomManager *)action_group;
g_assert (SP_IS_ZOOM_MANAGER (self));
g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
return g_action_group_list_actions (G_ACTION_GROUP (self->actions));
}
static gboolean
sp_zoom_manager_query_action (GActionGroup *action_group,
sysprof_zoom_manager_query_action (GActionGroup *action_group,
const gchar *action_name,
gboolean *enabled,
const GVariantType **parameter_type,
@ -428,9 +428,9 @@ sp_zoom_manager_query_action (GActionGroup *action_group,
GVariant **state_hint,
GVariant **state)
{
SpZoomManager *self = (SpZoomManager *)action_group;
SysprofZoomManager *self = (SysprofZoomManager *)action_group;
g_assert (SP_IS_ZOOM_MANAGER (self));
g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
g_assert (action_name != NULL);
return g_action_group_query_action (G_ACTION_GROUP (self->actions),
@ -443,26 +443,26 @@ sp_zoom_manager_query_action (GActionGroup *action_group,
}
static void
sp_zoom_manager_change_action_state (GActionGroup *action_group,
sysprof_zoom_manager_change_action_state (GActionGroup *action_group,
const gchar *action_name,
GVariant *value)
{
SpZoomManager *self = (SpZoomManager *)action_group;
SysprofZoomManager *self = (SysprofZoomManager *)action_group;
g_assert (SP_IS_ZOOM_MANAGER (self));
g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
g_assert (action_name != NULL);
g_action_group_change_action_state (G_ACTION_GROUP (self->actions), action_name, value);
}
static void
sp_zoom_manager_activate_action (GActionGroup *action_group,
sysprof_zoom_manager_activate_action (GActionGroup *action_group,
const gchar *action_name,
GVariant *parameter)
{
SpZoomManager *self = (SpZoomManager *)action_group;
SysprofZoomManager *self = (SysprofZoomManager *)action_group;
g_assert (SP_IS_ZOOM_MANAGER (self));
g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
g_assert (action_name != NULL);
g_action_group_activate_action (G_ACTION_GROUP (self->actions), action_name, parameter);
@ -471,8 +471,8 @@ sp_zoom_manager_activate_action (GActionGroup *action_group,
static void
action_group_iface_init (GActionGroupInterface *iface)
{
iface->list_actions = sp_zoom_manager_list_actions;
iface->query_action = sp_zoom_manager_query_action;
iface->change_action_state = sp_zoom_manager_change_action_state;
iface->activate_action = sp_zoom_manager_activate_action;
iface->list_actions = sysprof_zoom_manager_list_actions;
iface->query_action = sysprof_zoom_manager_query_action;
iface->change_action_state = sysprof_zoom_manager_change_action_state;
iface->activate_action = sysprof_zoom_manager_activate_action;
}

View File

@ -1,4 +1,4 @@
/* sp-zoom-manager.h
/* sysprof-zoom-manager.h
*
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
*
@ -26,37 +26,37 @@
G_BEGIN_DECLS
#define SP_TYPE_ZOOM_MANAGER (sp_zoom_manager_get_type())
#define SYSPROF_TYPE_ZOOM_MANAGER (sysprof_zoom_manager_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (SpZoomManager, sp_zoom_manager, SP, ZOOM_MANAGER, GObject)
G_DECLARE_FINAL_TYPE (SysprofZoomManager, sysprof_zoom_manager, SYSPROF, ZOOM_MANAGER, GObject)
SYSPROF_AVAILABLE_IN_ALL
SpZoomManager *sp_zoom_manager_new (void);
SysprofZoomManager *sysprof_zoom_manager_new (void);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_zoom_manager_get_can_zoom_in (SpZoomManager *self);
gboolean sysprof_zoom_manager_get_can_zoom_in (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_zoom_manager_get_can_zoom_out (SpZoomManager *self);
gboolean sysprof_zoom_manager_get_can_zoom_out (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_zoom_manager_get_min_zoom (SpZoomManager *self);
gboolean sysprof_zoom_manager_get_min_zoom (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_zoom_manager_get_max_zoom (SpZoomManager *self);
gboolean sysprof_zoom_manager_get_max_zoom (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_zoom_manager_set_min_zoom (SpZoomManager *self,
void sysprof_zoom_manager_set_min_zoom (SysprofZoomManager *self,
gdouble min_zoom);
SYSPROF_AVAILABLE_IN_ALL
void sp_zoom_manager_set_max_zoom (SpZoomManager *self,
void sysprof_zoom_manager_set_max_zoom (SysprofZoomManager *self,
gdouble max_zoom);
SYSPROF_AVAILABLE_IN_ALL
void sp_zoom_manager_zoom_in (SpZoomManager *self);
void sysprof_zoom_manager_zoom_in (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_zoom_manager_zoom_out (SpZoomManager *self);
void sysprof_zoom_manager_zoom_out (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_zoom_manager_reset (SpZoomManager *self);
void sysprof_zoom_manager_reset (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
gdouble sp_zoom_manager_get_zoom (SpZoomManager *self);
gdouble sysprof_zoom_manager_get_zoom (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_zoom_manager_set_zoom (SpZoomManager *self,
void sysprof_zoom_manager_set_zoom (SysprofZoomManager *self,
gdouble zoom);
G_END_DECLS