From 46eaa6a0586dfafb4d0802c1583c86a6d155eaa3 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 18 Dec 2009 17:52:31 +0000 Subject: Simple web search implementation svn path=/trunk/netsurf/; revision=9735 --- amiga/gui.c | 18 ++++++++++++++++-- amiga/options.h | 9 +++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index ebd5d6657..5ced4ba76 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -80,6 +80,7 @@ #include "amiga/print.h" #include #include +#include #include "amiga/stringview/stringview.h" #include "amiga/stringview/urlhistory.h" @@ -396,6 +397,14 @@ void gui_init(int argc, char** argv) if((!option_ca_bundle) || (option_ca_bundle[0] == '\0')) option_ca_bundle = (char *)strdup("devs:curl-ca-bundle.crt"); + if((!option_search_engines_file) || (option_search_engines_file[0] == '\0')) + option_search_engines_file = (char *)strdup("PROGDIR:Resources/SearchEngines"); + +/* + if((!option_search_ico_file) || (option_search_ico_file[0] == '\0')) + option_search_ico_file = (char *)strdup("PROGDIR:Resources/default.ico"); +*/ + if((!option_font_sans) || (option_font_sans[0] == '\0')) option_font_sans = (char *)strdup("DejaVu Sans"); @@ -463,6 +472,7 @@ void gui_init(int argc, char** argv) ami_global_history_initialise(); ami_cookies_initialise(); save_complete_init(); + search_web_provider_details(option_search_provider); strcpy(throbberfile,option_theme); AddPart(throbberfile,"Theme",100); @@ -1124,8 +1134,12 @@ void ami_handle_msg(void) case GID_URL: GetAttr(STRINGA_TextVal,gwin->gadgets[GID_URL],(ULONG *)&storage); - browser_window_go(gwin->bw,(char *)storage,NULL,true); - //printf("%s\n",(char *)storage); + if(search_is_url((char *)storage) == false) + { + storage = (ULONG *)search_web_from_term((char *)storage); + } + + browser_window_go(gwin->bw,(char *)storage, NULL, true); break; case GID_HOME: diff --git a/amiga/options.h b/amiga/options.h index c1976aef5..b531b7f19 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -36,6 +36,7 @@ extern bool option_use_os_pointers; extern bool option_new_tab_active; extern bool option_kiosk_mode; extern char *option_recent_file; +extern char *option_search_engines_file; extern char *option_arexx_dir; extern char *option_download_dir; extern bool option_faster_scroll; @@ -45,6 +46,7 @@ extern int option_printer_unit; extern int option_print_scale; extern bool option_startup_no_window; extern bool option_close_no_quit; +extern bool option_hide_docky_icon; #define EXTRA_OPTION_DEFINE \ bool option_verbose_log = false; \ @@ -63,6 +65,7 @@ bool option_use_os_pointers = true; \ bool option_new_tab_active = false; \ bool option_kiosk_mode = false; \ char *option_recent_file = 0; \ +char *option_search_engines_file = 0; \ char *option_arexx_dir = 0; \ char *option_download_dir = 0; \ bool option_faster_scroll = true; \ @@ -72,6 +75,7 @@ int option_printer_unit = 0; \ int option_print_scale = 100; \ bool option_startup_no_window = false; \ bool option_close_no_quit = false; \ +bool option_hide_docky_icon = false; \ #define EXTRA_OPTION_TABLE \ { "verbose_log", OPTION_BOOL, &option_verbose_log}, \ @@ -90,6 +94,7 @@ bool option_close_no_quit = false; \ { "new_tab_is_active", OPTION_BOOL, &option_new_tab_active}, \ { "kiosk_mode", OPTION_BOOL, &option_kiosk_mode}, \ { "recent_file", OPTION_STRING, &option_recent_file }, \ +{ "search_engines_file", OPTION_STRING, &option_search_engines_file }, \ { "arexx_dir", OPTION_STRING, &option_arexx_dir }, \ { "download_dir", OPTION_STRING, &option_download_dir }, \ { "faster_scroll", OPTION_BOOL, &option_faster_scroll}, \ @@ -98,6 +103,6 @@ bool option_close_no_quit = false; \ { "printer_unit", OPTION_INTEGER, &option_printer_unit}, \ { "print_scale", OPTION_INTEGER, &option_print_scale}, \ { "startup_no_window", OPTION_BOOL, &option_startup_no_window}, \ -{ "close_no_quit", OPTION_BOOL, &option_close_no_quit}, - +{ "close_no_quit", OPTION_BOOL, &option_close_no_quit}, \ +{ "hide_docky_icon", OPTION_BOOL, &option_hide_docky_icon}, #endif -- cgit v1.2.3