@@ -4,7 +4,6 @@ use futures::future::RemoteHandle;
44use futures:: io:: BufReader ;
55use futures:: prelude:: * ;
66use futures:: task:: LocalSpawnExt ;
7- use glib_macros:: Properties ;
87use gtk:: gdk:: prelude:: * ;
98use gtk:: gio;
109use gtk:: glib;
@@ -17,6 +16,7 @@ use std::marker::PhantomData;
1716use std:: pin:: Pin ;
1817use std:: rc:: Rc ;
1918use url:: Url ;
19+ use glib:: Properties ;
2020
2121use crate :: common;
2222use crate :: common:: { glibctx, HistoryItem , LossyTextRead , PageElement , RequestCtx } ;
@@ -310,7 +310,7 @@ impl Tab {
310310 async move {
311311 let buf = BufReader :: new ( & * cache) ;
312312 draw_ctx. clear ( ) ;
313- let res = this. display_gemini ( & mut draw_ctx , buf) . await ;
313+ let res = this. display_gemini ( buf) . await ;
314314 match res {
315315 Ok ( _) => {
316316 info ! ( "Loaded {} from cache" , & url) ;
@@ -412,7 +412,7 @@ impl Tab {
412412 let lines = BufReader :: new ( file) ;
413413 match path. extension ( ) . map ( |x| x. to_str ( ) ) {
414414 Some ( Some ( "gmi" ) ) | Some ( Some ( "gemini" ) ) => {
415- this. display_gemini ( & mut req . draw_ctx , lines) . await ?;
415+ this. display_gemini ( lines) . await ?;
416416 }
417417 _ => {
418418 Self :: display_text ( & mut req. draw_ctx , lines) . await ?;
@@ -426,7 +426,7 @@ impl Tab {
426426 match req. url . scheme ( ) {
427427 "about" => {
428428 let reader = futures:: io:: BufReader :: new ( common:: ABOUT_PAGE . as_bytes ( ) ) ;
429- this. display_gemini ( & mut req . draw_ctx , reader) . await ?;
429+ this. display_gemini ( reader) . await ?;
430430 Ok ( None )
431431 }
432432 "file" => {
@@ -458,7 +458,7 @@ impl Tab {
458458 let body = res. body ( ) . context ( "Body not found" ) ?;
459459 let buffered = futures:: io:: BufReader :: new ( body) ;
460460 if meta. contains ( "text/gemini" ) {
461- let res = this. display_gemini ( & mut req . draw_ctx , buffered) . await ?;
461+ let res = this. display_gemini ( buffered) . await ?;
462462 Some ( res)
463463 } else if meta. contains ( "text" ) {
464464 Self :: display_text ( & mut req. draw_ctx , buffered) . await ?;
@@ -634,10 +634,10 @@ click on the button below\n",
634634 }
635635 async fn display_gemini < T : AsyncBufRead + Unpin > (
636636 & self ,
637- draw_ctx : & mut DrawCtx ,
638637 mut reader : T ,
639638 ) -> anyhow:: Result < Vec < u8 > > {
640639 let imp = self . imp ( ) ;
640+ let mut draw_ctx = imp. draw_ctx . borrow ( ) . clone ( ) . unwrap ( ) ;
641641
642642 let mut parser = gemini:: Parser :: new ( ) ;
643643 let mut text_iter = draw_ctx. text_buffer . end_iter ( ) ;
0 commit comments