From d3c392c3d3b516f05fbf71020b2f6774ce20ce8c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 11 Jan 2014 14:20:30 +0000 Subject: Initial conversion of netsurf gui to callback vtable --- cocoa/NetsurfApp.m | 2 +- cocoa/gui.h | 2 ++ cocoa/gui.m | 13 +++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'cocoa') diff --git a/cocoa/NetsurfApp.m b/cocoa/NetsurfApp.m index 33e3bfa43..844904f1c 100644 --- a/cocoa/NetsurfApp.m +++ b/cocoa/NetsurfApp.m @@ -203,7 +203,7 @@ int main( int argc, char **argv ) nsoption_commandline(&argc, argv, NULL); /* common initialisation */ - error = netsurf_init(messages); + error = netsurf_init(messages, cocoa_gui_table); if (error != NSERROR_OK) { die("NetSurf failed to initialise"); } diff --git a/cocoa/gui.h b/cocoa/gui.h index 413727fe6..6ceefa848 100644 --- a/cocoa/gui.h +++ b/cocoa/gui.h @@ -27,3 +27,5 @@ extern NSString * const kAlwaysCancelDownload; extern NSString * const kAlwaysCloseMultipleTabs; void cocoa_autorelease( void ); + +extern struct gui_table *cocoa_gui_table; diff --git a/cocoa/gui.m b/cocoa/gui.m index 72f64bf04..425bd9cb7 100644 --- a/cocoa/gui.m +++ b/cocoa/gui.m @@ -55,7 +55,7 @@ nsurl *gui_get_resource_url(const char *path) return url; } -void gui_poll(bool active) +static void gui_poll(bool active) { cocoa_autorelease(); @@ -68,11 +68,6 @@ void gui_poll(bool active) } } -void gui_quit(void) -{ - // nothing to do -} - struct browser_window; struct gui_window *gui_create_browser_window(struct browser_window *bw, @@ -332,3 +327,9 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl, /* browser_window_set_gadget_filename(bw, gadget, "filename"); */ } +static struct gui_table gui_table = { + .poll = &gui_poll, +}; + +struct gui_table *cocoa_gui_table = &gui_table; + -- cgit v1.2.3