remove ugly gnome's ScrolledWindow + TextView integration

This commit is contained in:
yggverse 2025-11-15 19:54:22 +02:00
parent ffb1474c7e
commit 4a94cd4161
3 changed files with 5 additions and 17 deletions

View file

@ -61,13 +61,7 @@ impl Input {
title: Option<&str>, title: Option<&str>,
size_limit: Option<usize>, size_limit: Option<usize>,
) { ) {
self.update(Some(&gtk::Box::response( self.update(Some(&gtk::Box::response(action, base, title, size_limit)));
action,
base,
title,
size_limit,
MAX_CONTENT_HEIGHT,
)));
} }
pub fn set_new_sensitive( pub fn set_new_sensitive(

View file

@ -23,7 +23,6 @@ pub trait Response {
base: Uri, base: Uri,
title: Option<&str>, title: Option<&str>,
size_limit: Option<usize>, size_limit: Option<usize>,
max_content_height: i32,
) -> Self; ) -> Self;
} }
@ -36,7 +35,6 @@ impl Response for Box {
base: Uri, base: Uri,
title: Option<&str>, title: Option<&str>,
size_limit: Option<usize>, size_limit: Option<usize>,
max_content_height: i32,
) -> Self { ) -> Self {
// Init components // Init components
let control = Rc::new(Control::build()); let control = Rc::new(Control::build());
@ -49,18 +47,12 @@ impl Response for Box {
.margin_end(MARGIN) .margin_end(MARGIN)
.margin_start(MARGIN) .margin_start(MARGIN)
.margin_top(MARGIN) .margin_top(MARGIN)
.spacing(SPACING)
.orientation(Orientation::Vertical) .orientation(Orientation::Vertical)
.spacing(SPACING)
.build(); .build();
g_box.append(&title); g_box.append(&title);
g_box.append( g_box.append(&text_view);
&gtk::ScrolledWindow::builder()
.child(&text_view)
.max_content_height(max_content_height)
.propagate_natural_height(true)
.build(),
);
g_box.append(&control.g_box); g_box.append(&control.g_box);
// Init events // Init events

View file

@ -36,6 +36,7 @@ impl Form for TextView {
.css_classes(["frame", "view"]) .css_classes(["frame", "view"])
.extra_menu(&adapter.menu_model()) .extra_menu(&adapter.menu_model())
.left_margin(MARGIN) .left_margin(MARGIN)
.margin_bottom(MARGIN / 4)
.right_margin(MARGIN) .right_margin(MARGIN)
.top_margin(MARGIN) .top_margin(MARGIN)
.valign(gtk::Align::BaselineCenter) .valign(gtk::Align::BaselineCenter)
@ -43,6 +44,7 @@ impl Form for TextView {
.build(); .build();
text_view.insert_action_group("spelling", Some(&adapter)); text_view.insert_action_group("spelling", Some(&adapter));
text_view.set_size_request(-1, 36); // @TODO [#635](https://gitlab.gnome.org/GNOME/pygobject/-/issues/635)
// Init events // Init events
text_view.connect_realize(|this| { text_view.connect_realize(|this| {