Ejemplo n.º 1
1
/**
 * Entry point from operating system
 **/
int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
{
    char **argv = NULL;
    int argc = 0, argctemp = 0;
    size_t len;
    LPWSTR *argvw;
    char *messages;
    nserror ret;
    struct browser_window *bw;
    const char *addr = NETSURF_HOMEPAGE;

    if (SLEN(lpcli) > 0) {
        argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
    }

    setbuf(stderr, NULL);

    /* Construct a unix style argc/argv */
    argv = malloc(sizeof(char *) * argc);
    while (argctemp < argc) {
        len = wcstombs(NULL, argvw[argctemp], 0) + 1;
        if (len > 0) {
            argv[argctemp] = malloc(len);
        }

        if (argv[argctemp] != NULL) {
            wcstombs(argv[argctemp], argvw[argctemp], len);
            /* alter windows-style forward slash flags to
             * hyphen flags.
             */
            if (argv[argctemp][0] == '/')
                argv[argctemp][0] = '-';
        }
        argctemp++;
    }

    respaths = nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\res:"NETSURF_WINDOWS_RESPATH);

    messages = filepath_find(respaths, "messages");

    options_file_location = filepath_find(respaths, "preferences");

    /* initialise netsurf */
    netsurf_init(&argc, &argv, options_file_location, messages);

    free(messages);

    ret = nsws_create_main_class(hInstance);
    ret = nsws_create_drawable_class(hInstance);
    ret = nsws_create_localhistory_class(hInstance);

    nsoption_set_bool(target_blank, false);

    nsws_window_init_pointers(hInstance);

    /* ensure homepage option has a default */
    nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE));

    /* If there is a url specified on the command line use it */
    if (argc > 1) {
        addr = argv[1];
    } else {
        addr = nsoption_charp(homepage_url);
    }

    LOG(("calling browser_window_create"));
    bw = browser_window_create(addr, 0, 0, true, false);

    netsurf_main_loop();

    netsurf_exit();

    free(options_file_location);

    return 0;
}
Ejemplo n.º 2
0
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
	/* Set defaults for absent option strings */
	nsoption_setnull_charp(cookie_file, strdup("~/.netsurf/Cookies"));
	nsoption_setnull_charp(cookie_jar, strdup("~/.netsurf/Cookies"));

	if (nsoption_charp(cookie_file) == NULL ||
			nsoption_charp(cookie_jar == NULL)) {
		die("Failed initialising cookie options");
	}
}
Ejemplo n.º 3
0
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
	/* Set defaults for absent option strings */

	/* ensure homepage option has a default */
	nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE));
}
Ejemplo n.º 4
0
/**
 * Set option defaults for framebuffer frontend
 *
 * @param defaults The option table to update.
 * @return error status.
 */
static nserror set_defaults(struct nsoption_s *defaults)
{
	/* Set defaults for absent option strings */
	nsoption_setnull_charp(cookie_file, strdup("~/.netsurf/Cookies"));
	nsoption_setnull_charp(cookie_jar, strdup("~/.netsurf/Cookies"));

	if (nsoption_charp(cookie_file) == NULL ||
	    nsoption_charp(cookie_jar) == NULL) {
		LOG(("Failed initialising cookie options"));
		return NSERROR_BAD_PARAMETER;
	}

	/* set system colours for framebuffer ui */
	nsoption_set_colour(sys_colour_ActiveBorder, 0x00000000);
	nsoption_set_colour(sys_colour_ActiveCaption, 0x00ddddcc);
	nsoption_set_colour(sys_colour_AppWorkspace, 0x00eeeeee);
	nsoption_set_colour(sys_colour_Background, 0x00aa0000);
	nsoption_set_colour(sys_colour_ButtonFace, 0x00dddddd);
	nsoption_set_colour(sys_colour_ButtonHighlight, 0x00cccccc);
	nsoption_set_colour(sys_colour_ButtonShadow, 0x00bbbbbb);
	nsoption_set_colour(sys_colour_ButtonText, 0x00000000);
	nsoption_set_colour(sys_colour_CaptionText, 0x00000000);
	nsoption_set_colour(sys_colour_GrayText, 0x00777777);
	nsoption_set_colour(sys_colour_Highlight, 0x00ee0000);
	nsoption_set_colour(sys_colour_HighlightText, 0x00000000);
	nsoption_set_colour(sys_colour_InactiveBorder, 0x00000000);
	nsoption_set_colour(sys_colour_InactiveCaption, 0x00ffffff);
	nsoption_set_colour(sys_colour_InactiveCaptionText, 0x00cccccc);
	nsoption_set_colour(sys_colour_InfoBackground, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_InfoText, 0x00000000);
	nsoption_set_colour(sys_colour_Menu, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_MenuText, 0x00000000);
	nsoption_set_colour(sys_colour_Scrollbar, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_ThreeDDarkShadow, 0x00555555);
	nsoption_set_colour(sys_colour_ThreeDFace, 0x00dddddd);
	nsoption_set_colour(sys_colour_ThreeDHighlight, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_ThreeDLightShadow, 0x00999999);
	nsoption_set_colour(sys_colour_ThreeDShadow, 0x00777777);
	nsoption_set_colour(sys_colour_Window, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_WindowFrame, 0x00000000);
	nsoption_set_colour(sys_colour_WindowText, 0x00000000);

	return NSERROR_OK;
}
Ejemplo n.º 5
0
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
    /* Set defaults for absent option strings */
    nsoption_setnull_charp(cookie_file, strdup("cookies"));
    if (nsoption_charp(cookie_file) == NULL) {
        die("Failed initialising string options");
    }

    nsoption_set_int(min_reflow_period, 350);
}
Ejemplo n.º 6
0
Archivo: gui.c Proyecto: mmuman/NetSurf
/**
 * Set option defaults for atari frontend
 *
 * @param defaults The option table to update.
 * @return error status.
 */
static nserror set_defaults(struct nsoption_s *defaults)
{
    /* Set defaults for absent option strings */
    nsoption_setnull_charp(cookie_file, strdup("cookies"));
    if (nsoption_charp(cookie_file) == NULL) {
	LOG("Failed initialising string options");
	return NSERROR_BAD_PARAMETER;
    }
    return NSERROR_OK;
}
Ejemplo n.º 7
0
Archivo: gui.c Proyecto: mmuman/NetSurf
/**
 * Set option defaults for gtk frontend.
 *
 * @param defaults The option table to update.
 * @return error status.
 */
static nserror set_defaults(struct nsoption_s *defaults)
{
	char *fname;

	/* cookie file default */
	fname = NULL;
	netsurf_mkpath(&fname, NULL, 2, nsgtk_config_home, "Cookies");
	if (fname != NULL) {
		nsoption_setnull_charp(cookie_file, fname);
	}

	/* cookie jar default */
	fname = NULL;
	netsurf_mkpath(&fname, NULL, 2, nsgtk_config_home, "Cookies");
	if (fname != NULL) {
		nsoption_setnull_charp(cookie_jar, fname);
	}

	/* url database default */
	fname = NULL;
	netsurf_mkpath(&fname, NULL, 2, nsgtk_config_home, "URLs");
	if (fname != NULL) {
		nsoption_setnull_charp(url_file, fname);
	}

	/* bookmark database default */
	fname = NULL;
	netsurf_mkpath(&fname, NULL, 2, nsgtk_config_home, "Hotlist");
	if (fname != NULL) {
		nsoption_setnull_charp(hotlist_path, fname);
	}

	/* download directory default */
	fname = getenv("HOME");
	if (fname != NULL) {
		nsoption_setnull_charp(downloads_directory, strdup(fname));
	}

	/* default path to certificates */
	nsoption_setnull_charp(ca_path, strdup("/etc/ssl/certs"));

	if ((nsoption_charp(cookie_file) == NULL) ||
	    (nsoption_charp(cookie_jar) == NULL) ||
	    (nsoption_charp(url_file) == NULL) ||
	    (nsoption_charp(hotlist_path) == NULL) ||
	    (nsoption_charp(downloads_directory) == NULL) ||
	    (nsoption_charp(ca_path) == NULL)) {
		LOG("Failed initialising default resource paths");
		return NSERROR_BAD_PARAMETER;
	}

	/* set default font names */
	nsoption_set_charp(font_sans, strdup("Sans"));
	nsoption_set_charp(font_serif, strdup("Serif"));
	nsoption_set_charp(font_mono, strdup("Monospace"));
	nsoption_set_charp(font_cursive, strdup("Serif"));
	nsoption_set_charp(font_fantasy, strdup("Serif"));

	return NSERROR_OK;
}
Ejemplo n.º 8
0
nserror gui_options_init_defaults(struct nsoption_s *defaults)
{
#if defined(riscos)
	/* Set defaults for absent option strings */
	nsoption_setnull_charp(ca_bundle, strdup("NetSurf:Resources.ca-bundle"));
	nsoption_setnull_charp(cookie_file, strdup("NetSurf:Cookies"));
	nsoption_setnull_charp(cookie_jar, strdup(CHOICES_PREFIX "Cookies"));

	if (nsoption_charp(ca_bundle) == NULL ||
	    nsoption_charp(cookie_file) == NULL ||
	    nsoption_charp(cookie_jar) == NULL) {
		return NSERROR_BAD_PARAMETER;
	}
#elif defined(nsgtk)
	char *hdir = getenv("HOME");
	char buf[PATH_MAX];

	/* Set defaults for absent option strings */
	snprintf(buf, PATH_MAX, "%s/.netsurf/Cookies", hdir);
	nsoption_setnull_charp(cookie_file, strdup(buf));
	nsoption_setnull_charp(cookie_jar, strdup(buf));
	if (nsoption_charp(cookie_file) == NULL ||
	    nsoption_charp(cookie_jar) == NULL) {
		return NSERROR_BAD_PARAMETER;
	}

	if (nsoption_charp(downloads_directory) == NULL) {
		snprintf(buf, PATH_MAX, "%s/", hdir);
		nsoption_set_charp(downloads_directory, strdup(buf));
	}

	if (nsoption_charp(url_file) == NULL) {
		snprintf(buf, PATH_MAX, "%s/.netsurf/URLs", hdir);
		nsoption_set_charp(url_file, strdup(buf));
	}

	if (nsoption_charp(hotlist_path) == NULL) {
		snprintf(buf, PATH_MAX, "%s/.netsurf/Hotlist", hdir);
		nsoption_set_charp(hotlist_path, strdup(buf));
	}

	nsoption_setnull_charp(ca_path, strdup("/etc/ssl/certs"));

	if (nsoption_charp(url_file) == NULL ||
	    nsoption_charp(ca_path) == NULL ||
	    nsoption_charp(downloads_directory) == NULL ||
	    nsoption_charp(hotlist_path) == NULL) {
		return NSERROR_BAD_PARAMETER;
	}

#endif
	return NSERROR_OK;
}