diff options
Diffstat (limited to 'frontends/atari/gui.c')
-rw-r--r-- | frontends/atari/gui.c | 104 |
1 files changed, 42 insertions, 62 deletions
diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c index 6ee63b301..3b324f507 100644 --- a/frontends/atari/gui.c +++ b/frontends/atari/gui.c @@ -29,6 +29,7 @@ #include "utils/log.h" #include "utils/messages.h" #include "utils/corestrings.h" +#include "utils/nsoption.h" #include "netsurf/browser_window.h" #include "netsurf/layout.h" #include "netsurf/window.h" @@ -52,9 +53,7 @@ #include "atari/toolbar.h" #include "atari/hotlist.h" #include "atari/cookies.h" -#include "atari/certview.h" #include "atari/history.h" -#include "atari/login.h" #include "atari/encoding.h" #include "atari/res/netsurf.rsh" #include "atari/plot/plot.h" @@ -299,15 +298,11 @@ void gui_window_destroy(struct gui_window *gw) * \param gw The gui window to measure content area of. * \param width receives width of window * \param height receives height of window - * \param scaled whether to return scaled values * \return NSERROR_OK on sucess and width and height updated * else error code. */ static nserror -gui_window_get_dimensions(struct gui_window *gw, - int *width, - int *height, - bool scaled) +gui_window_get_dimensions(struct gui_window *gw, int *width, int *height) { GRECT rect; window_get_grect(gw->root, BROWSER_AREA_CONTENT, &rect); @@ -766,53 +761,6 @@ static void gui_set_clipboard(const char *buffer, size_t length, } } -static void gui_401login_open(nsurl *url, const char *realm, - nserror (*cb)(bool proceed, void *pw), void *cbpw) -{ - bool bres; - char * out = NULL; - bres = login_form_do( url, (char*)realm, &out); - if (bres) { - NSLOG(netsurf, INFO, "url: %s, realm: %s, auth: %s\n", - nsurl_access(url), realm, out); - urldb_set_auth_details(url, realm, out); - } - if (out != NULL) { - free( out ); - } - if (cb != NULL) { - cb(bres, cbpw); - } - -} - -static nserror -gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, - unsigned long num, nserror (*cb)(bool proceed, void *pw), - void *cbpw) -{ - struct sslcert_session_data *data; - NSLOG(netsurf, INFO, "url %s", nsurl_access(url)); - - // TODO: localize string - int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort|Details...]"); - if(b == 1){ - // Accept - urldb_set_cert_permissions(url, true); - cb(true, cbpw); - } else if(b == 2) { - // Reject - urldb_set_cert_permissions(url, false); - cb(false, cbpw); - } else if(b == 3) { - // Inspect - sslcert_viewer_create_session_data(num, url, cb, cbpw, certs, - &data); - atari_sslcert_viewer_open(data); - } - return NSERROR_OK; -} - void gui_set_input_gui_window(struct gui_window *gw) { NSLOG(netsurf, INFO, "Setting input window from: %p to %p\n", @@ -1065,6 +1013,45 @@ static void gui_init(int argc, char** argv) toolbar_init(); } + +/** + * process miscellaneous window events + * + * \param gw The window receiving the event. + * \param event The event code. + * \return NSERROR_OK when processed ok + */ +static nserror +gui_window_event(struct gui_window *gw, enum gui_window_event event) +{ + switch (event) { + case GW_EVENT_UPDATE_EXTENT: + gui_window_update_extent(gw); + break; + + case GW_EVENT_REMOVE_CARET: + gui_window_remove_caret(gw); + break; + + case GW_EVENT_NEW_CONTENT: + gui_window_new_content(gw); + break; + + case GW_EVENT_START_THROBBER: + gui_window_start_throbber(gw); + break; + + case GW_EVENT_STOP_THROBBER: + gui_window_stop_throbber(gw); + break; + + default: + break; + } + return NSERROR_OK; +} + + static struct gui_window_table atari_window_table = { .create = gui_window_create, .destroy = gui_window_destroy, @@ -1072,7 +1059,7 @@ static struct gui_window_table atari_window_table = { .get_scroll = gui_window_get_scroll, .set_scroll = gui_window_set_scroll, .get_dimensions = gui_window_get_dimensions, - .update_extent = gui_window_update_extent, + .event = gui_window_event, .set_title = gui_window_set_title, .set_url = gui_window_set_url, @@ -1080,10 +1067,6 @@ static struct gui_window_table atari_window_table = { .set_status = atari_window_set_status, .set_pointer = gui_window_set_pointer, .place_caret = gui_window_place_caret, - .remove_caret = gui_window_remove_caret, - .new_content = gui_window_new_content, - .start_throbber = gui_window_start_throbber, - .stop_throbber = gui_window_stop_throbber, }; static struct gui_clipboard_table atari_clipboard_table = { @@ -1099,11 +1082,8 @@ static struct gui_fetch_table atari_fetch_table = { static struct gui_misc_table atari_misc_table = { .schedule = atari_schedule, - .warning = atari_warn_user, .quit = gui_quit, - .cert_verify = gui_cert_verify, - .login = gui_401login_open, }; /* #define WITH_DBG_LOGFILE 1 */ |