mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Introduce start_document_refreshes
start_document_refreshes performs the NULL-pointer checks that previously all callers to start_document_refresh must perform and then calls start_document_refresh.
This commit is contained in:
parent
34212320fa
commit
a1a8696cce
@ -94,7 +94,7 @@ do_document_refresh(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
start_document_refresh(struct document_refresh *refresh, struct session *ses)
|
||||
{
|
||||
milliseconds_T minimum = (milliseconds_T) get_opt_int("document.browse.minimum_refresh_time", ses);
|
||||
@ -120,3 +120,18 @@ start_document_refresh(struct document_refresh *refresh, struct session *ses)
|
||||
|
||||
install_timer(&refresh->timer, time, do_document_refresh, ses);
|
||||
}
|
||||
|
||||
void
|
||||
start_document_refreshes(struct session *ses)
|
||||
{
|
||||
|
||||
assert(ses);
|
||||
|
||||
if (!ses->doc_view
|
||||
|| !ses->doc_view->document
|
||||
|| !ses->doc_view->document->refresh
|
||||
|| !get_opt_bool("document.browse.refresh", ses))
|
||||
return;
|
||||
|
||||
start_document_refresh(ses->doc_view->document->refresh, ses);
|
||||
}
|
||||
|
@ -16,6 +16,6 @@ struct document_refresh {
|
||||
struct document_refresh *init_document_refresh(unsigned char *url, unsigned long seconds);
|
||||
void done_document_refresh(struct document_refresh *refresh);
|
||||
void kill_document_refresh(struct document_refresh *refresh);
|
||||
void start_document_refresh(struct document_refresh *refresh, struct session *ses);
|
||||
void start_document_refreshes(struct session *ses);
|
||||
|
||||
#endif
|
||||
|
@ -588,13 +588,7 @@ doc_loading_callback(struct download *download, struct session *ses)
|
||||
load_ecmascript_imports(ses, ses->doc_view);
|
||||
process_file_requests(ses);
|
||||
|
||||
if (ses->doc_view
|
||||
&& ses->doc_view->document
|
||||
&& ses->doc_view->document->refresh
|
||||
&& get_opt_bool("document.browse.refresh", ses)) {
|
||||
start_document_refresh(ses->doc_view->document->refresh,
|
||||
ses);
|
||||
}
|
||||
start_document_refreshes(ses);
|
||||
|
||||
if (download->state != S_OK) {
|
||||
print_error_dialog(ses, download->state,
|
||||
|
@ -351,13 +351,7 @@ draw_formatted(struct session *ses, int rerender)
|
||||
render_document_frames(ses, rerender);
|
||||
|
||||
/* Rerendering kills the document refreshing so restart it. */
|
||||
if (ses->doc_view
|
||||
&& ses->doc_view->document
|
||||
&& ses->doc_view->document->refresh
|
||||
&& get_opt_bool("document.browse.refresh", ses)) {
|
||||
start_document_refresh(ses->doc_view->document->refresh,
|
||||
ses);
|
||||
}
|
||||
start_document_refreshes(ses);
|
||||
}
|
||||
|
||||
if (ses->tab != get_current_tab(ses->tab->term))
|
||||
|
Loading…
Reference in New Issue
Block a user