@@ -66,9 +66,8 @@ public class Layouts.HeaderItem : Adw.Bin {
6666 private Gtk . Label name_label;
6767 private Gtk . Label placeholder_label;
6868 private Gtk . ListBox listbox;
69- private Gtk . Grid content_grid;
69+ private Adw . Bin content_grid;
7070 private Gtk . Box action_box;
71- private Gtk . Revealer action_revealer;
7271 private Gtk . Revealer content_revealer;
7372 private Gtk . Revealer separator_revealer;
7473 public signal void add_activated ();
@@ -92,18 +91,6 @@ public class Layouts.HeaderItem : Adw.Bin {
9291 }
9392 }
9493
95- public bool card {
96- set {
97- if (value ) {
98- content_grid. add_css_class (" card" );
99- content_grid. add_css_class (" sidebar-card" );
100- } else {
101- content_grid. remove_css_class (" card" );
102- content_grid. remove_css_class (" sidebar-card" );
103- }
104- }
105- }
106-
10794 public bool separator_space {
10895 set {
10996 if (value ) {
@@ -120,17 +107,27 @@ public class Layouts.HeaderItem : Adw.Bin {
120107 }
121108 }
122109
123- public bool box_shadow {
110+ public bool listbox_no_margin {
124111 set {
125112 if (value ) {
126- content_grid. remove_css_class (" sidebar-card" );
113+ listbox. margin_top = 0 ;
114+ listbox. margin_bottom = 0 ;
115+ listbox. margin_start = 0 ;
116+ listbox. margin_end = 0 ;
127117 }
128118 }
129119 }
130120
131- public bool listbox_no_margin {
121+ public bool card {
132122 set {
133123 if (value ) {
124+ listbox. css_classes = { " boxed-list" };
125+ listbox. margin_top = 3 ;
126+ listbox. margin_bottom = 3 ;
127+ listbox. margin_start = 3 ;
128+ listbox. margin_end = 3 ;
129+ } else {
130+ listbox. css_classes = { };
134131 listbox. margin_top = 0 ;
135132 listbox. margin_bottom = 0 ;
136133 listbox. margin_start = 0 ;
@@ -154,33 +151,25 @@ public class Layouts.HeaderItem : Adw.Bin {
154151 name_label. add_css_class (Granite . STYLE_CLASS_SMALL_LABEL );
155152
156153 listbox = new Gtk .ListBox () {
157- hexpand = true ,
158- margin_top = 3 ,
159- margin_start = 3 ,
160- margin_end = 3 ,
161- margin_bottom = 3
154+ hexpand = true
162155 };
163156
164157 listbox. set_placeholder (get_placeholder ());
165158 listbox. add_css_class (" bg-transparent" );
166159
167- content_grid = new Gtk . Grid () {
168- margin_end = 3
160+ content_grid = new Adw . Bin () {
161+ child = listbox
169162 };
170163
171- content_grid. add_css_class (" card" );
172- content_grid. add_css_class (" sidebar-card" );
173- content_grid. attach (listbox, 0 , 0 , 1 , 1 );
174-
175- action_box = new Gtk .Box (Gtk . Orientation . HORIZONTAL , 0 ) {
164+ action_box = new Gtk .Box (Gtk . Orientation . HORIZONTAL , 6 ) {
176165 hexpand = true ,
177166 halign = END
178167 };
179168
180169 var header_box = new Gtk .Box (Gtk . Orientation . HORIZONTAL , 0 ) {
181170 hexpand = true ,
182171 margin_start = 6 ,
183- margin_end = 3
172+ margin_end = 6
184173 };
185174
186175 header_box. append (name_label);
@@ -199,9 +188,7 @@ public class Layouts.HeaderItem : Adw.Bin {
199188
200189 var content_box = new Gtk .Box (Gtk . Orientation . VERTICAL , 0 ) {
201190 hexpand = true ,
202- margin_start = 3 ,
203- margin_top = 3 ,
204- margin_bottom = 3
191+ margin_top = 3
205192 };
206193
207194 content_box. append (header_box);
0 commit comments