2014-10-10 03:34:59 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "statistics.h"
|
|
|
|
|
2014-10-14 10:59:18 +00:00
|
|
|
#include "graphdata.h"
|
2018-02-09 00:06:59 +00:00
|
|
|
|
2014-10-10 03:34:59 +00:00
|
|
|
#include "gtkcelllayout.h"
|
2018-02-09 00:06:59 +00:00
|
|
|
#include "gtkcellrenderertext.h"
|
2016-04-15 02:52:59 +00:00
|
|
|
#include "gtklabel.h"
|
2018-02-09 00:06:59 +00:00
|
|
|
#include "gtksearchbar.h"
|
|
|
|
#include "gtkstack.h"
|
|
|
|
#include "gtktogglebutton.h"
|
|
|
|
#include "gtktreeselection.h"
|
|
|
|
#include "gtktreeview.h"
|
2018-02-04 08:29:44 +00:00
|
|
|
#include "gtkeventcontrollerkey.h"
|
|
|
|
#include "gtkmain.h"
|
2018-02-09 00:06:59 +00:00
|
|
|
|
|
|
|
#include <glib/gi18n-lib.h>
|
2014-10-10 03:34:59 +00:00
|
|
|
|
2014-11-08 04:19:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_BUTTON
|
|
|
|
};
|
|
|
|
|
2014-10-10 03:34:59 +00:00
|
|
|
struct _GtkInspectorStatisticsPrivate
|
|
|
|
{
|
|
|
|
GtkWidget *stack;
|
2016-04-15 02:52:59 +00:00
|
|
|
GtkWidget *excuse;
|
2014-10-10 03:34:59 +00:00
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeView *view;
|
|
|
|
GtkWidget *button;
|
2014-10-11 21:58:31 +00:00
|
|
|
GHashTable *data;
|
|
|
|
GtkTreeViewColumn *column_self1;
|
|
|
|
GtkCellRenderer *renderer_self1;
|
|
|
|
GtkTreeViewColumn *column_cumulative1;
|
|
|
|
GtkCellRenderer *renderer_cumulative1;
|
|
|
|
GtkTreeViewColumn *column_self2;
|
|
|
|
GtkCellRenderer *renderer_self2;
|
|
|
|
GtkTreeViewColumn *column_cumulative2;
|
|
|
|
GtkCellRenderer *renderer_cumulative2;
|
|
|
|
GHashTable *counts;
|
2014-10-14 12:01:42 +00:00
|
|
|
guint update_source_id;
|
2014-11-08 04:40:31 +00:00
|
|
|
GtkWidget *search_entry;
|
|
|
|
GtkWidget *search_bar;
|
2014-10-10 03:34:59 +00:00
|
|
|
};
|
|
|
|
|
2014-10-11 21:58:31 +00:00
|
|
|
typedef struct {
|
|
|
|
GType type;
|
2014-10-13 08:20:29 +00:00
|
|
|
GtkTreeIter treeiter;
|
2014-10-14 10:59:18 +00:00
|
|
|
GtkGraphData *self;
|
|
|
|
GtkGraphData *cumulative;
|
2014-10-11 21:58:31 +00:00
|
|
|
} TypeData;
|
|
|
|
|
2014-10-10 03:34:59 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
COLUMN_TYPE,
|
2014-10-13 04:01:51 +00:00
|
|
|
COLUMN_TYPE_NAME,
|
2014-10-11 21:58:31 +00:00
|
|
|
COLUMN_SELF1,
|
|
|
|
COLUMN_CUMULATIVE1,
|
|
|
|
COLUMN_SELF2,
|
2014-10-14 10:59:18 +00:00
|
|
|
COLUMN_CUMULATIVE2,
|
|
|
|
COLUMN_SELF_DATA,
|
|
|
|
COLUMN_CUMULATIVE_DATA
|
2014-10-10 03:34:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorStatistics, gtk_inspector_statistics, GTK_TYPE_BOX)
|
|
|
|
|
|
|
|
static gint
|
|
|
|
add_type_count (GtkInspectorStatistics *sl, GType type)
|
|
|
|
{
|
|
|
|
gint cumulative;
|
|
|
|
gint self;
|
|
|
|
GType *children;
|
|
|
|
guint n_children;
|
|
|
|
gint i;
|
2014-10-11 21:58:31 +00:00
|
|
|
TypeData *data;
|
2014-10-10 03:34:59 +00:00
|
|
|
|
|
|
|
cumulative = 0;
|
|
|
|
|
|
|
|
children = g_type_children (type, &n_children);
|
|
|
|
for (i = 0; i < n_children; i++)
|
|
|
|
cumulative += add_type_count (sl, children[i]);
|
|
|
|
|
2014-10-11 21:58:31 +00:00
|
|
|
data = g_hash_table_lookup (sl->priv->counts, GSIZE_TO_POINTER (type));
|
|
|
|
if (!data)
|
|
|
|
{
|
|
|
|
data = g_new0 (TypeData, 1);
|
|
|
|
data->type = type;
|
2014-10-14 10:59:18 +00:00
|
|
|
data->self = gtk_graph_data_new (60);
|
|
|
|
data->cumulative = gtk_graph_data_new (60);
|
2014-10-13 08:20:29 +00:00
|
|
|
gtk_list_store_append (GTK_LIST_STORE (sl->priv->model), &data->treeiter);
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (sl->priv->model), &data->treeiter,
|
|
|
|
COLUMN_TYPE, data->type,
|
|
|
|
COLUMN_TYPE_NAME, g_type_name (data->type),
|
2014-10-14 10:59:18 +00:00
|
|
|
COLUMN_SELF_DATA, data->self,
|
|
|
|
COLUMN_CUMULATIVE_DATA, data->cumulative,
|
2014-10-13 08:20:29 +00:00
|
|
|
-1);
|
2014-10-11 21:58:31 +00:00
|
|
|
g_hash_table_insert (sl->priv->counts, GSIZE_TO_POINTER (type), data);
|
|
|
|
}
|
|
|
|
|
2014-10-10 03:34:59 +00:00
|
|
|
self = g_type_get_instance_count (type);
|
|
|
|
cumulative += self;
|
2014-10-11 21:58:31 +00:00
|
|
|
|
2014-10-14 10:59:18 +00:00
|
|
|
gtk_graph_data_prepend_value (data->self, self);
|
|
|
|
gtk_graph_data_prepend_value (data->cumulative, cumulative);
|
2014-10-10 03:34:59 +00:00
|
|
|
|
2014-10-13 08:20:29 +00:00
|
|
|
gtk_list_store_set (GTK_LIST_STORE (sl->priv->model), &data->treeiter,
|
2014-10-14 10:59:18 +00:00
|
|
|
COLUMN_SELF1, (int) gtk_graph_data_get_value (data->self, 1),
|
|
|
|
COLUMN_CUMULATIVE1, (int) gtk_graph_data_get_value (data->cumulative, 1),
|
|
|
|
COLUMN_SELF2, (int) gtk_graph_data_get_value (data->self, 0),
|
|
|
|
COLUMN_CUMULATIVE2, (int) gtk_graph_data_get_value (data->cumulative, 0),
|
2014-10-13 08:20:29 +00:00
|
|
|
-1);
|
2014-10-10 03:34:59 +00:00
|
|
|
return cumulative;
|
|
|
|
}
|
|
|
|
|
2014-10-14 12:01:42 +00:00
|
|
|
static gboolean
|
|
|
|
update_type_counts (gpointer data)
|
2014-10-10 03:34:59 +00:00
|
|
|
{
|
2014-10-14 12:01:42 +00:00
|
|
|
GtkInspectorStatistics *sl = data;
|
2014-10-10 03:34:59 +00:00
|
|
|
GType type;
|
2014-10-13 03:30:33 +00:00
|
|
|
|
2014-10-13 04:09:35 +00:00
|
|
|
for (type = G_TYPE_INTERFACE; type <= G_TYPE_FUNDAMENTAL_MAX; type += (1 << G_TYPE_FUNDAMENTAL_SHIFT))
|
2014-10-13 03:30:33 +00:00
|
|
|
{
|
|
|
|
if (!G_TYPE_IS_INSTANTIATABLE (type))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
add_type_count (sl, type);
|
|
|
|
}
|
2014-10-14 12:01:42 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2014-10-13 03:30:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-11-08 04:19:28 +00:00
|
|
|
toggle_record (GtkToggleButton *button,
|
2014-10-14 12:01:42 +00:00
|
|
|
GtkInspectorStatistics *sl)
|
2014-10-13 03:30:33 +00:00
|
|
|
{
|
2014-11-08 04:19:28 +00:00
|
|
|
if (gtk_toggle_button_get_active (button) == (sl->priv->update_source_id != 0))
|
2014-10-14 12:01:42 +00:00
|
|
|
return;
|
|
|
|
|
2014-11-08 04:19:28 +00:00
|
|
|
if (gtk_toggle_button_get_active (button))
|
2014-10-14 12:01:42 +00:00
|
|
|
{
|
2018-02-02 14:51:47 +00:00
|
|
|
sl->priv->update_source_id = g_timeout_add_seconds (1, update_type_counts, sl);
|
2014-10-14 12:01:42 +00:00
|
|
|
update_type_counts (sl);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_source_remove (sl->priv->update_source_id);
|
|
|
|
sl->priv->update_source_id = 0;
|
|
|
|
}
|
2014-10-10 03:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
has_instance_counts (void)
|
2016-04-15 02:52:59 +00:00
|
|
|
{
|
|
|
|
return g_type_get_instance_count (GTK_TYPE_LABEL) > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
instance_counts_enabled (void)
|
2014-10-10 03:34:59 +00:00
|
|
|
{
|
|
|
|
const gchar *string;
|
|
|
|
guint flags = 0;
|
|
|
|
|
|
|
|
string = g_getenv ("GOBJECT_DEBUG");
|
|
|
|
if (string != NULL)
|
|
|
|
{
|
|
|
|
GDebugKey debug_keys[] = {
|
|
|
|
{ "objects", 1 },
|
|
|
|
{ "instance-count", 2 },
|
|
|
|
{ "signals", 4 }
|
|
|
|
};
|
|
|
|
|
|
|
|
flags = g_parse_debug_string (string, debug_keys, G_N_ELEMENTS (debug_keys));
|
|
|
|
}
|
|
|
|
|
|
|
|
return (flags & 2) != 0;
|
|
|
|
}
|
|
|
|
|
2014-10-11 21:58:31 +00:00
|
|
|
static void
|
|
|
|
cell_data_data (GtkCellLayout *layout,
|
|
|
|
GtkCellRenderer *cell,
|
|
|
|
GtkTreeModel *model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gint column;
|
|
|
|
gint count;
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
column = GPOINTER_TO_INT (data);
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, iter, column, &count, -1);
|
|
|
|
|
|
|
|
text = g_strdup_printf ("%d", count);
|
|
|
|
g_object_set (cell, "text", text, NULL);
|
|
|
|
g_free (text);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cell_data_delta (GtkCellLayout *layout,
|
|
|
|
GtkCellRenderer *cell,
|
|
|
|
GtkTreeModel *model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gint column;
|
|
|
|
gint count1;
|
|
|
|
gint count2;
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
column = GPOINTER_TO_INT (data);
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, iter, column - 2, &count1, column, &count2, -1);
|
|
|
|
|
|
|
|
if (count2 > count1)
|
|
|
|
text = g_strdup_printf ("%d (↗ %d)", count2, count2 - count1);
|
|
|
|
else if (count2 < count1)
|
|
|
|
text = g_strdup_printf ("%d (↘ %d)", count2, count1 - count2);
|
|
|
|
else
|
|
|
|
text = g_strdup_printf ("%d", count2);
|
|
|
|
g_object_set (cell, "text", text, NULL);
|
|
|
|
g_free (text);
|
|
|
|
}
|
|
|
|
|
2014-10-14 10:59:18 +00:00
|
|
|
static void
|
|
|
|
type_data_free (gpointer data)
|
|
|
|
{
|
|
|
|
TypeData *type_data = data;
|
|
|
|
|
|
|
|
g_object_unref (type_data->self);
|
|
|
|
g_object_unref (type_data->cumulative);
|
|
|
|
|
|
|
|
g_free (type_data);
|
|
|
|
}
|
|
|
|
|
2014-11-08 04:40:31 +00:00
|
|
|
static gboolean
|
2018-02-04 08:29:44 +00:00
|
|
|
key_pressed (GtkEventController *controller,
|
|
|
|
guint keyval,
|
|
|
|
guint keycode,
|
|
|
|
GdkModifierType state,
|
|
|
|
GtkInspectorStatistics *sl)
|
2014-11-08 04:40:31 +00:00
|
|
|
{
|
2018-02-04 08:29:44 +00:00
|
|
|
if (gtk_widget_get_mapped (GTK_WIDGET (sl)))
|
2014-11-08 04:40:31 +00:00
|
|
|
{
|
2017-08-25 14:57:26 +00:00
|
|
|
if (keyval == GDK_KEY_Return ||
|
|
|
|
keyval == GDK_KEY_ISO_Enter ||
|
|
|
|
keyval == GDK_KEY_KP_Enter)
|
2014-11-08 04:40:31 +00:00
|
|
|
{
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (sl->priv->view);
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
|
|
{
|
|
|
|
path = gtk_tree_model_get_path (model, &iter);
|
|
|
|
gtk_tree_view_row_activated (sl->priv->view, path, NULL);
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
|
|
return GDK_EVENT_STOP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-03-11 12:54:54 +00:00
|
|
|
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
2014-11-08 04:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
match_string (const gchar *string,
|
|
|
|
const gchar *text)
|
|
|
|
{
|
|
|
|
gchar *lower;
|
|
|
|
gboolean match = FALSE;
|
|
|
|
|
|
|
|
if (string)
|
|
|
|
{
|
|
|
|
lower = g_ascii_strdown (string, -1);
|
|
|
|
match = g_str_has_prefix (lower, text);
|
|
|
|
g_free (lower);
|
|
|
|
}
|
|
|
|
|
|
|
|
return match;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
match_row (GtkTreeModel *model,
|
|
|
|
gint column,
|
|
|
|
const gchar *key,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gchar *type;
|
|
|
|
gboolean match;
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, iter, column, &type, -1);
|
|
|
|
|
|
|
|
match = match_string (type, key);
|
|
|
|
|
|
|
|
g_free (type);
|
|
|
|
|
|
|
|
return !match;
|
|
|
|
}
|
|
|
|
|
2018-05-14 17:03:17 +00:00
|
|
|
static void
|
|
|
|
destroy_controller (GtkEventController *controller)
|
|
|
|
{
|
|
|
|
gtk_widget_remove_controller (gtk_event_controller_get_widget (controller), controller);
|
|
|
|
}
|
|
|
|
|
2014-11-08 04:40:31 +00:00
|
|
|
static void
|
2019-02-23 05:29:52 +00:00
|
|
|
root (GtkWidget *widget)
|
2014-11-08 04:40:31 +00:00
|
|
|
{
|
2018-03-11 12:54:54 +00:00
|
|
|
GtkInspectorStatistics *sl = GTK_INSPECTOR_STATISTICS (widget);
|
2018-02-04 08:29:44 +00:00
|
|
|
GtkEventController *controller;
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
2019-02-23 05:29:52 +00:00
|
|
|
GTK_WIDGET_CLASS (gtk_inspector_statistics_parent_class)->root (widget);
|
2018-02-04 08:29:44 +00:00
|
|
|
|
2019-05-20 04:47:50 +00:00
|
|
|
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
|
2018-05-05 07:06:22 +00:00
|
|
|
|
2018-04-20 17:58:06 +00:00
|
|
|
controller = gtk_event_controller_key_new ();
|
2018-05-14 17:03:17 +00:00
|
|
|
g_object_set_data_full (G_OBJECT (toplevel), "statistics-controller", controller, (GDestroyNotify)destroy_controller);
|
2018-02-04 08:29:44 +00:00
|
|
|
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), widget);
|
2018-04-20 17:58:06 +00:00
|
|
|
gtk_widget_add_controller (toplevel, controller);
|
2018-03-11 12:54:54 +00:00
|
|
|
|
2019-02-23 05:29:52 +00:00
|
|
|
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (sl->priv->search_bar), toplevel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
unroot (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
2019-05-20 04:47:50 +00:00
|
|
|
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
|
2019-02-23 05:29:52 +00:00
|
|
|
g_object_set_data (G_OBJECT (toplevel), "statistics-controller", NULL);
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_inspector_statistics_parent_class)->unroot (widget);
|
2014-11-08 04:40:31 +00:00
|
|
|
}
|
|
|
|
|
2014-10-10 03:34:59 +00:00
|
|
|
static void
|
|
|
|
gtk_inspector_statistics_init (GtkInspectorStatistics *sl)
|
|
|
|
{
|
|
|
|
sl->priv = gtk_inspector_statistics_get_instance_private (sl);
|
|
|
|
gtk_widget_init_template (GTK_WIDGET (sl));
|
2014-10-11 21:58:31 +00:00
|
|
|
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (sl->priv->column_self1),
|
|
|
|
sl->priv->renderer_self1,
|
|
|
|
cell_data_data,
|
|
|
|
GINT_TO_POINTER (COLUMN_SELF1), NULL);
|
|
|
|
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (sl->priv->column_cumulative1),
|
|
|
|
sl->priv->renderer_cumulative1,
|
|
|
|
cell_data_data,
|
|
|
|
GINT_TO_POINTER (COLUMN_CUMULATIVE1), NULL);
|
|
|
|
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (sl->priv->column_self2),
|
|
|
|
sl->priv->renderer_self2,
|
|
|
|
cell_data_delta,
|
|
|
|
GINT_TO_POINTER (COLUMN_SELF2), NULL);
|
|
|
|
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (sl->priv->column_cumulative2),
|
|
|
|
sl->priv->renderer_cumulative2,
|
|
|
|
cell_data_delta,
|
|
|
|
GINT_TO_POINTER (COLUMN_CUMULATIVE2), NULL);
|
2014-10-14 10:59:18 +00:00
|
|
|
sl->priv->counts = g_hash_table_new_full (NULL, NULL, NULL, type_data_free);
|
2014-10-11 21:58:31 +00:00
|
|
|
|
2019-02-17 04:58:54 +00:00
|
|
|
gtk_tree_view_set_search_entry (sl->priv->view, GTK_EDITABLE (sl->priv->search_entry));
|
2014-11-08 04:40:31 +00:00
|
|
|
gtk_tree_view_set_search_equal_func (sl->priv->view, match_row, sl, NULL);
|
2014-10-10 03:34:59 +00:00
|
|
|
}
|
|
|
|
|
2014-11-08 04:19:28 +00:00
|
|
|
static void
|
|
|
|
constructed (GObject *object)
|
|
|
|
{
|
|
|
|
GtkInspectorStatistics *sl = GTK_INSPECTOR_STATISTICS (object);
|
|
|
|
|
|
|
|
g_signal_connect (sl->priv->button, "toggled",
|
|
|
|
G_CALLBACK (toggle_record), sl);
|
|
|
|
|
|
|
|
if (has_instance_counts ())
|
|
|
|
update_type_counts (sl);
|
|
|
|
else
|
2014-11-08 14:57:48 +00:00
|
|
|
{
|
2016-04-15 02:52:59 +00:00
|
|
|
if (instance_counts_enabled ())
|
2019-12-21 18:25:57 +00:00
|
|
|
gtk_label_set_text (GTK_LABEL (sl->priv->excuse), _("GLib must be configured with -Dbuildtype=debug"));
|
2014-11-08 14:57:48 +00:00
|
|
|
gtk_stack_set_visible_child_name (GTK_STACK (sl->priv->stack), "excuse");
|
|
|
|
gtk_widget_set_sensitive (sl->priv->button, FALSE);
|
|
|
|
}
|
2014-11-08 04:19:28 +00:00
|
|
|
}
|
|
|
|
|
2014-10-11 21:58:31 +00:00
|
|
|
static void
|
|
|
|
finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkInspectorStatistics *sl = GTK_INSPECTOR_STATISTICS (object);
|
|
|
|
|
2014-10-14 12:01:42 +00:00
|
|
|
if (sl->priv->update_source_id)
|
|
|
|
g_source_remove (sl->priv->update_source_id);
|
|
|
|
|
2014-10-11 21:58:31 +00:00
|
|
|
g_hash_table_unref (sl->priv->counts);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_inspector_statistics_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2014-11-08 04:19:28 +00:00
|
|
|
static void
|
|
|
|
get_property (GObject *object,
|
|
|
|
guint param_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkInspectorStatistics *sl = GTK_INSPECTOR_STATISTICS (object);
|
|
|
|
|
|
|
|
switch (param_id)
|
|
|
|
{
|
|
|
|
case PROP_BUTTON:
|
|
|
|
g_value_take_object (value, sl->priv->button);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_property (GObject *object,
|
|
|
|
guint param_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkInspectorStatistics *sl = GTK_INSPECTOR_STATISTICS (object);
|
|
|
|
|
|
|
|
switch (param_id)
|
|
|
|
{
|
|
|
|
case PROP_BUTTON:
|
|
|
|
sl->priv->button = g_value_get_object (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-10 03:34:59 +00:00
|
|
|
static void
|
|
|
|
gtk_inspector_statistics_class_init (GtkInspectorStatisticsClass *klass)
|
|
|
|
{
|
2014-10-11 21:58:31 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2014-10-10 03:34:59 +00:00
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
|
|
|
2014-11-08 04:19:28 +00:00
|
|
|
object_class->get_property = get_property;
|
|
|
|
object_class->set_property = set_property;
|
|
|
|
object_class->constructed = constructed;
|
2014-10-11 21:58:31 +00:00
|
|
|
object_class->finalize = finalize;
|
|
|
|
|
2019-02-23 05:29:52 +00:00
|
|
|
widget_class->root = root;
|
|
|
|
widget_class->unroot = unroot;
|
|
|
|
|
2014-11-08 04:19:28 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_BUTTON,
|
|
|
|
g_param_spec_object ("button", NULL, NULL,
|
|
|
|
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
|
|
|
|
2014-11-30 20:59:53 +00:00
|
|
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/statistics.ui");
|
2014-10-10 03:34:59 +00:00
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, view);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, stack);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, model);
|
2014-10-11 21:58:31 +00:00
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, column_self1);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, renderer_self1);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, column_cumulative1);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, renderer_cumulative1);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, column_self2);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, renderer_self2);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, column_cumulative2);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, renderer_cumulative2);
|
2014-11-08 04:40:31 +00:00
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, search_entry);
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, search_bar);
|
2016-04-15 02:52:59 +00:00
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, excuse);
|
2014-11-08 04:40:31 +00:00
|
|
|
|
2014-10-10 03:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// vim: set et sw=2 ts=2:
|