mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-09-12 15:02:17 +00:00
wrap some locals in scope
This commit is contained in:
parent
7223ac9de4
commit
d34b8fe43a
@ -24,9 +24,6 @@ impl Text {
|
||||
base: &Uri,
|
||||
gemtext: &str,
|
||||
) -> Self {
|
||||
// Define some local dependencies
|
||||
use gtk::{prelude::WidgetExt, GestureClick};
|
||||
|
||||
// Init gemtext reader
|
||||
let gemini = Gemini::build(actions, base, gemtext).unwrap(); // @TODO handle
|
||||
|
||||
@ -38,16 +35,18 @@ impl Text {
|
||||
.build();
|
||||
|
||||
// Grab focus into the `TextView` on click empty `ClampScrollable` area
|
||||
let controller = GestureClick::new();
|
||||
{
|
||||
use gtk::{prelude::WidgetExt, GestureClick};
|
||||
let controller = GestureClick::new();
|
||||
|
||||
controller.connect_released({
|
||||
let text_view = gemini.text_view.clone();
|
||||
move |_, _, _, _| {
|
||||
text_view.grab_focus();
|
||||
}
|
||||
});
|
||||
|
||||
clamp_scrollable.add_controller(controller);
|
||||
controller.connect_released({
|
||||
let text_view = gemini.text_view.clone();
|
||||
move |_, _, _, _| {
|
||||
text_view.grab_focus();
|
||||
}
|
||||
});
|
||||
clamp_scrollable.add_controller(controller);
|
||||
}
|
||||
|
||||
Self {
|
||||
text_view: gemini.text_view,
|
||||
|
@ -83,18 +83,20 @@ impl Gemini {
|
||||
let buffer = TextBuffer::new(Some(&tag.text_tag_table));
|
||||
|
||||
// Init main widget
|
||||
const MARGIN: i32 = 8;
|
||||
let text_view = TextView::builder()
|
||||
.bottom_margin(MARGIN)
|
||||
.buffer(&buffer)
|
||||
.cursor_visible(false)
|
||||
.editable(false)
|
||||
.left_margin(MARGIN)
|
||||
.right_margin(MARGIN)
|
||||
.top_margin(MARGIN)
|
||||
.vexpand(true)
|
||||
.wrap_mode(WrapMode::Word)
|
||||
.build();
|
||||
let text_view = {
|
||||
const MARGIN: i32 = 8;
|
||||
TextView::builder()
|
||||
.bottom_margin(MARGIN)
|
||||
.buffer(&buffer)
|
||||
.cursor_visible(false)
|
||||
.editable(false)
|
||||
.left_margin(MARGIN)
|
||||
.right_margin(MARGIN)
|
||||
.top_margin(MARGIN)
|
||||
.vexpand(true)
|
||||
.wrap_mode(WrapMode::Word)
|
||||
.build()
|
||||
};
|
||||
|
||||
// Parse gemtext lines
|
||||
for line in gemtext.lines() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user