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