Skip to content

Commit d4953af

Browse files
committed
Use scrolled window for source view
1 parent 6d3c3ad commit d4953af

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

src/widgets/window.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ impl NotifyWindow {
262262
let message = imp.entry.text();
263263
relm4_macros::view! {
264264
window = adw::Window {
265+
set_default_height: 400,
265266
set_modal: true,
266267
set_transient_for: Some(self),
267268
#[wrap(Some)]
@@ -293,28 +294,32 @@ impl NotifyWindow {
293294
set_xalign: 0.0,
294295
set_halign: gtk::Align::Start,
295296
},
296-
append: text_view = &gsv::View {
297-
add_css_class: "code",
298-
set_tab_width: 4,
299-
set_indent_width: 2,
300-
set_auto_indent: true,
301-
set_top_margin: 4,
302-
set_bottom_margin: 4,
303-
set_left_margin: 4,
304-
set_right_margin: 4,
305-
set_hexpand: true,
306-
set_vexpand: true,
307-
set_monospace: true,
308-
set_background_pattern: gsv::BackgroundPatternType::Grid
297+
append = &gtk::ScrolledWindow {
298+
#[wrap(Some)]
299+
set_child: text_view = &gsv::View {
300+
add_css_class: "code",
301+
set_tab_width: 4,
302+
set_indent_width: 2,
303+
set_auto_indent: true,
304+
set_top_margin: 4,
305+
set_bottom_margin: 4,
306+
set_left_margin: 4,
307+
set_right_margin: 4,
308+
set_hexpand: true,
309+
set_vexpand: true,
310+
set_monospace: true,
311+
set_background_pattern: gsv::BackgroundPatternType::Grid
312+
},
309313
},
310314
append = &gtk::Label {
311315
add_css_class: "heading",
312316
set_label: "Snippets",
313317
set_xalign: 0.0,
314318
set_halign: gtk::Align::Start,
315319
},
316-
append = &gtk::Box {
317-
set_spacing: 4,
320+
append = &gtk::FlowBox {
321+
set_column_spacing: 4,
322+
set_row_spacing: 4,
318323
append = &gtk::Button {
319324
add_css_class: "pill",
320325
add_css_class: "small",

0 commit comments

Comments
 (0)