1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-19 00:05:36 +00: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:
Miciah Dashiel Butler Masters 2007-09-06 18:37:17 +00:00 committed by Laurent MONIN
parent 8e3c2d6042
commit 7033247905
4 changed files with 18 additions and 16 deletions

View File

@ -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");
@ -120,3 +120,17 @@ 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"))
return;
start_document_refresh(ses->doc_view->document->refresh, ses);
}

View File

@ -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

View File

@ -589,13 +589,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")) {
start_document_refresh(ses->doc_view->document->refresh,
ses);
}
start_document_refreshes(ses);
if (download->state != S_OK) {
print_error_dialog(ses, download->state,

View File

@ -350,13 +350,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")) {
start_document_refresh(ses->doc_view->document->refresh,
ses);
}
start_document_refreshes(ses);
}
if (ses->tab != get_current_tab(ses->tab->term))