mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Merge with git+ssh://pasky.or.cz/srv/git/elinks.git
This commit is contained in:
commit
d87c0d9958
@ -16,6 +16,7 @@
|
||||
#include "config/options.h"
|
||||
#include "intl/gettext/libintl.h"
|
||||
#include "main/event.h"
|
||||
#include "main/module.h"
|
||||
#include "terminal/kbd.h"
|
||||
#include "util/memory.h"
|
||||
#include "util/string.h"
|
||||
@ -515,8 +516,8 @@ static struct action_list action_table[KEYMAP_MAX] = {
|
||||
#undef ACTION_
|
||||
|
||||
|
||||
void
|
||||
init_keymaps(void)
|
||||
static void
|
||||
init_keymaps(struct module *xxx)
|
||||
{
|
||||
enum keymap_id keymap_id;
|
||||
|
||||
@ -527,8 +528,8 @@ init_keymaps(void)
|
||||
add_default_keybindings();
|
||||
}
|
||||
|
||||
void
|
||||
free_keymaps(void)
|
||||
static void
|
||||
free_keymaps(struct module *xxx)
|
||||
{
|
||||
enum keymap_id keymap_id;
|
||||
|
||||
@ -948,3 +949,13 @@ bind_config_string(struct string *file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct module kbdbind_module = struct_module(
|
||||
/* name: */ "Keyboard Bindings",
|
||||
/* options: */ NULL,
|
||||
/* hooks: */ NULL,
|
||||
/* submodules: */ NULL,
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_keymaps,
|
||||
/* done: */ free_keymaps
|
||||
);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "util/string.h"
|
||||
|
||||
struct listbox_item;
|
||||
struct module;
|
||||
|
||||
/* Used for holding enum <keymap>_action values. */
|
||||
typedef long action_id_T;
|
||||
@ -114,9 +115,6 @@ struct keybinding {
|
||||
};
|
||||
|
||||
|
||||
void init_keymaps(void);
|
||||
void free_keymaps(void);
|
||||
|
||||
struct keybinding *add_keybinding(enum keymap_id keymap_id, action_id_T action_id, struct term_event_keyboard *kbd, int event);
|
||||
int keybinding_exists(enum keymap_id keymap_id, struct term_event_keyboard *kbd, action_id_T *action_id);
|
||||
void free_keybinding(struct keybinding *);
|
||||
@ -207,4 +205,6 @@ unsigned char *get_keystroke(action_id_T action_id, enum keymap_id keymap_id);
|
||||
void add_actions_to_string(struct string *string, action_id_T actions[],
|
||||
enum keymap_id keymap_id, struct terminal *term);
|
||||
|
||||
extern struct module kbdbind_module;
|
||||
|
||||
#endif
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "config/cmdline.h"
|
||||
#include "config/conf.h"
|
||||
#include "config/home.h"
|
||||
#include "config/kbdbind.h"
|
||||
#include "config/options.h"
|
||||
#include "dialogs/menu.h"
|
||||
#include "document/document.h"
|
||||
@ -130,7 +129,6 @@ init(void)
|
||||
register_modules_options(builtin_modules);
|
||||
set_sigcld();
|
||||
get_system_name();
|
||||
init_keymaps();
|
||||
|
||||
/* XXX: OS/2 has some stupid bug and the pipe must be created before
|
||||
* socket :-/. -- Mikulas */
|
||||
@ -283,14 +281,9 @@ terminate_all_subsystems(void)
|
||||
if (init_b) {
|
||||
#ifdef CONFIG_SCRIPTING
|
||||
trigger_event_name("quit");
|
||||
#endif
|
||||
#ifdef CONFIG_MARKS
|
||||
free_marks();
|
||||
#endif
|
||||
free_history_lists();
|
||||
free_auth();
|
||||
done_modules(builtin_modules);
|
||||
done_screen_drivers();
|
||||
done_saved_session_info();
|
||||
}
|
||||
|
||||
@ -298,7 +291,6 @@ terminate_all_subsystems(void)
|
||||
free_charsets_lookup();
|
||||
free_colors_lookup();
|
||||
done_modules(main_modules);
|
||||
free_keymaps();
|
||||
free_conv_table();
|
||||
check_bottom_halves();
|
||||
done_home();
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "bfu/dialog.h"
|
||||
#include "bookmarks/bookmarks.h"
|
||||
#include "config/kbdbind.h"
|
||||
#include "config/timer.h"
|
||||
#include "config/urlhist.h"
|
||||
#include "cookies/cookies.h"
|
||||
@ -27,19 +28,21 @@
|
||||
#include "network/ssl/ssl.h"
|
||||
#include "protocol/protocol.h"
|
||||
#include "scripting/scripting.h"
|
||||
#include "viewer/text/search.h"
|
||||
#include "viewer/timer.h"
|
||||
#include "terminal/terminal.h"
|
||||
#include "viewer/viewer.h"
|
||||
|
||||
|
||||
struct module *main_modules[] = {
|
||||
&document_module,
|
||||
&kbdbind_module,
|
||||
&terminal_module,
|
||||
NULL /* XXX: Keep this */
|
||||
};
|
||||
|
||||
/* This is also used for version string composing so keep NULL terminated */
|
||||
struct module *builtin_modules[] = {
|
||||
&periodic_saving_module,
|
||||
&timer_module,
|
||||
&viewer_module,
|
||||
#ifdef CONFIG_CSS
|
||||
&css_module,
|
||||
#endif
|
||||
@ -73,7 +76,6 @@ struct module *builtin_modules[] = {
|
||||
&exmode_module,
|
||||
#endif
|
||||
&goto_url_history_module,
|
||||
&search_history_module,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -74,7 +74,11 @@ void done_module(struct module *module);
|
||||
|
||||
/* Interface for handling builtin modules */
|
||||
|
||||
/* Builtin modules are initialised only when not connecting to a master
|
||||
* terminal. */
|
||||
extern struct module *builtin_modules[];
|
||||
|
||||
/* Main modules are initialised earlier and are not listed in Help -> About. */
|
||||
extern struct module *main_modules[];
|
||||
|
||||
void register_modules_options(struct module *modules[]);
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "bfu/hierbox.h"
|
||||
#include "intl/gettext/libintl.h"
|
||||
#include "main/module.h"
|
||||
#include "protocol/auth/auth.h"
|
||||
#include "protocol/auth/dialogs.h"
|
||||
#include "protocol/protocol.h"
|
||||
@ -305,6 +306,12 @@ free_auth(void)
|
||||
free_list(questions_queue);
|
||||
}
|
||||
|
||||
static void
|
||||
done_auth(struct module *xxx)
|
||||
{
|
||||
free_auth();
|
||||
}
|
||||
|
||||
struct auth_entry *
|
||||
get_invalid_auth_entry(void)
|
||||
{
|
||||
@ -320,3 +327,13 @@ get_invalid_auth_entry(void)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct module auth_module = struct_module(
|
||||
/* name: */ "HTTP Authentication",
|
||||
/* options: */ NULL,
|
||||
/* hooks: */ NULL,
|
||||
/* submodules: */ NULL,
|
||||
/* data: */ NULL,
|
||||
/* init: */ NULL,
|
||||
/* done: */ done_auth
|
||||
);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "util/lists.h"
|
||||
|
||||
struct listbox_item;
|
||||
struct module;
|
||||
|
||||
struct auth_entry {
|
||||
OBJECT_HEAD(struct auth_entry);
|
||||
@ -41,4 +42,6 @@ void del_auth_entry(struct auth_entry *);
|
||||
void free_auth(void);
|
||||
struct auth_entry *get_invalid_auth_entry(void);
|
||||
|
||||
extern struct module auth_module;
|
||||
|
||||
#endif
|
||||
|
@ -114,20 +114,14 @@ update_bittorrent_connection_state(struct connection *conn)
|
||||
continue;
|
||||
|
||||
if (min_uploads < max_uploads) {
|
||||
if (peer->remote.choked)
|
||||
unchoke_bittorrent_peer(peer);
|
||||
|
||||
peer->remote.choked = 0;
|
||||
unchoke_bittorrent_peer(peer);
|
||||
|
||||
/* Uninterested peers are not counted as uploads. */
|
||||
if (peer->remote.interested)
|
||||
max_uploads--;
|
||||
|
||||
} else {
|
||||
if (!peer->remote.choked)
|
||||
choke_bittorrent_peer(peer);
|
||||
|
||||
peer->remote.choked = 1;
|
||||
choke_bittorrent_peer(peer);
|
||||
}
|
||||
|
||||
/* Can remove the peer so we use foreachsafe(). */
|
||||
|
@ -26,6 +26,7 @@
|
||||
/* Backends dynamic area: */
|
||||
|
||||
#include "protocol/about.h"
|
||||
#include "protocol/auth/auth.h"
|
||||
#include "protocol/bittorrent/bittorrent.h"
|
||||
#include "protocol/bittorrent/connection.h"
|
||||
#include "protocol/data.h"
|
||||
@ -273,6 +274,7 @@ static struct option_info protocol_options[] = {
|
||||
NULL_OPTION_INFO,
|
||||
};
|
||||
static struct module *protocol_submodules[] = {
|
||||
&auth_module,
|
||||
#ifdef CONFIG_BITTORRENT
|
||||
&bittorrent_protocol_module,
|
||||
#endif
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "config/options.h"
|
||||
#include "intl/charsets.h"
|
||||
#include "main/module.h"
|
||||
#include "osdep/ascii.h"
|
||||
#include "osdep/osdep.h"
|
||||
#include "terminal/color.h"
|
||||
@ -305,8 +306,9 @@ get_screen_driver(struct terminal *term)
|
||||
return add_screen_driver(type, term, len);
|
||||
}
|
||||
|
||||
/* Release private screen drawing utilities. */
|
||||
void
|
||||
done_screen_drivers(void)
|
||||
done_screen_drivers(struct module *xxx)
|
||||
{
|
||||
free_list(active_screen_drivers);
|
||||
}
|
||||
@ -776,3 +778,13 @@ done_screen(struct terminal_screen *screen)
|
||||
mem_free_if(screen->image);
|
||||
mem_free(screen);
|
||||
}
|
||||
|
||||
struct module terminal_screen_module = struct_module(
|
||||
/* name: */ "Terminal Screen",
|
||||
/* options: */ NULL,
|
||||
/* hooks: */ NULL,
|
||||
/* submodules: */ NULL,
|
||||
/* data: */ NULL,
|
||||
/* init: */ NULL,
|
||||
/* done: */ done_screen_drivers
|
||||
);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define EL__TERMINAL_SCREEN_H
|
||||
|
||||
|
||||
struct module;
|
||||
struct screen_char;
|
||||
struct terminal;
|
||||
|
||||
@ -49,7 +50,6 @@ void erase_screen(struct terminal *term);
|
||||
/* Meeep! */
|
||||
void beep_terminal(struct terminal *term);
|
||||
|
||||
/* Release private screen drawing utilities. */
|
||||
void done_screen_drivers(void);
|
||||
extern struct module terminal_screen_module;
|
||||
|
||||
#endif
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "config/options.h"
|
||||
#include "intl/gettext/libintl.h"
|
||||
#include "main/main.h"
|
||||
#include "main/module.h"
|
||||
#include "main/object.h"
|
||||
#include "main/select.h"
|
||||
#include "osdep/osdep.h"
|
||||
@ -370,3 +371,18 @@ attach_terminal(int in, int out, int ctl, void *info, int len)
|
||||
|
||||
return term;
|
||||
}
|
||||
|
||||
static struct module *terminal_submodules[] = {
|
||||
&terminal_screen_module,
|
||||
NULL
|
||||
};
|
||||
|
||||
struct module terminal_module = struct_module(
|
||||
/* name: */ "Terminal",
|
||||
/* options: */ NULL,
|
||||
/* hooks: */ NULL,
|
||||
/* submodules: */ terminal_submodules,
|
||||
/* data: */ NULL,
|
||||
/* init: */ NULL,
|
||||
/* done: */ NULL
|
||||
);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "terminal/event.h"
|
||||
#include "util/lists.h"
|
||||
|
||||
struct module;
|
||||
struct option;
|
||||
struct terminal_screen;
|
||||
struct terminal_interlink;
|
||||
@ -178,4 +179,6 @@ int check_terminal_pipes(void);
|
||||
void close_terminal_pipes(void);
|
||||
struct terminal *attach_terminal(int in, int out, int ctl, void *info, int len);
|
||||
|
||||
extern struct module terminal_module;
|
||||
|
||||
#endif /* EL__TERMINAL_TERMINAL_H */
|
||||
|
@ -2,6 +2,6 @@ top_builddir=../..
|
||||
include $(top_builddir)/Makefile.config
|
||||
|
||||
SUBDIRS = dump text
|
||||
OBJS = action.o timer.o
|
||||
OBJS = action.o timer.o viewer.o
|
||||
|
||||
include $(top_srcdir)/Makefile.lib
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "elinks.h"
|
||||
|
||||
#include "document/view.h"
|
||||
#include "main/module.h"
|
||||
#include "protocol/uri.h"
|
||||
#include "util/memory.h"
|
||||
#include "util/string.h"
|
||||
@ -136,8 +137,8 @@ set_mark(unsigned char mark, struct view_state *mark_vs)
|
||||
marks[i] = vs;
|
||||
}
|
||||
|
||||
void
|
||||
free_marks(void)
|
||||
static void
|
||||
done_marks(struct module *xxx)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -145,3 +146,13 @@ free_marks(void)
|
||||
free_mark_by_index(i);
|
||||
}
|
||||
}
|
||||
|
||||
struct module viewer_marks_module = struct_module(
|
||||
/* name: */ "Marks",
|
||||
/* options: */ NULL,
|
||||
/* hooks: */ NULL,
|
||||
/* submodules: */ NULL,
|
||||
/* data: */ NULL,
|
||||
/* init: */ NULL,
|
||||
/* done: */ done_marks
|
||||
);
|
||||
|
@ -2,11 +2,12 @@
|
||||
#ifndef EL__VIEWER_TEXT_MARKS_H
|
||||
#define EL__VIEWER_TEXT_MARKS_H
|
||||
|
||||
struct module;
|
||||
struct view_state;
|
||||
|
||||
void goto_mark(unsigned char mark, struct view_state *vs);
|
||||
void set_mark(unsigned char mark, struct view_state *vs);
|
||||
|
||||
void free_marks(void);
|
||||
extern struct module viewer_marks_module;
|
||||
|
||||
#endif
|
||||
|
31
src/viewer/viewer.c
Normal file
31
src/viewer/viewer.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* Viewer module */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "elinks.h"
|
||||
|
||||
#include "intl/gettext/libintl.h"
|
||||
#include "main/module.h"
|
||||
#include "viewer/text/marks.h"
|
||||
#include "viewer/text/search.h"
|
||||
#include "viewer/timer.h"
|
||||
|
||||
static struct module *viewer_submodules[] = {
|
||||
&search_history_module,
|
||||
&timer_module,
|
||||
#ifdef CONFIG_MARKS
|
||||
&viewer_marks_module,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct module viewer_module = struct_module(
|
||||
/* name: */ N_("Viewer"),
|
||||
/* options: */ NULL,
|
||||
/* hooks: */ NULL,
|
||||
/* submodules: */ viewer_submodules,
|
||||
/* data: */ NULL,
|
||||
/* init: */ NULL,
|
||||
/* done: */ NULL
|
||||
);
|
8
src/viewer/viewer.h
Normal file
8
src/viewer/viewer.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef EL__VIEWER_VIEWER_H
|
||||
#define EL__VIEWER_VIEWER_H
|
||||
|
||||
struct module;
|
||||
|
||||
extern struct module viewer_module;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user