mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-09 04:22:12 +03:00
Update GUI options window to use event callback
This commit is contained in:
parent
47379c0444
commit
6ba5edaede
@ -1957,7 +1957,7 @@ static void ami_handle_msg(void)
|
||||
continue;
|
||||
}
|
||||
} else if(node->Type == AMINS_GUIOPTSWINDOW) {
|
||||
if(ami_gui_opts_event()) {
|
||||
if(w->tbl->event(w)) {
|
||||
/* last window possibly closed, so exit with conditions ;) */
|
||||
if(scrn) ami_try_quit();
|
||||
break;
|
||||
@ -2958,6 +2958,7 @@ void ami_quit_netsurf(void)
|
||||
struct nsObject *node;
|
||||
struct nsObject *nnode;
|
||||
struct ami_generic_window *w;
|
||||
struct gui_window_2 *gwin;
|
||||
|
||||
/* Disable the multiple tabs open warning */
|
||||
nsoption_set_bool(tab_close_warn, false);
|
||||
@ -2977,12 +2978,13 @@ void ami_quit_netsurf(void)
|
||||
case AMINS_WINDOW:
|
||||
/* This also closes windows that are attached to the
|
||||
* gui_window, such as local history and find. */
|
||||
//ShowWindow(gwin->win, WINDOW_BACKMOST); // do we need this??
|
||||
gwin = (struct gui_window_2 *)w;
|
||||
ShowWindow(gwin->win, WINDOW_BACKMOST); // do we need this??
|
||||
w->tbl->close(w);
|
||||
break;
|
||||
|
||||
case AMINS_GUIOPTSWINDOW:
|
||||
ami_gui_opts_close();
|
||||
w->tbl->close(w);
|
||||
break;
|
||||
|
||||
case AMINS_DLWINDOW:
|
||||
|
@ -220,7 +220,7 @@ enum {
|
||||
};
|
||||
|
||||
struct ami_gui_opts_window {
|
||||
struct nsObject *node;
|
||||
struct ami_generic_window w;
|
||||
struct Window *win;
|
||||
Object *objects[GID_OPTS_LAST];
|
||||
#ifndef __amigaos4__
|
||||
@ -233,6 +233,14 @@ struct ami_gui_opts_window {
|
||||
#endif
|
||||
};
|
||||
|
||||
static BOOL ami_gui_opts_event(void *w);
|
||||
static void ami_gui_opts_close(void *w);
|
||||
|
||||
static const struct ami_win_event_table ami_guiopts_table = {
|
||||
ami_gui_opts_event,
|
||||
ami_gui_opts_close,
|
||||
};
|
||||
|
||||
static struct ami_gui_opts_window *gow = NULL;
|
||||
|
||||
static CONST_STRPTR tabs[OPTS_MAX_TABS];
|
||||
@ -1667,8 +1675,7 @@ void ami_gui_opts_open(void)
|
||||
EndWindow;
|
||||
|
||||
gow->win = (struct Window *)RA_OpenWindow(gow->objects[OID_MAIN]);
|
||||
gow->node = AddObject(window_list,AMINS_GUIOPTSWINDOW);
|
||||
gow->node->objstruct = gow;
|
||||
ami_gui_win_list_add(gow, AMINS_GUIOPTSWINDOW, &ami_guiopts_table);
|
||||
}
|
||||
ami_utf8_free(homepage_url_lc);
|
||||
}
|
||||
@ -2063,15 +2070,15 @@ static void ami_gui_opts_use(bool save)
|
||||
ami_update_pointer(gow->win, GUI_POINTER_DEFAULT);
|
||||
}
|
||||
|
||||
void ami_gui_opts_close(void)
|
||||
static void ami_gui_opts_close(void *w)
|
||||
{
|
||||
DisposeObject(gow->objects[OID_MAIN]);
|
||||
ami_gui_opts_free(gow);
|
||||
DelObject(gow->node);
|
||||
ami_gui_win_list_remove(gow);
|
||||
gow = NULL;
|
||||
}
|
||||
|
||||
BOOL ami_gui_opts_event(void)
|
||||
static BOOL ami_gui_opts_event(void *w)
|
||||
{
|
||||
/* return TRUE if window destroyed */
|
||||
ULONG result,data = 0;
|
||||
@ -2083,7 +2090,7 @@ BOOL ami_gui_opts_event(void)
|
||||
switch(result & WMHI_CLASSMASK) // class
|
||||
{
|
||||
case WMHI_CLOSEWINDOW:
|
||||
ami_gui_opts_close();
|
||||
ami_gui_opts_close(gow);
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
@ -2102,7 +2109,7 @@ BOOL ami_gui_opts_event(void)
|
||||
{
|
||||
case GID_OPTS_SAVE:
|
||||
ami_gui_opts_use(true);
|
||||
ami_gui_opts_close();
|
||||
ami_gui_opts_close(gow);
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
@ -2111,7 +2118,7 @@ BOOL ami_gui_opts_event(void)
|
||||
// fall through
|
||||
|
||||
case GID_OPTS_CANCEL:
|
||||
ami_gui_opts_close();
|
||||
ami_gui_opts_close(gow);
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
#define AMIGA_GUI_OPTIONS_H
|
||||
/* Prefs GUI control */
|
||||
void ami_gui_opts_open(void);
|
||||
BOOL ami_gui_opts_event(void);
|
||||
void ami_gui_opts_close(void);
|
||||
|
||||
/* Web search list */
|
||||
struct List *ami_gui_opts_websearch(void);
|
||||
|
Loading…
Reference in New Issue
Block a user