2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2004-02-13 19:09:12 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
2002-09-11 18:24:02 +04:00
|
|
|
*/
|
|
|
|
|
2003-11-06 22:41:41 +03:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
2004-01-05 05:10:59 +03:00
|
|
|
#include "netsurf/utils/config.h"
|
2003-12-28 04:00:58 +03:00
|
|
|
#include "netsurf/content/cache.h"
|
|
|
|
#include "netsurf/content/fetch.h"
|
|
|
|
#include "netsurf/content/fetchcache.h"
|
2003-06-02 03:02:56 +04:00
|
|
|
#include "netsurf/desktop/options.h"
|
2002-09-11 18:24:02 +04:00
|
|
|
#include "netsurf/desktop/netsurf.h"
|
|
|
|
#include "netsurf/desktop/browser.h"
|
|
|
|
#include "netsurf/desktop/gui.h"
|
2003-02-09 15:58:15 +03:00
|
|
|
#include "netsurf/utils/log.h"
|
2003-12-28 05:35:46 +03:00
|
|
|
#include "netsurf/utils/utils.h"
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2003-11-06 22:41:41 +03:00
|
|
|
bool netsurf_quit = false;
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2003-03-04 14:59:36 +03:00
|
|
|
static void netsurf_init(int argc, char** argv);
|
2003-11-06 22:41:41 +03:00
|
|
|
static void netsurf_poll(void);
|
2003-03-04 14:59:36 +03:00
|
|
|
static void netsurf_exit(void);
|
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2003-11-06 22:41:41 +03:00
|
|
|
/**
|
|
|
|
* Gui NetSurf main().
|
|
|
|
*/
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
2002-09-11 18:24:02 +04:00
|
|
|
{
|
2003-11-06 22:41:41 +03:00
|
|
|
netsurf_init(argc, argv);
|
|
|
|
|
|
|
|
while (!netsurf_quit)
|
|
|
|
netsurf_poll();
|
|
|
|
|
|
|
|
netsurf_exit();
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
2002-09-11 18:24:02 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-06 22:41:41 +03:00
|
|
|
/**
|
|
|
|
* Initialise components used by gui NetSurf.
|
|
|
|
*/
|
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
void netsurf_init(int argc, char** argv)
|
|
|
|
{
|
2002-10-08 13:38:29 +04:00
|
|
|
stdout = stderr;
|
2002-09-11 18:24:02 +04:00
|
|
|
gui_init(argc, argv);
|
2003-02-09 15:58:15 +03:00
|
|
|
fetch_init();
|
2002-11-03 12:39:53 +03:00
|
|
|
cache_init();
|
2003-12-27 23:15:23 +03:00
|
|
|
fetchcache_init();
|
2004-01-25 23:13:51 +03:00
|
|
|
#ifdef WITH_JPEG
|
|
|
|
nsjpeg_init();
|
|
|
|
#endif
|
2004-01-05 05:10:59 +03:00
|
|
|
#ifdef WITH_PNG
|
2003-05-10 15:15:49 +04:00
|
|
|
nspng_init();
|
2004-01-05 05:10:59 +03:00
|
|
|
#endif
|
|
|
|
#ifdef WITH_GIF
|
2003-06-05 17:17:55 +04:00
|
|
|
nsgif_init();
|
2004-01-05 05:10:59 +03:00
|
|
|
#endif
|
2002-11-03 12:39:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-06 22:41:41 +03:00
|
|
|
/**
|
|
|
|
* Poll components which require it.
|
|
|
|
*/
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2003-11-06 22:41:41 +03:00
|
|
|
void netsurf_poll(void)
|
2002-09-11 18:24:02 +04:00
|
|
|
{
|
2003-11-06 22:41:41 +03:00
|
|
|
gui_poll(fetch_active);
|
|
|
|
fetch_poll();
|
|
|
|
}
|
2002-09-11 18:24:02 +04:00
|
|
|
|
|
|
|
|
2003-11-06 22:41:41 +03:00
|
|
|
/**
|
|
|
|
* Clean up components used by gui NetSurf.
|
|
|
|
*/
|
2002-10-15 14:41:12 +04:00
|
|
|
|
2003-11-06 22:41:41 +03:00
|
|
|
void netsurf_exit(void)
|
|
|
|
{
|
|
|
|
cache_quit();
|
|
|
|
fetch_quit();
|
2004-01-05 05:10:59 +03:00
|
|
|
#ifdef WITH_COOKIES
|
2003-12-28 05:35:46 +03:00
|
|
|
clean_cookiejar();
|
2004-01-05 05:10:59 +03:00
|
|
|
#endif
|
2003-11-08 02:51:13 +03:00
|
|
|
gui_quit();
|
2002-09-11 18:24:02 +04:00
|
|
|
}
|