mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 12:12:35 +03:00
Let contents broadcast explicit status messages as well as announce that their internal status has been updated.
This commit is contained in:
parent
5fb51a0fb7
commit
e5374cc042
@ -169,6 +169,7 @@ nserror content_llcache_callback(llcache_handle *llcache,
|
||||
(void) llcache_handle_get_source_data(llcache, &source_size);
|
||||
|
||||
content_set_status(c, messages_get("Processing"));
|
||||
msg_data.explicit_status_text = NULL;
|
||||
content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
|
||||
|
||||
content_convert(c);
|
||||
@ -182,6 +183,7 @@ nserror content_llcache_callback(llcache_handle *llcache,
|
||||
break;
|
||||
case LLCACHE_EVENT_PROGRESS:
|
||||
content_set_status(c, event->data.msg);
|
||||
msg_data.explicit_status_text = NULL;
|
||||
content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
|
||||
break;
|
||||
}
|
||||
|
@ -110,6 +110,10 @@ union content_msg_data {
|
||||
int delay;
|
||||
/** CONTENT_MSG_REFORMAT - Reformat should not cause a redraw */
|
||||
bool background;
|
||||
/** CONTENT_MSG_STATUS - Status message update. If NULL, the content's
|
||||
* internal status text has been updated, and listener should use
|
||||
* content_get_status_message() */
|
||||
const char *explicit_status_text;
|
||||
/** CONTENT_MSG_DOWNLOAD - Low-level cache handle */
|
||||
struct llcache_handle *download;
|
||||
/** CONTENT_MSG_RFC5988_LINK - rfc5988 link data */
|
||||
|
@ -1323,7 +1323,15 @@ nserror browser_window_callback(hlcache_handle *c,
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_STATUS:
|
||||
browser_window_set_status(bw, content_get_status_message(c));
|
||||
if (event->data.explicit_status_text == NULL) {
|
||||
/* Object content's status text updated */
|
||||
browser_window_set_status(bw,
|
||||
content_get_status_message(c));
|
||||
} else {
|
||||
/* Object content wants to set explicit message */
|
||||
browser_window_set_status(bw,
|
||||
event->data.explicit_status_text);
|
||||
}
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_REFORMAT:
|
||||
|
@ -240,6 +240,7 @@ void html_finish_conversion(html_content *c)
|
||||
/* convert xml tree to box tree */
|
||||
LOG(("XML to box (%p)", c));
|
||||
content_set_status(&c->base, messages_get("Processing"));
|
||||
msg_data.explicit_status_text = NULL;
|
||||
content_broadcast(&c->base, CONTENT_MSG_STATUS, msg_data);
|
||||
|
||||
exc = dom_document_get_document_element(c->document, (void *) &html);
|
||||
@ -1168,14 +1169,18 @@ html_object_callback(hlcache_handle *object,
|
||||
LOG(("%d fetches active", c->base.active));
|
||||
|
||||
content_add_error(&c->base, "?", 0);
|
||||
html_set_status(c, event->data.error);
|
||||
content_broadcast(&c->base, CONTENT_MSG_STATUS, event->data);
|
||||
html_object_failed(box, c, o->background);
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_STATUS:
|
||||
html_set_status(c, content_get_status_message(object));
|
||||
/* content_broadcast(&c->base, CONTENT_MSG_STATUS, 0); */
|
||||
if (event->data.explicit_status_text == NULL) {
|
||||
/* Object content's status text updated */
|
||||
html_set_status(c, content_get_status_message(object));
|
||||
} else {
|
||||
/* Object content wants to set explicit message */
|
||||
content_broadcast(&c->base, CONTENT_MSG_STATUS,
|
||||
event->data);
|
||||
}
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_REFORMAT:
|
||||
@ -1406,9 +1411,17 @@ html_convert_css_callback(hlcache_handle *css,
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_STATUS:
|
||||
html_set_status(parent, content_get_status_message(css));
|
||||
content_broadcast(&parent->base, CONTENT_MSG_STATUS,
|
||||
event->data);
|
||||
if (event->data.explicit_status_text == NULL) {
|
||||
/* Object content's status text updated */
|
||||
html_set_status(parent,
|
||||
content_get_status_message(css));
|
||||
content_broadcast(&parent->base, CONTENT_MSG_STATUS,
|
||||
event->data);
|
||||
} else {
|
||||
/* Object content wants to set explicit message */
|
||||
content_broadcast(&parent->base, CONTENT_MSG_STATUS,
|
||||
event->data);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -188,9 +188,6 @@ convert_script_async_cb(hlcache_handle *script,
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_STATUS:
|
||||
html_set_status(parent, content_get_status_message(script));
|
||||
content_broadcast(&parent->base, CONTENT_MSG_STATUS,
|
||||
event->data);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -248,9 +245,6 @@ convert_script_defer_cb(hlcache_handle *script,
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_STATUS:
|
||||
html_set_status(parent, content_get_status_message(script));
|
||||
content_broadcast(&parent->base, CONTENT_MSG_STATUS,
|
||||
event->data);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -345,9 +339,6 @@ convert_script_sync_cb(hlcache_handle *script,
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_STATUS:
|
||||
html_set_status(parent, content_get_status_message(script));
|
||||
content_broadcast(&parent->base, CONTENT_MSG_STATUS,
|
||||
event->data);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user