diff --git a/src/app/browser/window/tab/item/page/content.rs b/src/app/browser/window/tab/item/page/content.rs index 86562a5b..b232210a 100644 --- a/src/app/browser/window/tab/item/page/content.rs +++ b/src/app/browser/window/tab/item/page/content.rs @@ -127,14 +127,14 @@ impl Content { base, (self.window_action.clone(), self.tab_action.clone()), ); - self.g_box.append(&text.scrolled_window); + self.g_box.append(&text.g_box); text } pub fn to_text_source(&self, data: &str) -> Text { self.clean(); let text = Text::new_source(data); - self.g_box.append(&text.scrolled_window); + self.g_box.append(&text.g_box); text } diff --git a/src/app/browser/window/tab/item/page/content/text.rs b/src/app/browser/window/tab/item/page/content/text.rs index 2fc1b450..3c0d2348 100644 --- a/src/app/browser/window/tab/item/page/content/text.rs +++ b/src/app/browser/window/tab/item/page/content/text.rs @@ -5,7 +5,7 @@ use gemini::Gemini; use source::Source; use crate::app::browser::window::{tab::item::Action as TabAction, Action as WindowAction}; -use gtk::{glib::Uri, ScrolledWindow}; +use gtk::{glib::Uri, prelude::BoxExt, Box, Orientation, ScrolledWindow}; use std::rc::Rc; pub struct Meta { @@ -14,7 +14,7 @@ pub struct Meta { pub struct Text { pub meta: Meta, - pub scrolled_window: ScrolledWindow, + pub g_box: Box, } impl Text { @@ -25,32 +25,37 @@ impl Text { base: &Uri, actions: (Rc, Rc), ) -> Self { - // Init widget driver + // Init components let gemini = Gemini::new(gemtext, base, actions); - // Init scrolled container - let scrolled_window = ScrolledWindow::builder().build(); + // Init main widget + let g_box = Box::builder().orientation(Orientation::Vertical).build(); + g_box.append( + &ScrolledWindow::builder() + .child(&gemini.widget.clamp_scrollable) + .build(), + ); - scrolled_window.set_child(Some(&gemini.widget.clamp_scrollable)); - - // Result Self { meta: Meta { title: gemini.reader.title.clone(), }, - scrolled_window, + g_box, } } pub fn new_source(data: &str) -> Self { - // Init scrolled container - let scrolled_window = ScrolledWindow::builder().build(); - scrolled_window.set_child(Some(&Source::new(data).text_view)); + let g_box = Box::builder().orientation(Orientation::Vertical).build(); + + g_box.append( + &ScrolledWindow::builder() + .child(&Source::new(data).text_view) + .build(), + ); - // Result Self { meta: Meta { title: None }, - scrolled_window, + g_box, } } }