summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-01-08 01:51:33 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-01-08 01:51:33 +0000
commit745deb7a9d4bf26a6339a297c3c06bb12f5cc102 (patch)
tree21fce77c94096ea7a9297a67edde9857492338d4 /riscos
parent5eb7692b8ff2a0b226fa56ee4bb3c2d8f8e98044 (diff)
downloadnetsurf-745deb7a9d4bf26a6339a297c3c06bb12f5cc102.tar.gz
netsurf-745deb7a9d4bf26a6339a297c3c06bb12f5cc102.tar.bz2
[project @ 2006-01-08 01:51:33 by jmb]
Make data file locations user-configurable (no UI for this as yet) Reduce intrusiveness of ncos modifications Fix GTK build Remove Cookies file details from Messages (this data never belonged in there anyway) Make gui_init more robust against memory exhaustion. svn path=/import/netsurf/; revision=2014
Diffstat (limited to 'riscos')
-rw-r--r--riscos/dialog.c30
-rw-r--r--riscos/global_history.c24
-rw-r--r--riscos/gui.c174
-rw-r--r--riscos/hotlist.c17
-rw-r--r--riscos/menus.c10
-rw-r--r--riscos/options.h28
-rw-r--r--riscos/theme.c9
-rw-r--r--riscos/theme.h12
-rw-r--r--riscos/theme_install.c6
9 files changed, 200 insertions, 110 deletions
diff --git a/riscos/dialog.c b/riscos/dialog.c
index 700067a0c..74238b57e 100644
--- a/riscos/dialog.c
+++ b/riscos/dialog.c
@@ -84,15 +84,15 @@ void ro_gui_dialog_init(void)
/* configure window */
ro_gui_configure_initialise();
-
+
/* 401 login window */
#ifdef WITH_AUTH
ro_gui_401login_init();
#endif
-
+
/* hotlist window */
ro_gui_hotlist_initialise();
-
+
/* global history window */
ro_gui_global_history_initialise();
@@ -104,7 +104,7 @@ void ro_gui_dialog_init(void)
ICON_THEME_INSTALL_INSTALL,
ro_gui_theme_install_apply);
ro_gui_wimp_event_set_help_prefix(dialog_theme_install, "HelpThemeInst");
-
+
/* debug window */
dialog_debug = ro_gui_dialog_create("debug");
ro_gui_wimp_event_set_help_prefix(dialog_debug, "HelpDebug");
@@ -113,7 +113,7 @@ void ro_gui_dialog_init(void)
#ifdef WITH_SEARCH
ro_gui_search_init();
#endif
-
+
/* print */
#ifdef WITH_PRINT
ro_gui_print_init();
@@ -141,7 +141,7 @@ void ro_gui_dialog_init(void)
ro_gui_wimp_event_register_ok(dialog_folder, ICON_FOLDER_OK,
ro_gui_hotlist_dialog_apply);
ro_gui_wimp_event_set_help_prefix(dialog_folder, "HelpHotFolder");
-
+
/* hotlist entry editing */
dialog_entry = ro_gui_dialog_create("new_entry");
ro_gui_wimp_event_register_text_field(dialog_entry, ICON_ENTRY_NAME);
@@ -161,7 +161,7 @@ void ro_gui_dialog_init(void)
ro_gui_wimp_event_register_ok(dialog_saveas, ICON_SAVE_OK,
ro_gui_save_ok);
ro_gui_wimp_event_set_help_prefix(dialog_saveas, "HelpSaveAs");
-
+
/* url suggestion */
dialog_url_complete = ro_gui_dialog_create("url_suggest");
ro_gui_wimp_event_register_mouse_click(dialog_url_complete,
@@ -169,7 +169,7 @@ void ro_gui_dialog_init(void)
ro_gui_wimp_event_register_redraw_window(dialog_url_complete,
ro_gui_url_complete_redraw);
ro_gui_wimp_event_set_help_prefix(dialog_url_complete, "HelpAutoURL");
-
+
/* open URL */
dialog_openurl = ro_gui_dialog_create("open_url");
ro_gui_wimp_event_register_menu_gright(dialog_openurl, ICON_OPENURL_URL,
@@ -178,7 +178,7 @@ void ro_gui_dialog_init(void)
ro_gui_wimp_event_register_ok(dialog_openurl, ICON_OPENURL_OPEN,
ro_gui_dialog_openurl_apply);
ro_gui_wimp_event_set_help_prefix(dialog_openurl, "HelpOpenURL");
-
+
/* scale view */
dialog_zoom = ro_gui_dialog_create("zoom");
ro_gui_wimp_event_register_numeric_field(dialog_zoom, ICON_ZOOM_VALUE,
@@ -368,7 +368,7 @@ void ro_gui_dialog_close(wimp_w close)
}
}
}
-
+
error = xwimp_close_window(close);
if (error) {
LOG(("xwimp_close_window: 0x%x: %s",
@@ -381,7 +381,7 @@ void ro_gui_dialog_close(wimp_w close)
/**
* Moves a window to the top of the stack.
- *
+ *
* If the window is currently closed then:
*
* * The window is opened in the centre of the screen (at the supplied size)
@@ -619,13 +619,7 @@ void ro_gui_dialog_close_persistent(wimp_w parent) {
void ro_gui_save_options(void)
{
- /* NCOS doesnt have the fancy Universal Boot vars; so select
- * the path to the choices file based on the build options */
-#ifndef NCOS
- options_write("<Choices$Write>.WWW.NetSurf.Choices");
-#else
- options_write("<User$Path>.Choices.NetSurf.Choices");
-#endif
+ options_write("<NetSurf$ChoicesSave>");
}
diff --git a/riscos/global_history.c b/riscos/global_history.c
index f3a3d0144..cf1f3ab09 100644
--- a/riscos/global_history.c
+++ b/riscos/global_history.c
@@ -23,6 +23,7 @@
#include "netsurf/riscos/global_history.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/menus.h"
+#include "netsurf/riscos/options.h"
#include "netsurf/riscos/theme.h"
#include "netsurf/riscos/treeview.h"
#include "netsurf/riscos/wimp.h"
@@ -35,10 +36,6 @@
#define MAXIMUM_URL_LENGTH 1024
#define MAXIMUM_BASE_NODES 16
-#define GLOBAL_HISTORY_RECENT_READ "Choices:WWW.NetSurf.Recent"
-#define GLOBAL_HISTORY_RECENT_WRITE "<Choices$Write>.WWW.NetSurf.Recent"
-
-
static struct node *global_history_base_node[MAXIMUM_BASE_NODES];
static int global_history_base_node_time[MAXIMUM_BASE_NODES];
static int global_history_base_node_count = 0;
@@ -54,7 +51,6 @@ static void ro_gui_global_history_initialise_node(const char *title,
time_t base, int days_back);
static struct node *ro_gui_global_history_find(const char *url);
-
/* The history window, toolbar and plot origins
*/
static wimp_w global_history_window;
@@ -112,10 +108,10 @@ void ro_gui_global_history_initialise(void) {
global_history_window);
/* load recent URLs */
- fp = fopen(GLOBAL_HISTORY_RECENT_READ, "r");
+ fp = fopen(option_recent_path, "r");
if (!fp)
LOG(("Failed to open file '%s' for reading",
- GLOBAL_HISTORY_RECENT_READ));
+ option_recent_path));
else {
while (fgets(s, MAXIMUM_URL_LENGTH, fp)) {
if (s[strlen(s) - 1] == '\n')
@@ -132,7 +128,7 @@ void ro_gui_global_history_initialise(void) {
url_count++;
if (url_count == 0)
return;
-
+
/* place pointers to the URL data in a single block of memory so
* they can be quickly sorted */
url_block = (struct url_content **)malloc(
@@ -147,17 +143,17 @@ void ro_gui_global_history_initialise(void) {
for (url = hostname->url; url; url = url->next)
url_block[i++] = &url->data;
assert(i == url_count);
-
+
/* sort information by the last_visit information */
qsort(url_block, url_count, sizeof(struct url_content *),
url_store_compare_last_visit);
-
+
/* add URLs to the global history */
global_history_init = true;
for (i = 0; i < url_count; i++)
global_history_add(url_block[i]);
-
- global_history_init = false;
+
+ global_history_init = false;
free(url_block);
}
@@ -234,10 +230,10 @@ void ro_gui_global_history_save(void) {
int i;
/* save recent URLs */
- fp = fopen(GLOBAL_HISTORY_RECENT_WRITE, "w");
+ fp = fopen(option_recent_save, "w");
if (!fp)
LOG(("Failed to open file '%s' for writing",
- GLOBAL_HISTORY_RECENT_WRITE));
+ option_recent_save));
else {
for (i = global_history_recent_count - 1; i >= 0; i--)
if (strlen(global_history_recent_url[i]) <
diff --git a/riscos/gui.c b/riscos/gui.c
index 0c74bb915..163fa68df 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -128,6 +128,15 @@ const char * NETSURF_DIR;
char *default_stylesheet_url;
char *adblock_stylesheet_url;
+#ifndef ncos
+static const char *task_name = "NetSurf";
+#define CHOICES_PREFIX "<Choices$Write>.WWW.NetSurf."
+#else
+static const char *task_name = "NCNetSurf";
+#define CHOICES_PREFIX "<User$Path>.Choices.NetSurf."
+#endif
+
+
/** The pointer is over a window which is tracking mouse movement. */
static bool gui_track = false;
/** Handle of window which the pointer is over. */
@@ -204,10 +213,9 @@ static wimp_MESSAGE_LIST(38) task_messages = { {
0
} };
+static void ro_gui_create_dirs(void);
static void ro_gui_choose_language(void);
-#ifndef ncos
static void ro_gui_icon_bar_create(void);
-#endif
static void ro_gui_signal(int sig);
static void ro_gui_cleanup(void);
static void ro_gui_handle_event(wimp_event_no event, wimp_block *block);
@@ -254,8 +262,9 @@ void gui_init(int argc, char** argv)
xhourglass_start(1);
- /* read OS version for code that adapts to conform to the OS (remember
- that it's preferable to check for specific features being present) */
+ /* read OS version for code that adapts to conform to the OS
+ * (remember that it's preferable to check for specific features
+ * being present) */
xos_byte(osbyte_IN_KEY, 0, 0xff, &os_version, NULL);
atexit(ro_gui_cleanup);
@@ -273,28 +282,14 @@ void gui_init(int argc, char** argv)
prev_sigs.sigterm == SIG_ERR)
die("Failed registering signal handlers");
- /* create our choices directories */
-#ifndef ncos
- xosfile_create_dir("<Choices$Write>.WWW", 0);
- xosfile_create_dir("<Choices$Write>.WWW.NetSurf", 0);
- xosfile_create_dir("<Choices$Write>.WWW.NetSurf.Themes", 0);
-#else
- xosfile_create_dir("<User$Path>.Choices.NetSurf", 0);
- xosfile_create_dir("<User$Path>.Choices.NetSurf.Choices", 0);
- xosfile_create_dir("<User$Path>.Choices.NetSurf.Choices.Themes", 0);
-#endif
ro_filename_initialise();
#ifdef WITH_SAVE_COMPLETE
save_complete_init();
#endif
- /* We don't have the universal boot sequence on NCOS */
-#ifndef ncos
- options_read("Choices:WWW.NetSurf.Choices");
-#else
- options_read("<User$Path>.Choices.NetSurf.Choices");
-#endif
+ options_read("NetSurf:Choices");
+
/* set defaults for absent strings */
if (!option_theme)
option_theme = strdup("Aletheia");
@@ -304,38 +299,72 @@ void gui_init(int argc, char** argv)
option_toolbar_hotlist = strdup("401|23");
if (!option_toolbar_history)
option_toolbar_history = strdup("01|23");
+ if (!option_ca_bundle)
+ option_ca_bundle = strdup("NetSurf:Resources.ca-bundle");
+ if (!option_cookie_file)
+ option_cookie_file = strdup("NetSurf:Cookies");
+ if (!option_cookie_jar)
+ option_cookie_jar = strdup(CHOICES_PREFIX "Cookies");
+ if (!option_url_path)
+ option_url_path = strdup("NetSurf:URL");
+ if (!option_url_save)
+ option_url_save = strdup(CHOICES_PREFIX "URL");
+ if (!option_hotlist_path)
+ option_hotlist_path = strdup("NetSurf:Hotlist");
+ if (!option_hotlist_save)
+ option_hotlist_save = strdup(CHOICES_PREFIX "Hotlist");
+ if (!option_recent_path)
+ option_recent_path = strdup("NetSurf:Recent");
+ if (!option_recent_save)
+ option_recent_save = strdup(CHOICES_PREFIX "Recent");
+ if (!option_theme_path)
+ option_theme_path = strdup("NetSurf:Themes");
+ if (!option_theme_save)
+ option_theme_save = strdup(CHOICES_PREFIX "Themes");
+
+ if (!option_theme || ! option_toolbar_browser ||
+ !option_toolbar_hotlist || !option_toolbar_history ||
+ !option_ca_bundle || !option_cookie_file ||
+ !option_cookie_jar || !option_url_path ||
+ !option_url_save || !option_hotlist_path ||
+ !option_hotlist_save || !option_recent_path ||
+ !option_recent_save || !option_theme_path ||
+ !option_theme_save)
+ die("Failed initialising string options");
- gui_sprites = ro_gui_load_sprite_file("<NetSurf$Dir>.Resources.Sprites");
+ /* create our choices directories */
+ ro_gui_create_dirs();
+
+ gui_sprites = ro_gui_load_sprite_file("NetSurf:Resources.Sprites");
if (!gui_sprites)
die("Unable to load Sprites.");
ro_gui_choose_language();
bitmap_initialise_memory();
- url_store_load("Choices:WWW.NetSurf.URL");
+ url_store_load(option_url_path);
nsdir_temp = getenv("NetSurf$Dir");
if (!nsdir_temp)
die("Failed to locate NetSurf directory");
NETSURF_DIR = strdup(nsdir_temp);
+ if (!NETSURF_DIR)
+ die("Failed duplicating NetSurf directory string");
if ((length = snprintf(path, sizeof(path),
- "<NetSurf$Dir>.Resources.%s.Messages",
+ "NetSurf:Resources.%s.Messages",
option_language)) < 0 || length >= (int)sizeof(path))
die("Failed to locate Messages resource.");
messages_load(path);
- messages_load("<NetSurf$Dir>.Resources.LangNames");
+ messages_load("NetSurf:Resources.LangNames");
- default_stylesheet_url = strdup("file:/<NetSurf$Dir>/Resources/CSS");
- adblock_stylesheet_url = strdup("file:/<NetSurf$Dir>/Resources/AdBlock");
-#ifndef ncos
- error = xwimp_initialise(wimp_VERSION_RO38, "NetSurf",
- (const wimp_message_list *) &task_messages, 0,
- &task_handle);
-#else
- error = xwimp_initialise(wimp_VERSION_RO38, "NCNetSurf",
+ default_stylesheet_url = strdup("file:/NetSurf:/Resources/CSS");
+ adblock_stylesheet_url = strdup("file:/NetSurf:/Resources/AdBlock");
+ if (!default_stylesheet_url || !adblock_stylesheet_url)
+ die("Failed initialising string constants.");
+
+ error = xwimp_initialise(wimp_VERSION_RO38, task_name,
(const wimp_message_list *) &task_messages, 0,
&task_handle);
-#endif
if (error) {
LOG(("xwimp_initialise: 0x%x: %s",
error->errnum, error->errmess));
@@ -351,7 +380,7 @@ void gui_init(int argc, char** argv)
/* Open the templates
*/
if ((length = snprintf(path, sizeof(path),
- "<NetSurf$Dir>.Resources.%s.Templates",
+ "NetSurf:Resources.%s.Templates",
option_language)) < 0 || length >= (int)sizeof(path))
die("Failed to locate Templates resource.");
error = xwimp_open_template(path);
@@ -370,12 +399,75 @@ void gui_init(int argc, char** argv)
ro_gui_tree_initialise(); /* must be done after sprite loading */
-#ifndef ncos
ro_gui_icon_bar_create();
-#endif
ro_gui_check_resolvers();
}
+/**
+ * Create intermediate directories for Choices and User Data files
+ */
+void ro_gui_create_dirs(void)
+{
+ char *path;
+ char buf[256];
+
+ /* Choices */
+ path = getenv("NetSurf$ChoicesSave");
+ if (!path)
+ die("Failed to find NetSurf Choices save path");
+
+ snprintf(buf, sizeof(buf), "%s", path);
+ path = buf;
+
+ /* Given a path x.y.z, this will try to create x, x.y */
+ while ((path = strchr(path, '.'))) {
+ *path = '\0';
+ xosfile_create_dir(buf, 0);
+ *path++ = '.';
+ }
+
+ /* URL */
+ snprintf(buf, sizeof(buf), "%s", option_url_save);
+ path = buf;
+
+ while ((path = strchr(path, '.'))) {
+ *path = '\0';
+ xosfile_create_dir(buf, 0);
+ *path++ = '.';
+ }
+
+ /* Hotlist */
+ snprintf(buf, sizeof(buf), "%s", option_hotlist_save);
+ path = buf;
+
+ while ((path = strchr(path, '.'))) {
+ *path = '\0';
+ xosfile_create_dir(buf, 0);
+ *path++ = '.';
+ }
+
+ /* Recent */
+ snprintf(buf, sizeof(buf), "%s", option_recent_save);
+ path = buf;
+
+ while ((path = strchr(path, '.'))) {
+ *path = '\0';
+ xosfile_create_dir(buf, 0);
+ *path++ = '.';
+ }
+
+ /* Theme */
+ snprintf(buf, sizeof(buf), "%s", option_theme_save);
+ path = buf;
+
+ while ((path = strchr(path, '.'))) {
+ *path = '\0';
+ xosfile_create_dir(buf, 0);
+ *path++ = '.';
+ }
+ /* and the final directory part (as theme_save is a directory) */
+ xosfile_create_dir(buf, 0);
+}
/**
* Determine the language to use.
@@ -395,7 +487,7 @@ void ro_gui_choose_language(void)
if (option_language) {
if (2 < strlen(option_language))
option_language[2] = 0;
- sprintf(path, "<NetSurf$Dir>.Resources.%s", option_language);
+ sprintf(path, "NetSurf:Resources.%s", option_language);
if (is_dir(path)) {
if (!option_accept_language)
option_accept_language = strdup(option_language);
@@ -429,7 +521,7 @@ void ro_gui_choose_language(void)
lang = "en";
break;
}
- sprintf(path, "<NetSurf$Dir>.Resources.%s", lang);
+ sprintf(path, "NetSurf:Resources.%s", lang);
if (is_dir(path))
option_language = strdup(lang);
else
@@ -440,13 +532,13 @@ void ro_gui_choose_language(void)
}
-#ifndef ncos
/**
* Create an iconbar icon.
*/
void ro_gui_icon_bar_create(void)
{
+#ifndef ncos
wimp_icon_create icon = {
wimp_ICON_BAR_RIGHT,
{ { 0, 0, 68, 68 },
@@ -456,8 +548,8 @@ void ro_gui_icon_bar_create(void)
wimp_create_icon(&icon);
ro_gui_wimp_event_register_mouse_click(wimp_ICON_BAR,
ro_gui_icon_bar_click);
-}
#endif
+}
/**
@@ -566,7 +658,7 @@ void gui_init2(int argc, char** argv)
void gui_quit(void)
{
bitmap_quit();
- url_store_save("<Choices$Write>.WWW.NetSurf.URL");
+ url_store_save(option_url_save);
ro_gui_window_quit();
ro_gui_global_history_save();
ro_gui_hotlist_save();
diff --git a/riscos/hotlist.c b/riscos/hotlist.c
index f0c762ecb..914b095a2 100644
--- a/riscos/hotlist.c
+++ b/riscos/hotlist.c
@@ -20,6 +20,7 @@
#include "netsurf/desktop/tree.h"
#include "netsurf/riscos/dialog.h"
#include "netsurf/riscos/menus.h"
+#include "netsurf/riscos/options.h"
#include "netsurf/riscos/theme.h"
#include "netsurf/riscos/treeview.h"
#include "netsurf/riscos/wimp.h"
@@ -65,7 +66,7 @@ void ro_gui_hotlist_initialise(void) {
/* Either load or create a hotlist
*/
- fp = fopen("Choices:WWW.NetSurf.Hotlist", "r");
+ fp = fopen(option_hotlist_path, "r");
if (!fp) {
hotlist_tree = calloc(sizeof(struct tree), 1);
if (!hotlist_tree) {
@@ -112,7 +113,7 @@ void ro_gui_hotlist_initialise(void) {
tree_initialise(hotlist_tree);
} else {
fclose(fp);
- hotlist_tree = options_load_tree("Choices:WWW.NetSurf.Hotlist");
+ hotlist_tree = options_load_tree(option_hotlist_path);
}
if (!hotlist_tree) return;
hotlist_tree->handle = (int)hotlist_window;
@@ -142,9 +143,9 @@ void ro_gui_hotlist_save(void) {
/* Save to our file
*/
- options_save_tree(hotlist_tree, "<Choices$Write>.WWW.NetSurf.Hotlist",
+ options_save_tree(hotlist_tree, option_hotlist_save,
"NetSurf hotlist");
- error = xosfile_set_type("<Choices$Write>.WWW.NetSurf.Hotlist", 0xfaf);
+ error = xosfile_set_type(option_hotlist_save, 0xfaf);
if (error)
LOG(("xosfile_set_type: 0x%x: %s",
error->errnum, error->errmess));
@@ -214,7 +215,7 @@ void ro_gui_hotlist_visited(struct content *content, struct tree *tree,
void ro_gui_hotlist_prepare_folder_dialog(struct node *node) {
const char *name;
const char *title;
-
+
dialog_folder_node = node;
if (node) {
title = messages_get("EditFolder");
@@ -222,7 +223,7 @@ void ro_gui_hotlist_prepare_folder_dialog(struct node *node) {
} else {
title = messages_get("NewFolder");
name = messages_get("Folder");
- }
+ }
ro_gui_set_window_title(dialog_folder, title);
ro_gui_set_icon_string(dialog_folder, ICON_FOLDER_NAME, name);
ro_gui_wimp_event_memorise(dialog_folder);
@@ -277,7 +278,7 @@ bool ro_gui_hotlist_dialog_apply(wimp_w w) {
if (strlen(icon) == 0) {
warn_user("NoURLError", 0);
return false;
- }
+ }
res = url_normalize(icon, &url);
title = strip(ro_gui_get_icon_string(w, ICON_ENTRY_NAME));
node = dialog_entry_node;
@@ -314,7 +315,7 @@ bool ro_gui_hotlist_dialog_apply(wimp_w w) {
data->title = strdup(title);
node = dialog_entry_node = tree_create_URL_node(
hotlist_tree->root, data, title);
-
+
} else {
node = dialog_folder_node = tree_create_folder_node(
hotlist_tree->root, title);
diff --git a/riscos/menus.c b/riscos/menus.c
index 8c3ea401f..59e41e230 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -520,7 +520,7 @@ void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i) {
warn_user("MenuError", error->errmess);
return;
}
-
+
ro_gui_menu_create(menu,
state.visible.x0 + icon_state.icon.extent.x1 + 64,
state.visible.y1 + icon_state.icon.extent.y1 -
@@ -559,7 +559,7 @@ void ro_gui_menu_closed(bool cleanup) {
the text doesn't remain highlighted */
if (ro_gui_menu_search_window_menu)
ro_gui_search_end(dialog_search);
-
+
if (tree)
ro_gui_tree_menu_closed(tree);
}
@@ -605,7 +605,7 @@ void ro_gui_menu_selection(wimp_selection *selection) {
if (!current_menu)
return
assert(current_menu_window);
-
+
/* get the menu entry and associated action */
menu_entry = &current_menu->entries[selection->items[0]];
for (i = 1; selection->items[i] != -1; i++)
@@ -932,7 +932,7 @@ void ro_gui_menu_prepare_languages(bool accept, const char *lang)
for (entry = menu->entries; entry; entry = entry->next) {
if (!accept) {
snprintf(path_buf, sizeof path_buf,
- "<NetSurf$Dir>.Resources.%.2s",
+ "NetSurf:Resources.%.2s",
entry->entry_key + offset);
entry->menu_entry->icon_flags |= is_dir(path_buf) ?
@@ -1249,7 +1249,7 @@ void ro_gui_menu_define_menu_add(struct menu_definition *definition,
*/
void ro_gui_menu_init_structure(wimp_menu *menu, int entries) {
int i;
-
+
menu->title_fg = wimp_COLOUR_BLACK;
menu->title_bg = wimp_COLOUR_LIGHT_GREY;
menu->work_fg = wimp_COLOUR_BLACK;
diff --git a/riscos/options.h b/riscos/options.h
index 1c153c088..2a39aeb08 100644
--- a/riscos/options.h
+++ b/riscos/options.h
@@ -57,6 +57,14 @@ extern bool option_url_suggestion;
extern int option_image_memory_direct; /* -1 means auto-detect */
extern int option_image_memory_compressed; /* -1 means auto-detect */
extern bool option_strip_extensions;
+extern char *option_url_path;
+extern char *option_url_save;
+extern char *option_hotlist_path;
+extern char *option_hotlist_save;
+extern char *option_recent_path;
+extern char *option_recent_save;
+extern char *option_theme_path;
+extern char *option_theme_save;
#define EXTRA_OPTION_DEFINE \
bool option_use_mouse_gestures = false;\
@@ -98,7 +106,15 @@ bool option_block_popups = false; \
bool option_url_suggestion = true; \
int option_image_memory_direct = -1; \
int option_image_memory_compressed = -1; \
-bool option_strip_extensions = true;
+bool option_strip_extensions = true; \
+char *option_url_path = 0; \
+char *option_url_save = 0; \
+char *option_hotlist_path = 0; \
+char *option_hotlist_save = 0; \
+char *option_recent_path = 0; \
+char *option_recent_save = 0; \
+char *option_theme_path = 0; \
+char *option_theme_save = 0;
#define EXTRA_OPTION_TABLE \
{ "use_mouse_gestures", OPTION_BOOL, &option_use_mouse_gestures },\
@@ -140,6 +156,14 @@ bool option_strip_extensions = true;
{ "url_suggestion", OPTION_BOOL, &option_url_suggestion }, \
{ "image_memory_direct", OPTION_INTEGER, &option_image_memory_direct }, \
{ "image_memory_compressed",OPTION_INTEGER, &option_image_memory_compressed }, \
-{ "strip_extensions", OPTION_BOOL, &option_strip_extensions }
+{ "strip_extensions", OPTION_BOOL, &option_strip_extensions }, \
+{ "url_path", OPTION_STRING, &option_url_path }, \
+{ "url_save", OPTION_STRING, &option_url_save }, \
+{ "hotlist_path", OPTION_STRING, &option_hotlist_path }, \
+{ "hotlist_save", OPTION_STRING, &option_hotlist_save }, \
+{ "recent_path", OPTION_STRING, &option_recent_path }, \
+{ "recent_save", OPTION_STRING, &option_recent_save }, \
+{ "theme_path", OPTION_STRING, &option_theme_path }, \
+{ "theme_save", OPTION_STRING, &option_theme_save }
#endif
diff --git a/riscos/theme.c b/riscos/theme.c
index 4495316ae..82cddd064 100644
--- a/riscos/theme.c
+++ b/riscos/theme.c
@@ -174,7 +174,6 @@ struct theme_descriptor *ro_gui_theme_find(const char *leafname) {
struct theme_descriptor *ro_gui_theme_get_available(void) {
struct theme_descriptor *current;
struct theme_descriptor *test;
- char pathname[256];
/* close any descriptors we've got so far
* _except_ the current theme */
@@ -184,15 +183,11 @@ struct theme_descriptor *ro_gui_theme_get_available(void) {
if (strcmp(theme_current->name, "Aletheia") != 0) {
/* add our default 'Aletheia' theme */
- snprintf(pathname, 256, "%s.Resources", NETSURF_DIR);
- pathname[255] = '\0';
- ro_gui_theme_add_descriptor(pathname, "Aletheia");
+ ro_gui_theme_add_descriptor("NetSurf:Resources", "Aletheia");
}
/* scan our choices directory */
- snprintf(pathname, 256, "%s%s", THEME_PATH_R, THEME_LEAFNAME);
- pathname[255] = '\0';
- ro_gui_theme_get_available_in_dir(pathname);
+ ro_gui_theme_get_available_in_dir(option_theme_path);
/* sort alphabetically in a very rubbish way */
if ((theme_descriptors) && (theme_descriptors->next)) {
diff --git a/riscos/theme.h b/riscos/theme.h
index 1cf99dbc1..4c21d0296 100644
--- a/riscos/theme.h
+++ b/riscos/theme.h
@@ -14,18 +14,6 @@
#ifndef _NETSURF_RISCOS_THEME_H_
#define _NETSURF_RISCOS_THEME_H_
-
-#ifndef NCOS
-#define THEME_LEAFNAME "WWW.NetSurf.Themes"
-#define THEME_PATH_W "<Choices$Write>."
-#define THEME_PATH_R "Choices:"
-#else
-#define THEME_LEAFNAME "NetSurf.Choices.Themes"
-#define THEME_PATH_W "<User$Path>.Choices."
-#define THEME_PATH_R THEME_PATH_W
-#endif
-
-
typedef enum {
THEME_BROWSER_TOOLBAR,
THEME_HOTLIST_TOOLBAR,
diff --git a/riscos/theme_install.c b/riscos/theme_install.c
index 37ad83ff7..22b722aea 100644
--- a/riscos/theme_install.c
+++ b/riscos/theme_install.c
@@ -172,8 +172,8 @@ bool ro_gui_theme_install_apply(wimp_w w)
}
/* simply overwrite previous theme versions */
- snprintf(theme_save, sizeof theme_save, "%s%s.%s",
- THEME_PATH_W, THEME_LEAFNAME, theme_file);
+ snprintf(theme_save, sizeof theme_save, "%s.%s",
+ option_theme_save, theme_file);
theme_save[sizeof theme_save - 1] = '\0';
error = xosfile_save_stamped(theme_save, 0xffd,
@@ -187,7 +187,7 @@ bool ro_gui_theme_install_apply(wimp_w w)
free(theme_file);
return false;
}
-
+
/* apply the new theme */
ro_gui_theme_get_available();
theme_install = ro_gui_theme_find(theme_file);