[gnome-builder] libide/tweaks: include separator when section titles are used
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/tweaks: include separator when section titles are used
- Date: Wed, 17 Aug 2022 19:04:29 +0000 (UTC)
commit cd964d4cd896f978333c1f202cd8ab681d756f27
Author: Christian Hergert <chergert redhat com>
Date: Wed Aug 17 12:04:12 2022 -0700
libide/tweaks: include separator when section titles are used
src/libide/tweaks/ide-tweaks-panel-list.c | 46 ++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 16 deletions(-)
---
diff --git a/src/libide/tweaks/ide-tweaks-panel-list.c b/src/libide/tweaks/ide-tweaks-panel-list.c
index 518759236..640a208ce 100644
--- a/src/libide/tweaks/ide-tweaks-panel-list.c
+++ b/src/libide/tweaks/ide-tweaks-panel-list.c
@@ -149,11 +149,13 @@ ide_tweaks_panel_list_header_func (IdeTweaksPanelListRow *row,
IdeTweaksPanelListRow *before,
gpointer user_data)
{
- GtkWidget *header = NULL;
IdeTweaksItem *before_item = NULL;
IdeTweaksItem *row_item;
IdeTweaksItem *before_section = NULL;
IdeTweaksItem *row_section = NULL;
+ GtkSeparator *separator = NULL;
+ GtkLabel *label = NULL;
+ GtkBox *box = NULL;
g_assert (!before || IDE_IS_TWEAKS_PANEL_LIST_ROW (before));
g_assert (IDE_IS_TWEAKS_PANEL_LIST_ROW (row));
@@ -179,27 +181,39 @@ ide_tweaks_panel_list_header_func (IdeTweaksPanelListRow *row,
if (show_header && title != NULL)
{
- header = g_object_new (GTK_TYPE_LABEL,
- "css-classes", IDE_STRV_INIT ("dim-label"),
- "margin-bottom", 6,
- "margin-top", 12,
- "margin-start", 18,
- "label", title,
- "xalign", .0f,
- NULL);
- goto finish;
+ label = g_object_new (GTK_TYPE_LABEL,
+ "css-classes", IDE_STRV_INIT ("dim-label", "heading"),
+ "label", title,
+ "margin-bottom", 6,
+ "margin-start", 18,
+ "margin-top", 12,
+ "xalign", .0f,
+ NULL);
}
}
if (before_section != NULL)
- {
- header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- goto finish;
- }
+ separator = g_object_new (GTK_TYPE_SEPARATOR,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ NULL);
}
-finish:
- gtk_list_box_row_set_header (GTK_LIST_BOX_ROW (row), header);
+ if (label == NULL)
+ {
+ gtk_list_box_row_set_header (GTK_LIST_BOX_ROW (row), GTK_WIDGET (separator));
+ return;
+ }
+
+ g_assert (label != NULL);
+
+ box = g_object_new (GTK_TYPE_BOX,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ NULL);
+ if (separator != NULL)
+ gtk_box_append (box, GTK_WIDGET (separator));
+ gtk_box_append (box, GTK_WIDGET (label));
+
+ gtk_list_box_row_set_header (GTK_LIST_BOX_ROW (row), GTK_WIDGET (box));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]