mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-24 13:06:49 +03:00
[project @ 2004-10-17 22:13:34 by jmb]
Lose hard-coded stylesheet URLs. svn path=/import/netsurf/; revision=1323
This commit is contained in:
parent
892a348b73
commit
fff5f231ed
@ -16,19 +16,43 @@
|
||||
#include "netsurf/desktop/browser.h"
|
||||
#include "netsurf/desktop/gui.h"
|
||||
#include "netsurf/desktop/netsurf.h"
|
||||
#include "netsurf/desktop/options.h"
|
||||
#include "netsurf/render/box.h"
|
||||
#include "netsurf/render/form.h"
|
||||
#include "netsurf/render/html.h"
|
||||
#include "netsurf/utils/messages.h"
|
||||
#include "netsurf/utils/utils.h"
|
||||
|
||||
|
||||
bool gui_in_multitask = false;
|
||||
|
||||
char *default_stylesheet_url;
|
||||
char *adblock_stylesheet_url;
|
||||
|
||||
|
||||
void gui_init(int argc, char** argv)
|
||||
{
|
||||
char *home;
|
||||
char buf[1024];
|
||||
|
||||
/* All our resources are stored in ~/.netsurf/ */
|
||||
home = getenv("HOME");
|
||||
if (!home)
|
||||
die("Couldn't find HOME");
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
messages_load("messages");
|
||||
|
||||
snprintf(buf, sizeof buf, "%s/.netsurf/Choices", home);
|
||||
options_read(buf);
|
||||
|
||||
snprintf(buf, sizeof buf, "%s/.netsurf/messages", home);
|
||||
messages_load(buf);
|
||||
|
||||
/* set up stylesheet urls */
|
||||
snprintf(buf, sizeof buf, "file:///%s/.netsurf/Default.css", home);
|
||||
default_stylesheet_url = strdup(buf);
|
||||
snprintf(buf, sizeof buf, "file:///%s/.netsurf/AdBlock.css", home);
|
||||
adblock_stylesheet_url = strdup(buf);
|
||||
}
|
||||
|
||||
|
||||
@ -55,6 +79,8 @@ void gui_multitask(void)
|
||||
|
||||
void gui_quit(void)
|
||||
{
|
||||
free(default_stylesheet_url);
|
||||
free(adblock_stylesheet_url);
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,9 +20,7 @@
|
||||
#include "netsurf/content/fetch.h"
|
||||
#include "netsurf/content/fetchcache.h"
|
||||
#include "netsurf/desktop/imagemap.h"
|
||||
#ifdef riscos
|
||||
#include "netsurf/desktop/gui.h"
|
||||
#endif
|
||||
#include "netsurf/desktop/options.h"
|
||||
#include "netsurf/render/box.h"
|
||||
#include "netsurf/render/font.h"
|
||||
@ -337,11 +335,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
|
||||
c->active = 0;
|
||||
|
||||
c->data.html.stylesheet_content[STYLESHEET_BASE] = fetchcache(
|
||||
#ifdef riscos
|
||||
"file:/<NetSurf$Dir>/Resources/CSS",
|
||||
#else
|
||||
"file:///home/james/Projects/netsurf/CSS",
|
||||
#endif
|
||||
default_stylesheet_url,
|
||||
html_convert_css_callback, c,
|
||||
(void *) STYLESHEET_BASE, c->width, c->height,
|
||||
true, 0, 0, false);
|
||||
@ -353,11 +347,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
|
||||
|
||||
if (option_block_ads) {
|
||||
c->data.html.stylesheet_content[STYLESHEET_ADBLOCK] = fetchcache(
|
||||
#ifdef riscos
|
||||
"file:/<NetSurf$Dir>/Resources/AdBlock",
|
||||
#else
|
||||
"file:///home/james/Projects/netsurf/AdBlock",
|
||||
#endif
|
||||
adblock_stylesheet_url,
|
||||
html_convert_css_callback, c,
|
||||
(void *) STYLESHEET_ADBLOCK, c->width,
|
||||
c->height, true, 0, 0, false);
|
||||
|
@ -33,6 +33,9 @@ struct plotters;
|
||||
#define STYLESHEET_STYLE 2 /* <style> elements (not cached) */
|
||||
#define STYLESHEET_START 3 /* start of document stylesheets */
|
||||
|
||||
extern char *default_stylesheet_url;
|
||||
extern char *adblock_stylesheet_url;
|
||||
|
||||
/** Data specific to CONTENT_HTML. */
|
||||
struct content_html_data {
|
||||
htmlParserCtxt *parser; /**< HTML parser context. */
|
||||
|
13
riscos/gui.c
13
riscos/gui.c
@ -68,6 +68,9 @@ int __riscosify_control = __RISCOSIFY_NO_SUFFIX |
|
||||
|
||||
char *NETSURF_DIR;
|
||||
|
||||
char *default_stylesheet_url;
|
||||
char *adblock_stylesheet_url;
|
||||
|
||||
/** The pointer is over a window which is tracking mouse movement. */
|
||||
static bool gui_track = false;
|
||||
/** Handle of window which the pointer is over. */
|
||||
@ -196,6 +199,9 @@ void gui_init(int argc, char** argv)
|
||||
messages_load(path);
|
||||
messages_load("<NetSurf$Dir>.Resources.LangNames");
|
||||
|
||||
default_stylesheet_url = strdup("file:/<NetSurf$Dir>/Resources/CSS");
|
||||
adblock_stylesheet_url = strdup("file:/<NetSurf$Dir>/Resources/AdBlock");
|
||||
|
||||
/* Totally pedantic, but base the taskname on the build options.
|
||||
*/
|
||||
#ifndef ncos
|
||||
@ -516,6 +522,8 @@ void gui_quit(void)
|
||||
ro_gui_history_quit();
|
||||
free(gui_sprites);
|
||||
xwimp_close_down(task_handle);
|
||||
free(default_stylesheet_url);
|
||||
free(adblock_stylesheet_url);
|
||||
xhourglass_off();
|
||||
}
|
||||
|
||||
@ -1484,6 +1492,11 @@ void ro_gui_open_help_page(const char *page)
|
||||
|
||||
void ro_gui_view_source(struct content *content)
|
||||
{
|
||||
if (!content || !content->source_data) {
|
||||
warn_user("MiscError", "No document source");
|
||||
return;
|
||||
}
|
||||
|
||||
xosfile_save_stamped("<Wimp$Scrap>", 0xfff,
|
||||
content->source_data,
|
||||
content->source_data + content->source_size);
|
||||
|
Loading…
Reference in New Issue
Block a user