@@ -55,7 +55,38 @@ impl SimpleComponent for AppearanceModel {
5555
5656 view ! {
5757 #[ root]
58- adw:: ToolbarView {
58+ adw:: BreakpointBin {
59+ set_width_request: 346 ,
60+ set_height_request: 200 ,
61+
62+ add_breakpoint = adw:: Breakpoint :: new(
63+ adw:: BreakpointCondition :: new_length(
64+ adw:: BreakpointConditionLengthType :: MaxWidth ,
65+ 420.0 ,
66+ adw:: LengthUnit :: Sp ,
67+ )
68+ ) {
69+ add_setters: & [
70+ (
71+ & accent_box,
72+ "spacing" ,
73+ & 6
74+ ) ,
75+ (
76+ & accent_box,
77+ "margin-top" ,
78+ & 6
79+ ) ,
80+ (
81+ & accent_box,
82+ "margin-bottom" ,
83+ & 6
84+ ) ,
85+ ]
86+ } ,
87+
88+ #[ wrap( Some ) ]
89+ set_child = & adw:: ToolbarView {
5990 set_top_bar_style: adw:: ToolbarStyle :: Flat ,
6091
6192 add_top_bar = & adw:: HeaderBar {
@@ -64,28 +95,33 @@ impl SimpleComponent for AppearanceModel {
6495 set_title: "Appearance" ,
6596 }
6697 } ,
67- adw:: PreferencesPage {
98+ adw:: ToastOverlay {
99+ adw:: PreferencesPage {
68100 adw:: PreferencesGroup {
69101 set_title: "Style" ,
70102
71- adw:: ActionRow {
72- add_suffix = & gtk:: Box {
73- set_orientation: gtk:: Orientation :: Horizontal ,
74- set_spacing: 24 ,
75- set_homogeneous: true ,
76-
77- set_margin_top: 18 ,
78- set_margin_bottom: 18 ,
79- set_margin_start: 86 ,
80- set_margin_end: 86 ,
81-
82- append = & gtk:: Box {
83- set_orientation: gtk:: Orientation :: Vertical ,
84- set_spacing: 18 ,
85-
86- #[ name = "left" ]
87- append = & gtk:: ToggleButton {
88- set_group: Some ( & right) ,
103+ adw:: PreferencesRow {
104+ #[ wrap( Some ) ]
105+ set_child = & adw:: Clamp {
106+ set_maximum_size: 400 ,
107+ set_tightening_threshold: 300 ,
108+
109+ gtk:: Grid {
110+ set_focusable: false ,
111+ set_orientation: gtk:: Orientation :: Horizontal ,
112+ set_column_spacing: 24 ,
113+ set_row_spacing: 12 ,
114+ set_column_homogeneous: true ,
115+ set_hexpand: true ,
116+
117+ set_margin_top: 18 ,
118+ set_margin_bottom: 12 ,
119+ set_margin_start: 12 ,
120+ set_margin_end: 12 ,
121+
122+ #[ name = "default_style" ]
123+ attach[ 0 , 0 , 1 , 1 ] = & gtk:: ToggleButton {
124+ set_group: Some ( & dark_style) ,
89125 set_overflow: gtk:: Overflow :: Hidden ,
90126 add_css_class: "style-toggle" ,
91127
@@ -99,20 +135,15 @@ impl SimpleComponent for AppearanceModel {
99135 connect_clicked => AppearanceMsg :: SetStyle ( AppearanceStyle :: Default ) ,
100136 } ,
101137
102- append = & gtk:: Label {
103- set_label: "Default" ,
104- set_halign: gtk:: Align :: Center ,
105- set_hexpand: true ,
138+ attach [ 0 , 1 , 1 , 1 ] = & gtk:: Label {
139+ set_label: "Default" ,
140+ set_halign: gtk:: Align :: Center ,
141+ set_hexpand: true ,
106142 } ,
107- } ,
108-
109- append = & gtk:: Box {
110- set_orientation: gtk:: Orientation :: Vertical ,
111- set_spacing: 18 ,
112143
113- #[ name = "right " ]
144+ #[ name = "dark_style " ]
114145 // #[wrap(Some)]
115- append = & gtk:: ToggleButton {
146+ attach [ 1 , 0 , 1 , 1 ] = & gtk:: ToggleButton {
116147 add_css_class: "style-toggle" ,
117148 set_overflow: gtk:: Overflow :: Hidden ,
118149
@@ -126,7 +157,7 @@ impl SimpleComponent for AppearanceModel {
126157 connect_clicked => AppearanceMsg :: SetStyle ( AppearanceStyle :: Dark ) ,
127158 } ,
128159
129- append = & gtk:: Label {
160+ attach [ 1 , 1 , 1 , 1 ] = & gtk:: Label {
130161 set_label: "Dark" ,
131162 set_halign: gtk:: Align :: Center ,
132163 } ,
@@ -139,14 +170,15 @@ impl SimpleComponent for AppearanceModel {
139170 set_title: "Accent Color" ,
140171
141172 adw:: ActionRow {
173+ set_halign: gtk:: Align :: Center ,
174+ set_hexpand: true ,
175+
176+ #[ name = "accent_box" ]
142177 add_suffix = & gtk:: Box {
143178 set_orientation: gtk:: Orientation :: Horizontal ,
144- set_spacing: 24 ,
145- set_margin_top: 18 ,
146- set_margin_bottom: 18 ,
147- set_margin_start: 86 ,
148- set_margin_end: 86 ,
149-
179+ set_spacing: 12 ,
180+ set_margin_top: 12 ,
181+ set_margin_bottom: 12 ,
150182
151183 #[ name = "accent_color" ]
152184 gtk:: ToggleButton {
@@ -244,6 +276,8 @@ impl SimpleComponent for AppearanceModel {
244276 } ,
245277 } ,
246278
279+ }
280+ }
247281 }
248282 }
249283 }
0 commit comments