diff --git a/src/sysprof/sysprof-section.c b/src/sysprof/sysprof-section.c
index cf0bcb12..52e93fc2 100644
--- a/src/sysprof/sysprof-section.c
+++ b/src/sysprof/sysprof-section.c
@@ -25,6 +25,7 @@
typedef struct
{
+ char *category;
char *title;
SysprofSession *session;
} SysprofSectionPrivate;
@@ -34,6 +35,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (SysprofSection, sysprof_section, GTK_TYPE_W
enum {
PROP_0,
PROP_SESSION,
+ PROP_CATEGORY,
PROP_TITLE,
N_PROPS
};
@@ -52,6 +54,7 @@ sysprof_section_dispose (GObject *object)
g_clear_object (&priv->session);
g_clear_pointer (&priv->title, g_free);
+ g_clear_pointer (&priv->category, g_free);
G_OBJECT_CLASS (sysprof_section_parent_class)->dispose (object);
}
@@ -70,6 +73,10 @@ sysprof_section_get_property (GObject *object,
g_value_set_object (value, sysprof_section_get_session (self));
break;
+ case PROP_CATEGORY:
+ g_value_set_string (value, sysprof_section_get_category (self));
+ break;
+
case PROP_TITLE:
g_value_set_string (value, sysprof_section_get_title (self));
break;
@@ -93,6 +100,10 @@ sysprof_section_set_property (GObject *object,
sysprof_section_set_session (self, g_value_get_object (value));
break;
+ case PROP_CATEGORY:
+ sysprof_section_set_category (self, g_value_get_string (value));
+ break;
+
case PROP_TITLE:
sysprof_section_set_title (self, g_value_get_string (value));
break;
@@ -122,6 +133,11 @@ sysprof_section_class_init (SysprofSectionClass *klass)
NULL,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
+ properties[PROP_CATEGORY] =
+ g_param_spec_string ("category", NULL, NULL,
+ NULL,
+ (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_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
@@ -176,3 +192,25 @@ sysprof_section_set_title (SysprofSection *self,
if (g_set_str (&priv->title, title))
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TITLE]);
}
+
+const char *
+sysprof_section_get_category (SysprofSection *self)
+{
+ SysprofSectionPrivate *priv = sysprof_section_get_instance_private (self);
+
+ g_return_val_if_fail (SYSPROF_IS_SECTION (self), NULL);
+
+ return priv->category;
+}
+
+void
+sysprof_section_set_category (SysprofSection *self,
+ const char *category)
+{
+ SysprofSectionPrivate *priv = sysprof_section_get_instance_private (self);
+
+ g_return_if_fail (SYSPROF_IS_SECTION (self));
+
+ if (g_set_str (&priv->category, category))
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CATEGORY]);
+}
diff --git a/src/sysprof/sysprof-section.h b/src/sysprof/sysprof-section.h
index ce2b81a3..3d7a23fc 100644
--- a/src/sysprof/sysprof-section.h
+++ b/src/sysprof/sysprof-section.h
@@ -35,11 +35,14 @@ struct _SysprofSectionClass
GtkWidgetClass parent_class;
};
-SysprofSession *sysprof_section_get_session (SysprofSection *self);
-void sysprof_section_set_session (SysprofSection *self,
- SysprofSession *session);
-const char *sysprof_section_get_title (SysprofSection *self);
-void sysprof_section_set_title (SysprofSection *self,
- const char *title);
+SysprofSession *sysprof_section_get_session (SysprofSection *self);
+void sysprof_section_set_session (SysprofSection *self,
+ SysprofSession *session);
+const char *sysprof_section_get_category (SysprofSection *self);
+void sysprof_section_set_category (SysprofSection *self,
+ const char *category);
+const char *sysprof_section_get_title (SysprofSection *self);
+void sysprof_section_set_title (SysprofSection *self,
+ const char *title);
G_END_DECLS
diff --git a/src/sysprof/sysprof-sidebar.c b/src/sysprof/sysprof-sidebar.c
index 50ca2d6f..87d94435 100644
--- a/src/sysprof/sysprof-sidebar.c
+++ b/src/sysprof/sysprof-sidebar.c
@@ -112,6 +112,24 @@ list_box_row_activated_cb (SysprofSidebar *self,
gtk_stack_set_visible_child (stack, GTK_WIDGET (section));
}
+static void
+sysprof_sidebar_header_func (GtkListBoxRow *row,
+ GtkListBoxRow *before_row,
+ gpointer user_data)
+{
+ SysprofSection *section;
+ SysprofSection *before_section;
+
+ if (before_row == NULL)
+ return;
+
+ if ((section = g_object_get_data (G_OBJECT (row), "SECTION")) &&
+ (before_section = g_object_get_data (G_OBJECT (before_row), "SECTION")) &&
+ g_strcmp0 (sysprof_section_get_category (section),
+ sysprof_section_get_category (before_section)) != 0)
+ gtk_list_box_row_set_header (row, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
+}
+
static void
sysprof_sidebar_dispose (GObject *object)
{
@@ -203,4 +221,8 @@ sysprof_sidebar_init (SysprofSidebar *self)
G_CONNECT_SWAPPED);
gtk_widget_init_template (GTK_WIDGET (self));
+
+ gtk_list_box_set_header_func (self->list_box,
+ sysprof_sidebar_header_func,
+ NULL, NULL);
}
diff --git a/src/sysprof/sysprof-window.ui b/src/sysprof/sysprof-window.ui
index d656adb9..72416072 100644
--- a/src/sysprof/sysprof-window.ui
+++ b/src/sysprof/sysprof-window.ui
@@ -99,6 +99,7 @@
true