Update 401 login window to use event callbacks

This commit is contained in:
Chris Young 2016-12-31 00:30:42 +00:00
parent d90e82d3f1
commit d9c8d1c70c
3 changed files with 15 additions and 10 deletions

View File

@ -1974,7 +1974,7 @@ static void ami_handle_msg(void)
continue;
}
} else if(node->Type == AMINS_LOGINWINDOW) {
if(ami_401login_event((struct gui_login_window *)w)) {
if(w->tbl->event(w)) {
ami_try_quit();
break;
} else {

View File

@ -50,7 +50,7 @@
#include "amiga/login.h"
struct gui_login_window {
struct nsObject *node;
struct ami_generic_window w;
struct Window *win;
Object *objects[GID_LAST];
nserror (*cb)(bool proceed, void *pw);
@ -62,6 +62,14 @@ struct gui_login_window {
char pwd[256];
};
static BOOL ami_401login_event(void *w);
static const struct ami_win_event_table ami_login_table = {
ami_401login_event,
NULL, /* we don't explicitly close the login window at all.
@todo check if this prevents us from quitting NetSurf */
};
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
@ -168,9 +176,7 @@ void gui_401login_open(nsurl *url, const char *realm,
EndWindow;
lw->win = (struct Window *)RA_OpenWindow(lw->objects[OID_MAIN]);
lw->node = AddObject(window_list,AMINS_LOGINWINDOW);
lw->node->objstruct = lw;
ami_gui_win_list_add(lw, AMINS_LOGINWINDOW, &ami_login_table);
}
static void ami_401login_close(struct gui_login_window *lw)
@ -182,7 +188,7 @@ static void ami_401login_close(struct gui_login_window *lw)
DisposeObject(lw->objects[OID_MAIN]);
lwc_string_unref(lw->host);
nsurl_unref(lw->url);
DelObject(lw->node);
ami_gui_win_list_remove(lw);
}
static void ami_401login_login(struct gui_login_window *lw)
@ -206,9 +212,10 @@ static void ami_401login_login(struct gui_login_window *lw)
ami_401login_close(lw);
}
BOOL ami_401login_event(struct gui_login_window *lw)
static BOOL ami_401login_event(void *w)
{
/* return TRUE if window destroyed */
struct gui_login_window *lw = (struct gui_login_window *)w;
ULONG result;
uint16 code;

View File

@ -23,9 +23,7 @@
struct gui_login_window;
BOOL ami_401login_event(struct gui_login_window *lw);
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
#endif