mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
remove deprecation feature methods
This commit is contained in:
parent
560adff490
commit
f9365791e6
4 changed files with 10 additions and 40 deletions
|
|
@ -39,9 +39,6 @@ impl Client {
|
||||||
pub fn handle(&self, request: &str, is_snap_history: bool) {
|
pub fn handle(&self, request: &str, is_snap_history: bool) {
|
||||||
self.page.escape();
|
self.page.escape();
|
||||||
|
|
||||||
// Deprecate page info but keep it data as is
|
|
||||||
self.page.navigation.request.info.borrow_mut().deprecate();
|
|
||||||
|
|
||||||
// Initially disable find action
|
// Initially disable find action
|
||||||
self.page
|
self.page
|
||||||
.window_action
|
.window_action
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ fn handle(
|
||||||
/// * includes commit action!
|
/// * includes commit action!
|
||||||
fn update_page_info(page: &Page, event_name: &str) {
|
fn update_page_info(page: &Page, event_name: &str) {
|
||||||
let mut i = page.navigation.request.info.borrow_mut();
|
let mut i = page.navigation.request.info.borrow_mut();
|
||||||
i.add_event(event_name.to_string()).commit();
|
i.add_event(event_name.to_string());
|
||||||
page.navigation.request.update_secondary_icon(&i)
|
page.navigation.request.update_secondary_icon(&i)
|
||||||
}
|
}
|
||||||
// Update socket info at the point, where the connection is active yet
|
// Update socket info at the point, where the connection is active yet
|
||||||
|
|
@ -196,7 +196,7 @@ fn handle(
|
||||||
connection.socket_connection.remote_address().unwrap()
|
connection.socket_connection.remote_address().unwrap()
|
||||||
)));
|
)));
|
||||||
// * unwrap fails only on `connection.socket_connection.is_closed()`
|
// * unwrap fails only on `connection.socket_connection.is_closed()`
|
||||||
// drop the panic as unexpected.
|
// drop the panic as unexpected here.
|
||||||
}
|
}
|
||||||
// Handle response
|
// Handle response
|
||||||
match response {
|
match response {
|
||||||
|
|
@ -212,8 +212,7 @@ fn handle(
|
||||||
i
|
i
|
||||||
.add_event(EVENT_COMPLETED.to_string())
|
.add_event(EVENT_COMPLETED.to_string())
|
||||||
.set_header(Some(input.as_str().to_string()))
|
.set_header(Some(input.as_str().to_string()))
|
||||||
.set_size(Some(input.as_bytes().len()))
|
.set_size(Some(input.as_bytes().len()));
|
||||||
.commit();
|
|
||||||
page.navigation.request.update_secondary_icon(&i);
|
page.navigation.request.update_secondary_icon(&i);
|
||||||
match input {
|
match input {
|
||||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-10
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-10
|
||||||
|
|
@ -354,9 +353,7 @@ fn handle(
|
||||||
page.snap_history();
|
page.snap_history();
|
||||||
}
|
}
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
i
|
i.add_event(EVENT_COMPLETED.to_string());
|
||||||
.add_event(EVENT_COMPLETED.to_string())
|
|
||||||
.commit();
|
|
||||||
page.navigation.request.update_secondary_icon(&i)
|
page.navigation.request.update_secondary_icon(&i)
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -435,8 +432,7 @@ fn handle(
|
||||||
.add_event(EVENT_COMPLETED.to_string())
|
.add_event(EVENT_COMPLETED.to_string())
|
||||||
.set_header(Some(success.as_header_str().to_string()))
|
.set_header(Some(success.as_header_str().to_string()))
|
||||||
.set_mime(Some(mime))
|
.set_mime(Some(mime))
|
||||||
.set_size(Some(buffer.byte_length()))
|
.set_size(Some(buffer.byte_length()));
|
||||||
.commit();
|
|
||||||
page.navigation.request.update_secondary_icon(&i)
|
page.navigation.request.update_secondary_icon(&i)
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -485,8 +481,7 @@ fn handle(
|
||||||
i
|
i
|
||||||
.add_event(EVENT_COMPLETED.to_string())
|
.add_event(EVENT_COMPLETED.to_string())
|
||||||
.set_header(Some(success.as_header_str().to_string()))
|
.set_header(Some(success.as_header_str().to_string()))
|
||||||
.set_mime(Some(mime.to_string()))
|
.set_mime(Some(mime.to_string()));
|
||||||
.commit();
|
|
||||||
page.navigation.request.update_secondary_icon(&i)
|
page.navigation.request.update_secondary_icon(&i)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -553,8 +548,7 @@ fn handle(
|
||||||
let mut i = page.navigation.request.info.take();
|
let mut i = page.navigation.request.info.take();
|
||||||
i
|
i
|
||||||
.add_event(EVENT_COMPLETED.to_string())
|
.add_event(EVENT_COMPLETED.to_string())
|
||||||
.set_header(Some(redirect.as_str().to_string()))
|
.set_header(Some(redirect.as_str().to_string()));
|
||||||
.commit();
|
|
||||||
page.navigation.request.info.replace(match redirect {
|
page.navigation.request.info.replace(match redirect {
|
||||||
Redirect::Permanent { .. } => i.into_permanent_redirect(),
|
Redirect::Permanent { .. } => i.into_permanent_redirect(),
|
||||||
Redirect::Temporary { .. } => i.into_temporary_redirect(),
|
Redirect::Temporary { .. } => i.into_temporary_redirect(),
|
||||||
|
|
@ -578,8 +572,7 @@ fn handle(
|
||||||
i
|
i
|
||||||
.add_event(EVENT_COMPLETED.to_string())
|
.add_event(EVENT_COMPLETED.to_string())
|
||||||
.set_header(Some(certificate.as_str().to_string()))
|
.set_header(Some(certificate.as_str().to_string()))
|
||||||
.set_size(Some(certificate.as_bytes().len()))
|
.set_size(Some(certificate.as_bytes().len()));
|
||||||
.commit();
|
|
||||||
page.navigation.request.update_secondary_icon(&i);
|
page.navigation.request.update_secondary_icon(&i);
|
||||||
// update page content widget
|
// update page content widget
|
||||||
let s = page.content.to_status_identity();
|
let s = page.content.to_status_identity();
|
||||||
|
|
@ -619,7 +612,7 @@ fn handle(
|
||||||
}
|
}
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
let mut i = page.navigation.request.info.borrow_mut();
|
let mut i = page.navigation.request.info.borrow_mut();
|
||||||
i.add_event(EVENT_COMPLETED.to_string()).set_request(Some(uri.to_string())).commit();
|
i.add_event(EVENT_COMPLETED.to_string()).set_request(Some(uri.to_string()));
|
||||||
page.navigation.request.update_secondary_icon(&i)
|
page.navigation.request.update_secondary_icon(&i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ fn update_secondary_icon(entry: &Entry, info: &Info) {
|
||||||
entry.set_secondary_icon_name(Some("pan-end-symbolic"));
|
entry.set_secondary_icon_name(Some("pan-end-symbolic"));
|
||||||
entry.set_secondary_icon_tooltip_text(Some("Go to the location"))
|
entry.set_secondary_icon_tooltip_text(Some("Go to the location"))
|
||||||
} else {
|
} else {
|
||||||
if !info.is_deprecated() && info.matches(&entry.text()) {
|
if info.matches(&entry.text()) {
|
||||||
entry.set_secondary_icon_name(Some("help-about-symbolic"));
|
entry.set_secondary_icon_name(Some("help-about-symbolic"));
|
||||||
entry.set_secondary_icon_tooltip_text(Some("Page info"));
|
entry.set_secondary_icon_tooltip_text(Some("Page info"));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,6 @@ pub struct Info {
|
||||||
/// Hold optional header string to dump it in the info dialog
|
/// Hold optional header string to dump it in the info dialog
|
||||||
/// and calculate total size
|
/// and calculate total size
|
||||||
header: Option<String>,
|
header: Option<String>,
|
||||||
/// Mark holder as deprecated on handle begin
|
|
||||||
/// * useful on some driver does not update status properly
|
|
||||||
is_deprecated: bool,
|
|
||||||
/// Page content type
|
/// Page content type
|
||||||
mime: Option<String>,
|
mime: Option<String>,
|
||||||
/// Hold redirections chain with handled details
|
/// Hold redirections chain with handled details
|
||||||
|
|
@ -44,7 +41,6 @@ impl Info {
|
||||||
Self {
|
Self {
|
||||||
event: Vec::with_capacity(50), // estimated max events quantity for all drivers
|
event: Vec::with_capacity(50), // estimated max events quantity for all drivers
|
||||||
header: None,
|
header: None,
|
||||||
is_deprecated: false,
|
|
||||||
mime: None,
|
mime: None,
|
||||||
redirect: None,
|
redirect: None,
|
||||||
request: None,
|
request: None,
|
||||||
|
|
@ -76,18 +72,6 @@ impl Info {
|
||||||
PreferencesDialog::info(profile, self).present(Some(parent))
|
PreferencesDialog::info(profile, self).present(Some(parent))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Actualize `Self`
|
|
||||||
pub fn commit(&mut self) {
|
|
||||||
self.is_deprecated = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Mark `Self` as deprecated
|
|
||||||
/// * tip: usually called on page load begin,
|
|
||||||
/// to prevent driver implementation mistakes
|
|
||||||
pub fn deprecate(&mut self) {
|
|
||||||
self.is_deprecated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
// * update `Self` in chain
|
// * update `Self` in chain
|
||||||
|
|
||||||
|
|
@ -149,10 +133,6 @@ impl Info {
|
||||||
pub fn matches(&self, request: &str) -> bool {
|
pub fn matches(&self, request: &str) -> bool {
|
||||||
self.request.as_ref().is_some_and(|r| r == request)
|
self.request.as_ref().is_some_and(|r| r == request)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_deprecated(&self) -> bool {
|
|
||||||
self.is_deprecated
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Info {
|
impl Default for Info {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue