mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update indication icon on page handle
This commit is contained in:
parent
abb9de617d
commit
556a1eba89
2 changed files with 46 additions and 54 deletions
|
|
@ -180,10 +180,13 @@ fn handle(
|
|||
/// * includes commit action!
|
||||
fn update_page_info(page: &Page, event_name: &str) {
|
||||
let mut i = page.navigation.request.info.borrow_mut();
|
||||
i.add_event(event_name.to_string())
|
||||
i
|
||||
.add_event(event_name.to_string())
|
||||
.unset_mime()
|
||||
.unset_size()
|
||||
.commit()
|
||||
.commit();
|
||||
|
||||
page.navigation.request.update_secondary_icon(&i)
|
||||
}
|
||||
// Update socket info at the point, where the connection is active yet
|
||||
// * also, actualize `request` as same everywhere below
|
||||
|
|
@ -349,6 +352,7 @@ fn handle(
|
|||
i
|
||||
.add_event(EVENT_COMPLETED.to_string())
|
||||
.commit();
|
||||
page.navigation.request.update_secondary_icon(&i)
|
||||
},
|
||||
Err(e) => {
|
||||
let s = page.content.to_status_failure();
|
||||
|
|
@ -420,27 +424,19 @@ fn handle(
|
|||
Ok(buffer) => {
|
||||
page.set_title(&crate::tool::uri_to_title(&uri));
|
||||
page.content.to_image(&Texture::for_pixbuf(&buffer));
|
||||
{
|
||||
let mut i = page.navigation.request.info.borrow_mut();
|
||||
i
|
||||
.add_event(EVENT_COMPLETED.to_string())
|
||||
.set_mime(Some(success.mime().to_string()))
|
||||
.set_size(None, Some(buffer.byte_length()))
|
||||
.commit();
|
||||
}
|
||||
let mut i = page.navigation.request.info.borrow_mut();
|
||||
i
|
||||
.add_event(EVENT_COMPLETED.to_string())
|
||||
.set_mime(Some(success.mime().to_string()))
|
||||
.set_size(None, Some(buffer.byte_length()))
|
||||
.commit();
|
||||
page.navigation.request.update_secondary_icon(&i)
|
||||
}
|
||||
Err(e) => {
|
||||
let s = page.content.to_status_failure();
|
||||
s.set_description(Some(e.message()));
|
||||
page.set_title(&s.title());
|
||||
{
|
||||
let mut i = page.navigation.request.info.borrow_mut();
|
||||
i
|
||||
.add_event(EVENT_COMPLETED.to_string())
|
||||
.set_mime(Some(success.mime().to_string()))
|
||||
.unset_size()
|
||||
.commit();
|
||||
}
|
||||
update_page_info(&page, EVENT_COMPLETED);
|
||||
}
|
||||
}
|
||||
page.set_progress(0.0);
|
||||
|
|
@ -460,14 +456,7 @@ fn handle(
|
|||
page.snap_history();
|
||||
}
|
||||
redirects.replace(0); // reset
|
||||
{
|
||||
let mut i = page.navigation.request.info.borrow_mut();
|
||||
i
|
||||
.add_event(EVENT_COMPLETED.to_string())
|
||||
.set_mime(Some(success.mime().to_string()))
|
||||
.unset_size()
|
||||
.commit();
|
||||
}
|
||||
update_page_info(&page, EVENT_COMPLETED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -485,14 +474,13 @@ fn handle(
|
|||
page.snap_history();
|
||||
}
|
||||
redirects.replace(0); // reset
|
||||
{
|
||||
let mut i = page.navigation.request.info.borrow_mut();
|
||||
i
|
||||
.add_event(EVENT_COMPLETED.to_string())
|
||||
.set_mime(Some(mime.to_string()))
|
||||
.unset_size()
|
||||
.commit();
|
||||
}
|
||||
let mut i = page.navigation.request.info.borrow_mut();
|
||||
i
|
||||
.add_event(EVENT_COMPLETED.to_string())
|
||||
.set_mime(Some(mime.to_string()))
|
||||
.unset_size()
|
||||
.commit();
|
||||
page.navigation.request.update_secondary_icon(&i)
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
@ -635,14 +623,13 @@ fn handle(
|
|||
page.snap_history();
|
||||
}
|
||||
redirects.replace(0); // reset
|
||||
{
|
||||
let mut i = page.navigation.request.info.borrow_mut();
|
||||
i.add_event(EVENT_COMPLETED.to_string())
|
||||
.set_request(Some(uri.to_string()))
|
||||
.unset_mime()
|
||||
.unset_size()
|
||||
.commit()
|
||||
}
|
||||
let mut i = page.navigation.request.info.borrow_mut();
|
||||
i.add_event(EVENT_COMPLETED.to_string())
|
||||
.set_request(Some(uri.to_string()))
|
||||
.unset_mime()
|
||||
.unset_size()
|
||||
.commit();
|
||||
page.navigation.request.update_secondary_icon(&i)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -188,22 +188,11 @@ impl Request {
|
|||
}
|
||||
|
||||
// Actions
|
||||
|
||||
pub fn escape(&self) {
|
||||
self.suggestion.hide()
|
||||
}
|
||||
|
||||
/// Try build home [Uri](https://docs.gtk.org/glib/struct.Uri.html) for `Self`
|
||||
/// * return `None` if current request already match home or Uri not parsable
|
||||
pub fn home(&self) -> Option<Uri> {
|
||||
home(&self.entry)
|
||||
}
|
||||
|
||||
/// Try get current request value as [Uri](https://docs.gtk.org/glib/struct.Uri.html)
|
||||
/// * `strip_prefix` on parse
|
||||
pub fn uri(&self) -> Option<Uri> {
|
||||
uri(&self.entry)
|
||||
}
|
||||
|
||||
pub fn show_identity_dialog(&self) {
|
||||
show_identity_dialog(&self.entry, &self.profile)
|
||||
}
|
||||
|
|
@ -258,6 +247,10 @@ impl Request {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn update_secondary_icon(&self, info: &Info) {
|
||||
update_secondary_icon(&self.entry, info);
|
||||
}
|
||||
|
||||
// Setters
|
||||
|
||||
pub fn to_download(&self) {
|
||||
|
|
@ -270,6 +263,18 @@ impl Request {
|
|||
|
||||
// Getters
|
||||
|
||||
/// Try build home [Uri](https://docs.gtk.org/glib/struct.Uri.html) for `Self`
|
||||
/// * return `None` if current request already match home or Uri not parsable
|
||||
pub fn home(&self) -> Option<Uri> {
|
||||
home(&self.entry)
|
||||
}
|
||||
|
||||
/// Try get current request value as [Uri](https://docs.gtk.org/glib/struct.Uri.html)
|
||||
/// * `strip_prefix` on parse
|
||||
pub fn uri(&self) -> Option<Uri> {
|
||||
uri(&self.entry)
|
||||
}
|
||||
|
||||
pub fn is_file(&self) -> bool {
|
||||
self.entry.text().starts_with("file://")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue