mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-gtk: map in the mark chart item
This gets the auto-filtering into account, but we still need to get the drawing of time ranges to use the proper timespan.
This commit is contained in:
@ -34,6 +34,7 @@ enum {
|
||||
PROP_0,
|
||||
PROP_SESSION,
|
||||
PROP_CATALOG,
|
||||
PROP_MARKS,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
@ -77,6 +78,10 @@ sysprof_mark_chart_item_get_property (GObject *object,
|
||||
g_value_set_object (value, sysprof_mark_chart_item_get_catalog (self));
|
||||
break;
|
||||
|
||||
case PROP_MARKS:
|
||||
g_value_set_object (value, sysprof_mark_chart_item_get_marks (self));
|
||||
break;
|
||||
|
||||
case PROP_SESSION:
|
||||
g_value_set_object (value, sysprof_mark_chart_item_get_session (self));
|
||||
break;
|
||||
@ -124,6 +129,11 @@ sysprof_mark_chart_item_class_init (SysprofMarkChartItemClass *klass)
|
||||
SYSPROF_TYPE_MARK_CATALOG,
|
||||
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
properties[PROP_MARKS] =
|
||||
g_param_spec_object ("marks", NULL, NULL,
|
||||
G_TYPE_LIST_MODEL,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
properties[PROP_SESSION] =
|
||||
g_param_spec_object ("session", NULL, NULL,
|
||||
SYSPROF_TYPE_SESSION,
|
||||
@ -138,8 +148,8 @@ sysprof_mark_chart_item_init (SysprofMarkChartItem *self)
|
||||
}
|
||||
|
||||
SysprofMarkChartItem *
|
||||
_sysprof_mark_chart_item_new (SysprofSession *session,
|
||||
SysprofMarkCatalog *catalog)
|
||||
sysprof_mark_chart_item_new (SysprofSession *session,
|
||||
SysprofMarkCatalog *catalog)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_SESSION (session), NULL);
|
||||
g_return_val_if_fail (SYSPROF_IS_MARK_CATALOG (catalog), NULL);
|
||||
@ -157,3 +167,15 @@ sysprof_mark_chart_item_get_marks (SysprofMarkChartItem *self)
|
||||
|
||||
return G_LIST_MODEL (self->filtered);
|
||||
}
|
||||
|
||||
SysprofMarkCatalog *
|
||||
sysprof_mark_chart_item_get_catalog (SysprofMarkChartItem *self)
|
||||
{
|
||||
return self->catalog;
|
||||
}
|
||||
|
||||
SysprofSession *
|
||||
sysprof_mark_chart_item_get_session (SysprofMarkChartItem *self)
|
||||
{
|
||||
return self->session;
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "sysprof-css-private.h"
|
||||
#include "sysprof-mark-chart.h"
|
||||
#include "sysprof-mark-chart-item-private.h"
|
||||
#include "sysprof-mark-chart-row-private.h"
|
||||
|
||||
#include "libsysprof-gtk-resources.h"
|
||||
@ -46,6 +47,15 @@ G_DEFINE_FINAL_TYPE (SysprofMarkChart, sysprof_mark_chart, GTK_TYPE_WIDGET)
|
||||
|
||||
static GParamSpec *properties [N_PROPS];
|
||||
|
||||
static gpointer
|
||||
map_func (gpointer item,
|
||||
gpointer user_data)
|
||||
{
|
||||
gpointer ret = sysprof_mark_chart_item_new (SYSPROF_SESSION (user_data), SYSPROF_MARK_CATALOG (item));
|
||||
g_object_unref (item);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_mark_chart_disconnect (SysprofMarkChart *self)
|
||||
{
|
||||
@ -59,18 +69,20 @@ static void
|
||||
sysprof_mark_chart_connect (SysprofMarkChart *self)
|
||||
{
|
||||
g_autoptr(GtkSingleSelection) single = NULL;
|
||||
GtkFilterListModel *filtered;
|
||||
GtkFlattenListModel *flatten;
|
||||
SysprofDocument *document;
|
||||
GtkMapListModel *map;
|
||||
|
||||
g_assert (SYSPROF_IS_MARK_CHART (self));
|
||||
g_assert (SYSPROF_IS_SESSION (self->session));
|
||||
|
||||
document = sysprof_session_get_document (self->session);
|
||||
flatten = gtk_flatten_list_model_new (sysprof_document_catalog_marks (document));
|
||||
filtered = gtk_filter_list_model_new (G_LIST_MODEL (flatten), NULL);
|
||||
g_object_bind_property (self->session, "filter", filtered, "filter", G_BINDING_SYNC_CREATE);
|
||||
single = gtk_single_selection_new (G_LIST_MODEL (filtered));
|
||||
map = gtk_map_list_model_new (G_LIST_MODEL (flatten),
|
||||
map_func,
|
||||
g_object_ref (self->session),
|
||||
g_object_unref);
|
||||
single = gtk_single_selection_new (G_LIST_MODEL (map));
|
||||
|
||||
gtk_list_view_set_model (self->list_view, GTK_SELECTION_MODEL (single));
|
||||
}
|
||||
|
||||
@ -23,7 +23,9 @@
|
||||
<property name="xalign">0</property>
|
||||
<binding name="text">
|
||||
<lookup name="group" type="SysprofMarkCatalog">
|
||||
<lookup name="item">GtkListHeader</lookup>
|
||||
<lookup name="catalog" type="SysprofMarkChartItem">
|
||||
<lookup name="item">GtkListHeader</lookup>
|
||||
</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
@ -50,7 +52,9 @@
|
||||
<property name="text-overflow">clip</property>
|
||||
<binding name="text">
|
||||
<lookup name="name" type="SysprofMarkCatalog">
|
||||
<lookup name="item">GtkListItem</lookup>
|
||||
<lookup name="catalog" type="SysprofMarkChartItem">
|
||||
<lookup name="item">GtkListItem</lookup>
|
||||
</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
@ -59,7 +63,9 @@
|
||||
<object class="SysprofMarkChartRow">
|
||||
<property name="hexpand">true</property>
|
||||
<binding name="model">
|
||||
<lookup name="item">GtkListItem</lookup>
|
||||
<lookup name="marks" type="SysprofMarkChartItem">
|
||||
<lookup name="item">GtkListItem</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
Reference in New Issue
Block a user