From d9a06e8d0f08469b2a530aa0c8ed9da85a6207a9 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 29 Sep 2024 15:09:01 +0300 Subject: [PATCH] change page update toggle --- src/browser/main/tab/page.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/browser/main/tab/page.rs b/src/browser/main/tab/page.rs index fba480d7..02946b3a 100644 --- a/src/browser/main/tab/page.rs +++ b/src/browser/main/tab/page.rs @@ -193,6 +193,8 @@ impl Page { meta.borrow_mut().description = Some(host); meta.borrow_mut().title = Some(uri.path()); + action_update.activate(None); + // Try create short base for title let path = uri.path(); let path = Path::new(&path); @@ -219,28 +221,34 @@ impl Page { "text/gemini" => { // Update meta meta.borrow_mut().mime = Some(Mime::TextGemini); - // Select widget + + // Update data match parts.get(4) { Some(source) => { - // Update content - let result = content.reset(content::Mime::TextGemini, &uri, &source); + meta.borrow_mut().status = Some(Status::Success); // This content type may return parsed title + let result = content.reset(content::Mime::TextGemini, &uri, &source); meta.borrow_mut().title = result.title.clone(); - // Update status - meta.borrow_mut().status = Some(Status::Success); + action_update.activate(None); }, None => todo!(), } }, "text/plain" => { + meta.borrow_mut().status = Some(Status::Success); meta.borrow_mut().mime = Some(Mime::TextPlain); + + action_update.activate(None); todo!() }, _ => { + meta.borrow_mut().status = Some(Status::Failure); meta.borrow_mut().title = Some(gformat!("Oops")); meta.borrow_mut().description = Some(gformat!("Content {mime} not supported")); + + action_update.activate(None); }, } None => todo!(), @@ -253,6 +261,8 @@ impl Page { meta.borrow_mut().mime = Some(Mime::TextGemini); meta.borrow_mut().title = Some(gformat!("Redirect")); + action_update.activate(None); + // Select widget match parts.get(3) { Some(source) => { @@ -268,16 +278,16 @@ impl Page { }, // @TODO _ => { + // Update meta.borrow_mut().status = Some(Status::Failure); meta.borrow_mut().title = Some(gformat!("Oops")); meta.borrow_mut().description = Some(gformat!("Status {code} not supported")); + + action_update.activate(None); }, } None => todo!(), }; - - // Update - action_update.activate(None); } Err(e) => { meta.borrow_mut().status = Some(Status::Failure);