~admicos/moonlander-legacy

091f7804a62501c931cd4f55b1feaf924b24d23a — Ecmel Berk Canlier 5 months ago 2d76d03
Code Cleanup
M gemini/src/lib.rs => gemini/src/lib.rs +1 -1
@@ 29,7 29,7 @@ pub enum Message {
    Done,
}

pub fn get(url: &str, chunk_callback: impl Fn(Message) -> ()) -> Result<()> {
pub fn get(url: &str, chunk_callback: impl Fn(Message)) -> Result<()> {
    let url = Url::parse(&url).context("Cannot parse URL")?;

    let host = url.host_str().context("Url doesn't have host")?;

M moonrender/src/types/text_gemini.rs => moonrender/src/types/text_gemini.rs +6 -1
@@ 42,7 42,12 @@ impl Renderer for Gemini {

            Ok(Box::new(Link::new(caption, link.to_owned())))
        } else if line.starts_with('*') {
            Ok(Box::new(List::new(line[1..].trim().to_owned())))
            Ok(Box::new(List::new(
                line.strip_prefix("*")
                    .context("Couldn't strip list prefix")?
                    .trim()
                    .to_owned(),
            )))
        } else if line.starts_with('#') {
            let mut heading = 0;
            let mut iter = line.chars();

M src/gui/header/address_bar.rs => src/gui/header/address_bar.rs +0 -3
@@ 6,8 6,6 @@ use relm_derive::{widget, Msg};
pub enum Msg {
    Goto(String),
    Redirect(String),

    Error(anyhow::Error),
}

pub struct Model {


@@ 25,7 23,6 @@ impl Widget for AddressBar {
            Msg::Redirect(url) => self.model.url = url,

            Msg::Goto(_) => { /* listened from parent */ }
            Msg::Error(_) => { /* listened from parent */ }
        }
    }


M src/gui/mod.rs => src/gui/mod.rs +3 -1
@@ 115,7 115,9 @@ impl Widget for Win {
                    }

                    // TODO: not-unsafe way to do this
                    unsafe { d.destroy(); }
                    unsafe {
                        d.destroy();
                    }
                });

                self.model.history.pop();