From 9299e0d55a9f190b2a606f06af2b247977482c1b Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Thu, 6 Apr 2006 17:51:25 +0000 Subject: [PATCH] [project @ 2006-04-06 17:51:25 by rjw] Content and security option tools. svn path=/import/netsurf/; revision=2493 --- makefile | 7 ++-- riscos/configure.c | 34 +++++++++------- riscos/configure/con_content.c | 74 ++++++++++++++++++++++++++++++++++ riscos/configure/con_secure.c | 69 +++++++++++++++++++++++++++++++ riscos/configure/configure.h | 2 + 5 files changed, 169 insertions(+), 17 deletions(-) create mode 100644 riscos/configure/con_content.c create mode 100644 riscos/configure/con_secure.c diff --git a/makefile b/makefile index def3f2beb..aff04508a 100644 --- a/makefile +++ b/makefile @@ -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) @@ -124,7 +125,7 @@ CFLAGS_GTK = -std=c9x -D_BSD_SOURCE -D_POSIX_C_SOURCE -Dgtk \ # Stop GCC under Cygwin throwing a fit # If you pass -std= it appears to define __STRICT_ANSI__ -# This causes use of functions such as vsnprintf to fail (as Cygwin's header +# This causes use of functions such as vsnprintf to fail (as Cygwin's header # files surround declarations of such things with #ifndef __STRICT_ANSI__) ifeq ($(shell echo $$OS),Windows_NT) CFLAGS_GTK += -U__STRICT_ANSI__ diff --git a/riscos/configure.c b/riscos/configure.c index b933b8e49..2cb4c693e 100644 --- a/riscos/configure.c +++ b/riscos/configure.c @@ -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); } diff --git a/riscos/configure/con_content.c b/riscos/configure/con_content.c new file mode 100644 index 000000000..f0636ac08 --- /dev/null +++ b/riscos/configure/con_content.c @@ -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 + */ + +#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; +} diff --git a/riscos/configure/con_secure.c b/riscos/configure/con_secure.c new file mode 100644 index 000000000..c4b9ddf91 --- /dev/null +++ b/riscos/configure/con_secure.c @@ -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 + */ + +#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; +} diff --git a/riscos/configure/configure.h b/riscos/configure/configure.h index 2979fc907..48ac04f74 100644 --- a/riscos/configure/configure.h +++ b/riscos/configure/configure.h @@ -16,6 +16,7 @@ #include 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);