-- Leo's gemini proxy

-- Connecting to typed-hole.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

commit ea56bbde331b8b937646bbb1269588bf7337e230

Author: Julien Blanchard <julien@typed-hole.org>

Date: Mon Apr 20 10:24:43 2020 +0200


Remove unused tags mod


diff --git a/src/main.rs b/src/main.rs

index 33c81b6..21f74d1 100644

--- a/src/main.rs

+++ b/src/main.rs

@@ -31,7 +31,6 @@ mod protocols;

use protocols::{Finger, Gemini, Gopher, Protocol, Scheme};

mod status;

use status::Status;

-mod tags;


fn main() {

// Start up the GTK3 subsystem.

@@ -39,7 +38,6 @@ fn main() {


// Create the main window.

let gui = Arc::new(Gui::new());

- let content_view = gui.content_view();


// Bind back button

{

@@ -78,9 +76,6 @@ fn main() {

});

}


- // Create Pango tags

- tags::apply_tags(&content_view.get_buffer().unwrap());

-

// Visit URL if one was provided

let args: Vec<String> = env::args().collect();

if args.len() > 1 {

@@ -180,7 +175,7 @@ fn visit_url<T: AbsoluteUrl + Protocol>(gui: &Arc<Gui>, url: T) {

Ok(absolute_url) => match gemini::client::get_data(url) {

Ok((meta, new_content)) => {

let meta_str = String::from_utf8_lossy(&meta.unwrap()).to_string();

- println!("{:?}", meta_str);

+

if let Ok(status) = Status::from_str(&meta_str) {

match status {

Status::Success(meta) => {

diff --git a/src/tags.rs b/src/tags.rs

deleted file mode 100644

index 1eaa7a4..0000000

--- a/src/tags.rs

+++ /dev/null

@@ -1,104 +0,0 @@

-use gtk::prelude::*;

-use gtk::{TextBufferExt, TextTagExt};

-

-use std::str::FromStr;

-

-pub fn apply_tags(buffer: &gtk::TextBuffer) {

- if let Some(table) = buffer.get_tag_table() {

- let link = link_tag();

- table.add(&link);

-

- (1..6).for_each(|level| {

- let heading = heading_tag(level);

- table.add(&heading);

- });

-

- let text = text_tag();

- table.add(&text);

-

- let bold = bold_tag();

- table.add(&bold);

-

- let list = list_tag();

- table.add(&list);

-

- let del = del_tag();

- table.add(&del);

-

- let ref_t = ref_tag();

- table.add(&ref_t);

-

- let sub = sub_tag();

- table.add(&sub);

-

- let italic = italic_tag();

- table.add(&italic);

-

- let references = references_tag();

- table.add(&references);

- }

-}

-

-fn link_tag() -> gtk::TextTag {

- let tag = gtk::TextTag::new(Some("link"));

- tag.set_property_underline(pango::Underline::Single);

- let color = gdk::RGBA::from_str("#2196F3").unwrap();

- tag.set_property_foreground_rgba(Some(&color));

- tag

-}

-

-fn heading_tag(level: i32) -> gtk::TextTag {

- let name = format!("heading{}", &level);

- let tag = gtk::TextTag::new(Some(&*name));

-

- let color = gdk::RGBA::from_str("#263238").unwrap();

- tag.set_property_foreground_rgba(Some(&color));

-

- match level {

- 1 => tag.set_property_size_points(25.0),

- 2 => tag.set_property_size_points(22.0),

- 3 => tag.set_property_size_points(19.0),

- 4 => tag.set_property_size_points(16.0),

- 5 => tag.set_property_size_points(14.0),

- 6 => tag.set_property_size_points(12.0),

- _ => {}

- }

-

- tag

-}

-

-fn text_tag() -> gtk::TextTag {

- gtk::TextTag::new(Some("text"))

-}

-

-fn bold_tag() -> gtk::TextTag {

- let tag = gtk::TextTag::new(Some("bold"));

- tag.set_property_weight(600);

- tag

-}

-

-fn list_tag() -> gtk::TextTag {

- gtk::TextTag::new(Some("li"))

-}

-

-fn del_tag() -> gtk::TextTag {

- gtk::TextTag::new(Some("del"))

-}

-

-fn ref_tag() -> gtk::TextTag {

- gtk::TextTag::new(Some("ref"))

-}

-

-fn references_tag() -> gtk::TextTag {

- gtk::TextTag::new(Some("references"))

-}

-

-fn sub_tag() -> gtk::TextTag {

- gtk::TextTag::new(Some("sub"))

-}

-

-fn italic_tag() -> gtk::TextTag {

- let tag = gtk::TextTag::new(Some("italic"));

- tag.set_property_style(pango::Style::Italic);

- tag

-}



---

Served by Pollux Gemini Server.

-- Response ended

-- Page fetched on Sun May 19 06:44:07 2024