Python: Give goto_url_hook only one argument, like follow_url_hook.
[elinks.git] / src / config / urlhist.c
blob978356746a3a5c4ded698abb86cd9d919827810b
1 /* Manipulation with file containing URL history */
3 #ifdef HAVE_CONFIG_H
4 #include "config.h"
5 #endif
7 #include "elinks.h"
9 #include "bfu/dialog.h"
10 #include "config/urlhist.h"
11 #include "intl/gettext/libintl.h"
12 #include "main/event.h"
13 #include "main/module.h"
14 #include "util/lists.h"
15 #include "util/memory.h"
17 #define GOTO_HISTORY_FILENAME "gotohist"
20 INIT_INPUT_HISTORY(goto_url_history);
22 static void
23 load_url_history(void)
25 load_input_history(&goto_url_history, GOTO_HISTORY_FILENAME);
28 static void
29 save_url_history(void)
31 save_input_history(&goto_url_history, GOTO_HISTORY_FILENAME);
34 static enum evhook_status
35 goto_url_history_write_hook(va_list ap, void *data)
37 save_url_history();
38 return EVENT_HOOK_STATUS_NEXT;
41 static struct event_hook_info goto_url_history_hooks[] = {
42 { "periodic-saving", 0, goto_url_history_write_hook, NULL },
44 NULL_EVENT_HOOK_INFO,
47 static void
48 init_url_history(struct module *module)
50 load_url_history();
53 static void
54 done_url_history(struct module *module)
56 save_url_history();
57 free_list(goto_url_history.entries);
60 struct module goto_url_history_module = struct_module(
61 /* name: */ N_("Goto URL History"),
62 /* options: */ NULL,
63 /* hooks: */ goto_url_history_hooks,
64 /* submodules: */ NULL,
65 /* data: */ NULL,
66 /* init: */ init_url_history,
67 /* done: */ done_url_history