diff --git a/src/libsysprof-gtk/sysprof-mark-chart-item.c b/src/libsysprof-gtk/sysprof-mark-chart-item.c index e28b8703..92795f3d 100644 --- a/src/libsysprof-gtk/sysprof-mark-chart-item.c +++ b/src/libsysprof-gtk/sysprof-mark-chart-item.c @@ -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; +} diff --git a/src/libsysprof-gtk/sysprof-mark-chart.c b/src/libsysprof-gtk/sysprof-mark-chart.c index 9fef9c1c..ef6808a7 100644 --- a/src/libsysprof-gtk/sysprof-mark-chart.c +++ b/src/libsysprof-gtk/sysprof-mark-chart.c @@ -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)); } diff --git a/src/libsysprof-gtk/sysprof-mark-chart.ui b/src/libsysprof-gtk/sysprof-mark-chart.ui index a00d0a22..0970ddf8 100644 --- a/src/libsysprof-gtk/sysprof-mark-chart.ui +++ b/src/libsysprof-gtk/sysprof-mark-chart.ui @@ -23,7 +23,9 @@ 0 - GtkListHeader + + GtkListHeader + @@ -50,7 +52,9 @@ clip - GtkListItem + + GtkListItem + @@ -59,7 +63,9 @@ true - GtkListItem + + GtkListItem +