[project @ 2006-04-06 17:51:25 by rjw]

Content and security option tools.

svn path=/import/netsurf/; revision=2493
This commit is contained in:
Richard Wilson 2006-04-06 17:51:25 +00:00
parent 98067521f5
commit 9299e0d55a
5 changed files with 169 additions and 17 deletions

View File

@ -42,8 +42,9 @@ OBJECTS_RISCOS += 401login.o artworks.o assert.o awrender.o bitmap.o \
schedule.o search.o sprite.o sslcert.o textselection.o theme.o \
theme_install.o thumbnail.o treeview.o ucstables.o uri.o \
url_complete.o url_protocol.o wimp.o wimp_event.o window.o # riscos/
OBJECTS_RISCOS += con_cache.o con_fonts.o con_home.o con_image.o \
con_inter.o con_language.o con_memory.o con_theme.o # riscos/configure/
OBJECTS_RISCOS += con_cache.o con_content.o con_fonts.o con_home.o \
con_image.o con_inter.o con_language.o con_memory.o \
con_secure.o con_theme.o # riscos/configure/
# OBJECTS_RISCOS += memdebug.o
OBJECTS_RISCOS_SMALL = $(OBJECTS_RISCOS)

View File

@ -62,29 +62,35 @@ void ro_gui_configure_initialise(void) {
ro_gui_wimp_event_set_help_prefix(dialog_zoom, "HelpConfigure");
/* add in our option windows */
ro_gui_configure_register("con_fonts",
ro_gui_options_fonts_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_memory",
ro_gui_options_memory_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_image",
ro_gui_options_image_initialise,
ro_gui_options_image_finalise);
ro_gui_configure_register("con_theme",
ro_gui_options_theme_initialise,
ro_gui_options_theme_finalise);
ro_gui_configure_register("con_cache",
ro_gui_options_cache_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_content",
ro_gui_options_content_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_fonts",
ro_gui_options_fonts_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_home",
ro_gui_options_home_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_image",
ro_gui_options_image_initialise,
ro_gui_options_image_finalise);
ro_gui_configure_register("con_inter",
ro_gui_options_interface_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_lang",
ro_gui_options_language_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_inter",
ro_gui_options_interface_initialise,
ro_gui_configure_register("con_memory",
ro_gui_options_memory_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_theme",
ro_gui_options_theme_initialise,
ro_gui_options_theme_finalise);
ro_gui_configure_register("con_secure",
ro_gui_options_security_initialise,
ro_gui_wimp_event_finalise);
}

View File

@ -0,0 +1,74 @@
/*
* 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 2006 Richard Wilson <info@tinct.net>
*/
#include "netsurf/desktop/options.h"
#include "netsurf/riscos/dialog.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/options.h"
#include "netsurf/riscos/wimp.h"
#include "netsurf/riscos/wimp_event.h"
#include "netsurf/riscos/configure.h"
#include "netsurf/riscos/configure/configure.h"
#include "netsurf/utils/messages.h"
#include "netsurf/utils/utils.h"
#define CONTENT_BLOCK_ADVERTISEMENTS 2
#define CONTENT_BLOCK_POPUPS 3
#define CONTENT_NO_PLUGINS 4
#define CONTENT_DEFAULT_BUTTON 5
#define CONTENT_CANCEL_BUTTON 6
#define CONTENT_OK_BUTTON 7
static void ro_gui_options_content_default(wimp_pointer *pointer);
static bool ro_gui_options_content_ok(wimp_w w);
bool ro_gui_options_content_initialise(wimp_w w) {
/* set the current values */
ro_gui_set_icon_selected_state(w, CONTENT_BLOCK_ADVERTISEMENTS,
option_block_ads);
ro_gui_set_icon_selected_state(w, CONTENT_BLOCK_POPUPS,
option_block_popups);
ro_gui_set_icon_selected_state(w, CONTENT_NO_PLUGINS,
option_no_plugins);
/* initialise all functions for a newly created window */
ro_gui_wimp_event_register_checkbox(w, CONTENT_BLOCK_ADVERTISEMENTS);
ro_gui_wimp_event_register_checkbox(w, CONTENT_BLOCK_POPUPS);
ro_gui_wimp_event_register_checkbox(w, CONTENT_NO_PLUGINS);
ro_gui_wimp_event_register_button(w, CONTENT_DEFAULT_BUTTON,
ro_gui_options_content_default);
ro_gui_wimp_event_register_cancel(w, CONTENT_CANCEL_BUTTON);
ro_gui_wimp_event_register_ok(w, CONTENT_OK_BUTTON,
ro_gui_options_content_ok);
ro_gui_wimp_event_set_help_prefix(w, "HelpContentConfig");
ro_gui_wimp_event_memorise(w);
return true;
}
void ro_gui_options_content_default(wimp_pointer *pointer) {
/* set the default values */
ro_gui_set_icon_selected_state(pointer->w, CONTENT_BLOCK_ADVERTISEMENTS,
false);
ro_gui_set_icon_selected_state(pointer->w, CONTENT_BLOCK_POPUPS,
false);
ro_gui_set_icon_selected_state(pointer->w, CONTENT_NO_PLUGINS,
false);
}
bool ro_gui_options_content_ok(wimp_w w) {
option_block_ads = ro_gui_get_icon_selected_state(w,
CONTENT_BLOCK_ADVERTISEMENTS);
option_block_popups = ro_gui_get_icon_selected_state(w,
CONTENT_BLOCK_POPUPS);
option_no_plugins = ro_gui_get_icon_selected_state(w,
CONTENT_NO_PLUGINS);
ro_gui_save_options();
return true;
}

View File

@ -0,0 +1,69 @@
/*
* 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 2006 Richard Wilson <info@tinct.net>
*/
#include "netsurf/desktop/options.h"
#include "netsurf/riscos/dialog.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/options.h"
#include "netsurf/riscos/wimp.h"
#include "netsurf/riscos/wimp_event.h"
#include "netsurf/riscos/configure.h"
#include "netsurf/riscos/configure/configure.h"
#include "netsurf/utils/messages.h"
#include "netsurf/utils/utils.h"
#define SECURITY_REFERRER 2
#define SECURITY_DURATION_FIELD 6
#define SECURITY_DURATION_INC 7
#define SECURITY_DURATION_DEC 8
#define SECURITY_DEFAULT_BUTTON 10
#define SECURITY_CANCEL_BUTTON 11
#define SECURITY_OK_BUTTON 12
static void ro_gui_options_security_default(wimp_pointer *pointer);
static bool ro_gui_options_security_ok(wimp_w w);
bool ro_gui_options_security_initialise(wimp_w w) {
/* set the current values */
ro_gui_set_icon_selected_state(w, SECURITY_REFERRER,
option_send_referer);
ro_gui_set_icon_integer(w, SECURITY_DURATION_FIELD,
option_expire_url);
/* initialise all functions for a newly created window */
ro_gui_wimp_event_register_checkbox(w, SECURITY_REFERRER);
ro_gui_wimp_event_register_numeric_field(w, SECURITY_DURATION_FIELD,
SECURITY_DURATION_DEC, SECURITY_DURATION_INC,
0, 365, 1, 0);
ro_gui_wimp_event_register_button(w, SECURITY_DEFAULT_BUTTON,
ro_gui_options_security_default);
ro_gui_wimp_event_register_cancel(w, SECURITY_CANCEL_BUTTON);
ro_gui_wimp_event_register_ok(w, SECURITY_OK_BUTTON,
ro_gui_options_security_ok);
ro_gui_wimp_event_set_help_prefix(w, "HelpSecurityConfig");
ro_gui_wimp_event_memorise(w);
return true;
}
void ro_gui_options_security_default(wimp_pointer *pointer) {
/* set the default values */
ro_gui_set_icon_integer(pointer->w, SECURITY_DURATION_FIELD, 28);
ro_gui_set_icon_selected_state(pointer->w, SECURITY_REFERRER, true);
}
bool ro_gui_options_security_ok(wimp_w w) {
option_send_referer = ro_gui_get_icon_selected_state(w,
SECURITY_REFERRER);
option_expire_url = ro_gui_get_icon_decimal(w,
SECURITY_DURATION_FIELD, 0);
ro_gui_save_options();
return true;
}

View File

@ -16,6 +16,7 @@
#include <stdbool.h>
bool ro_gui_options_cache_initialise(wimp_w w);
bool ro_gui_options_content_initialise(wimp_w w);
bool ro_gui_options_fonts_initialise(wimp_w w);
bool ro_gui_options_home_initialise(wimp_w w);
bool ro_gui_options_image_initialise(wimp_w w);
@ -23,6 +24,7 @@ void ro_gui_options_image_finalise(wimp_w w);
bool ro_gui_options_interface_initialise(wimp_w w);
bool ro_gui_options_language_initialise(wimp_w w);
bool ro_gui_options_memory_initialise(wimp_w w);
bool ro_gui_options_security_initialise(wimp_w w);
bool ro_gui_options_theme_initialise(wimp_w w);
void ro_gui_options_theme_finalise(wimp_w w);