diff options
37 files changed, 971 insertions, 599 deletions
diff --git a/!NetSurf/Resources/Icons/arrow-l.png b/!NetSurf/Resources/Icons/arrow-l.png Binary files differnew file mode 100644 index 000000000..c338461c3 --- /dev/null +++ b/!NetSurf/Resources/Icons/arrow-l.png diff --git a/amiga/context_menu.c b/amiga/context_menu.c index be52865fd..e7bbe6237 100644 --- a/amiga/context_menu.c +++ b/amiga/context_menu.c @@ -41,7 +41,7 @@ #include "amiga/utf8.h" #include "desktop/browser_private.h" #include "desktop/local_history.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "desktop/searchweb.h" #include "desktop/textinput.h" #include "desktop/tree_url_node.h" @@ -768,7 +768,7 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved case CMID_URLHOTLIST: case CMID_PAGEHOTLIST: - hotlist_add_page(userdata); + hotlist_old_add_page(userdata); break; case CMID_FRAMECOPYURL: @@ -1216,7 +1216,7 @@ static uint32 ami_context_menu_hook_tree(struct Hook *hook, Object *item, APTR r break; case CMID_TREE_EDITFOLDER: - hotlist_edit_selected(); + hotlist_old_edit_selected(); break; case CMID_TREE_EDITTITLE: @@ -1228,23 +1228,23 @@ static uint32 ami_context_menu_hook_tree(struct Hook *hook, Object *item, APTR r break; case CMID_TREE_NEWFOLDER: - hotlist_add_folder(true); + hotlist_old_add_folder(true); break; case CMID_TREE_NEWITEM: - hotlist_add_entry(true); + hotlist_old_add_entry(true); break; case CMID_TREE_SETDEFAULT: - hotlist_set_default_folder(false); + hotlist_old_set_default_folder(false); break; case CMID_TREE_CLEARDEFAULT: - hotlist_set_default_folder(true); + hotlist_old_set_default_folder(true); break; case CMID_TREE_ADDHOTLIST: - hotlist_add_page(tree_url_node_get_url(userdata)); + hotlist_old_add_page(tree_url_node_get_url(userdata)); break; case CMID_TREE_DELETE: diff --git a/amiga/gui.c b/amiga/gui.c index fae06f1f0..bb919c61e 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -812,7 +812,6 @@ static void gui_init2(int argc, char** argv) ami_hotlist_initialise(nsoption_charp(hotlist_file)); ami_cookies_initialise(); ami_global_history_initialise(); - sslcert_init(tree_content_icon_name); search_web_provider_details(nsoption_int(search_provider)); @@ -2755,7 +2754,6 @@ void gui_quit(void) ami_hotlist_free(nsoption_charp(hotlist_file)); ami_cookies_free(); ami_global_history_free(); - sslcert_cleanup(); if(IApplication && ami_appid) UnregisterApplication(ami_appid, NULL); diff --git a/amiga/hotlist.c b/amiga/hotlist.c index c82b92f72..073296771 100755 --- a/amiga/hotlist.c +++ b/amiga/hotlist.c @@ -19,7 +19,7 @@ #include <proto/exec.h> #include "amiga/hotlist.h" #include "amiga/tree.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "utils/messages.h" bool ami_hotlist_find_dir(struct tree *tree, const char *dir_name) @@ -56,11 +56,11 @@ void ami_hotlist_add_default_dirs(struct tree *tree) void ami_hotlist_initialise(const char *hotlist_file) { - hotlist_window = ami_tree_create(hotlist_get_tree_flags(), NULL); + hotlist_window = ami_tree_create(hotlist_old_get_tree_flags(), NULL); if(!hotlist_window) return; - hotlist_initialise(ami_tree_get_tree(hotlist_window), + hotlist_old_initialise(ami_tree_get_tree(hotlist_window), hotlist_file, tree_directory_icon_name); @@ -69,7 +69,7 @@ void ami_hotlist_initialise(const char *hotlist_file) void ami_hotlist_free(const char *hotlist_file) { - hotlist_cleanup(hotlist_file); + hotlist_old_cleanup(hotlist_file); ami_tree_destroy(hotlist_window); hotlist_window = NULL; } diff --git a/amiga/menu.c b/amiga/menu.c index 1a4fdce97..bfd010d58 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -57,7 +57,7 @@ #include "amiga/tree.h" #include "amiga/utf8.h" #include "desktop/tree_url_node.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "desktop/browser_private.h" #include "desktop/gui.h" #include "desktop/textinput.h" @@ -888,7 +888,7 @@ static void ami_menu_item_hotlist_add(struct Hook *hook, APTR window, struct Int nsurl_access(hlcache_handle_get_url(bw->current_content)) == NULL) return; - hotlist_add_page(nsurl_access(hlcache_handle_get_url(bw->current_content))); + hotlist_old_add_page(nsurl_access(hlcache_handle_get_url(bw->current_content))); } static void ami_menu_item_hotlist_show(struct Hook *hook, APTR window, struct IntuiMessage *msg) diff --git a/amiga/sslcert.c b/amiga/sslcert.c index dcf9a6d7d..3c83df138 100644 --- a/amiga/sslcert.c +++ b/amiga/sslcert.c @@ -19,6 +19,7 @@ #include <proto/exec.h> #include "amiga/tree.h" #include "amiga/sslcert.h" +#include "desktop/sslcert_viewer.h" void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, unsigned long num, @@ -27,13 +28,13 @@ void gui_cert_verify(nsurl *url, struct sslcert_session_data *data; struct treeview_window *ssl_window; - data = sslcert_create_session_data(num, url, cb, cbpw); + sslcert_viewer_create_session_data(num, url, cb, cbpw, + certs, &data); + ssl_current_session = data; - ssl_window = ami_tree_create(sslcert_get_tree_flags(), data); + ssl_window = ami_tree_create(TREE_SSLCERT, data); if(!ssl_window) return; - sslcert_load_tree(ami_tree_get_tree(ssl_window), certs, data); - ami_tree_open(ssl_window, AMI_TREE_SSLCERT); } diff --git a/amiga/sslcert.h b/amiga/sslcert.h index 10078d9bb..e308f6231 100644 --- a/amiga/sslcert.h +++ b/amiga/sslcert.h @@ -18,7 +18,6 @@ #ifndef AMIGA_SSLCERT_H #define AMIGA_SSLCERT_H -#include "desktop/sslcert.h" void ami_ssl_free(struct treeview_window *twin); #endif diff --git a/amiga/tree.c b/amiga/tree.c index 9c7305dac..a8dda20b7 100644 --- a/amiga/tree.c +++ b/amiga/tree.c @@ -57,7 +57,8 @@ #include "content/urldb.h" #include "desktop/cookies_old.h" #include "desktop/history_global_core.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" +#include "desktop/sslcert_viewer.h" #include "desktop/tree_url_node.h" #include "utils/utils.h" #include "utils/messages.h" @@ -339,7 +340,7 @@ void ami_tree_drag_end(struct treeview_window *twin, int x, int y) else if((tw = ami_window_at_pointer(AMINS_TVWINDOW)) && (tw != twin) && (tw->type == AMI_TREE_HOTLIST)) { - hotlist_add_page_xy(tree_url_node_get_url(selected_node), x, y); + hotlist_old_add_page_xy(tree_url_node_get_url(selected_node), x, y); } } tree_drag_end(twin->tree, twin->mouse_state, @@ -757,13 +758,13 @@ BOOL ami_tree_event(struct treeview_window *twin) switch(result & WMHI_GADGETMASK) { case GID_OPEN: - sslcert_accept(twin->ssl_data); + sslcert_viewer_accept(twin->ssl_data); ami_tree_close(twin); return TRUE; break; case GID_CANCEL: - sslcert_reject(twin->ssl_data); + sslcert_viewer_reject(twin->ssl_data); ami_tree_close(twin); return TRUE; break; @@ -1013,7 +1014,7 @@ BOOL ami_tree_event(struct treeview_window *twin) if(twin->type == AMI_TREE_HISTORY) history_global_export(fname); else if(twin->type == AMI_TREE_HOTLIST) - hotlist_export(fname); + hotlist_old_export(fname); ami_update_pointer(twin->win, GUI_POINTER_DEFAULT); } break; @@ -1031,7 +1032,7 @@ BOOL ami_tree_event(struct treeview_window *twin) cookies_expand_all(); break; case AMI_TREE_HOTLIST: - hotlist_expand_all(); + hotlist_old_expand_all(); break; } break; @@ -1046,7 +1047,7 @@ BOOL ami_tree_event(struct treeview_window *twin) cookies_expand_domains(); break; case AMI_TREE_HOTLIST: - hotlist_expand_directories(); + hotlist_old_expand_directories(); break; } break; @@ -1061,7 +1062,7 @@ BOOL ami_tree_event(struct treeview_window *twin) cookies_expand_cookies(); break; case AMI_TREE_HOTLIST: - hotlist_expand_addresses(); + hotlist_old_expand_addresses(); break; } break; @@ -1081,7 +1082,7 @@ BOOL ami_tree_event(struct treeview_window *twin) cookies_collapse_all(); break; case AMI_TREE_HOTLIST: - hotlist_collapse_all(); + hotlist_old_collapse_all(); break; } break; @@ -1096,7 +1097,7 @@ BOOL ami_tree_event(struct treeview_window *twin) cookies_collapse_domains(); break; case AMI_TREE_HOTLIST: - hotlist_collapse_directories(); + hotlist_old_collapse_directories(); break; } break; @@ -1111,7 +1112,7 @@ BOOL ami_tree_event(struct treeview_window *twin) cookies_collapse_cookies(); break; case AMI_TREE_HOTLIST: - hotlist_collapse_addresses(); + hotlist_old_collapse_addresses(); break; } break; @@ -1162,7 +1163,7 @@ BOOL ami_tree_event(struct treeview_window *twin) cookies_delete_selected(); break; case AMI_TREE_HOTLIST: - hotlist_delete_selected(); + hotlist_old_delete_selected(); break; } ami_tree_update_buttons(twin); @@ -1178,7 +1179,7 @@ BOOL ami_tree_event(struct treeview_window *twin) cookies_select_all(); break; case AMI_TREE_HOTLIST: - hotlist_select_all(); + hotlist_old_select_all(); break; } ami_tree_update_buttons(twin); @@ -1194,7 +1195,7 @@ BOOL ami_tree_event(struct treeview_window *twin) cookies_clear_selection(); break; case AMI_TREE_HOTLIST: - hotlist_clear_selection(); + hotlist_old_clear_selection(); break; } ami_tree_update_buttons(twin); @@ -1215,7 +1216,7 @@ BOOL ami_tree_event(struct treeview_window *twin) case WMHI_CLOSEWINDOW: if(twin->type == AMI_TREE_SSLCERT) - sslcert_reject(twin->ssl_data); + sslcert_viewer_reject(twin->ssl_data); ami_tree_close(twin); return TRUE; break; diff --git a/amiga/tree.h b/amiga/tree.h index 07fa6e305..5371b201f 100755 --- a/amiga/tree.h +++ b/amiga/tree.h @@ -24,7 +24,6 @@ #include "amiga/os3support.h" #include "amiga/gui.h" #include "desktop/tree.h" -#include "desktop/sslcert.h" /* defined in front end code */ extern const char tree_directory_icon_name[]; diff --git a/atari/deskmenu.c b/atari/deskmenu.c index 113998c08..0de2cc124 100644 --- a/atari/deskmenu.c +++ b/atari/deskmenu.c @@ -478,7 +478,7 @@ static void __CDECL menu_add_bookmark(short item, short title, void *data) static void __CDECL menu_bookmarks(short item, short title, void *data)
{
LOG(("%s", __FUNCTION__));
- hotlist_open();
+ atari_hotlist_open();
}
static void __CDECL menu_vlog(short item, short title, void *data)
diff --git a/atari/gui.c b/atari/gui.c index df205aa6e..5c384b7f6 100644 --- a/atari/gui.c +++ b/atari/gui.c @@ -811,7 +811,7 @@ void gui_quit(void) } atari_global_history_destroy(); - hotlist_destroy(); + atari_hotlist_destroy(); toolbar_exit(); urldb_save_cookies(nsoption_charp(cookie_file)); @@ -1022,7 +1022,7 @@ static void gui_init2(int argc, char** argv) } gemtk_wm_init(); atari_global_history_init(); - hotlist_init(); + atari_hotlist_init(); toolbar_init(); } diff --git a/atari/hotlist.c b/atari/hotlist.c index f3b093d6f..77e2755e1 100755 --- a/atari/hotlist.c +++ b/atari/hotlist.c @@ -28,7 +28,7 @@ #include "content/hlcache.h" #include "content/urldb.h" #include "utils/nsoption.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "desktop/tree.h" #include "desktop/tree_url_node.h" #include "desktop/gui.h" @@ -62,7 +62,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) switch (msg[4]) { case TOOLBAR_HOTLIST_CREATE_FOLDER: - hotlist_add_folder(true); + hotlist_old_add_folder(true); break; case TOOLBAR_HOTLIST_ADD: @@ -70,12 +70,12 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) break; case TOOLBAR_HOTLIST_DELETE: - hotlist_delete_selected(); + hotlist_old_delete_selected(); gemtk_wm_exec_redraw(tv->window, NULL); break; case TOOLBAR_HOTLIST_EDIT: - hotlist_edit_selected(); + hotlist_old_edit_selected(); break; } @@ -86,7 +86,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) break; case WM_CLOSED: - hotlist_close(); + atari_hotlist_close(); break; default: break; @@ -99,7 +99,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) -void hotlist_init(void) +void atari_hotlist_init(void) { if (hl.init == false) { if( strcmp(nsoption_charp(hotlist_file), "") == 0 ){ @@ -129,7 +129,7 @@ void hotlist_init(void) gemtk_wm_set_toolbar(hl.window, tree, 0, 0); gemtk_wm_unlink(hl.window); hl.tv = atari_treeview_create( - hotlist_get_tree_flags(), + hotlist_old_get_tree_flags(), hl.window, handle_event ); @@ -139,7 +139,7 @@ void hotlist_init(void) return; } - hotlist_initialise( + hotlist_old_initialise( hl.tv->tree, (char*)&hl.path, "dir.png" @@ -153,7 +153,7 @@ void hotlist_init(void) } -void hotlist_open(void) +void atari_hotlist_open(void) { if( hl.init == false ) { return; @@ -175,23 +175,23 @@ void hotlist_open(void) } } -void hotlist_close(void) +void atari_hotlist_close(void) { wind_close(gemtk_wm_get_handle(hl.window)); hl.open = false; atari_treeview_close(hl.tv); } -void hotlist_destroy(void) +void atari_hotlist_destroy(void) { if( hl.init == false) { return; } if( hl.window != NULL ) { - hotlist_cleanup( (char*)&hl.path ); + hotlist_old_cleanup( (char*)&hl.path ); if (hl.open) - hotlist_close(); + atari_hotlist_close(); wind_delete(gemtk_wm_get_handle(hl.window)); gemtk_wm_remove(hl.window); hl.window = NULL; @@ -201,7 +201,7 @@ void hotlist_destroy(void) LOG(("done")); } -void hotlist_redraw(void) +void atari_hotlist_redraw(void) { int i = 01; atari_treeview_redraw(hl.tv); @@ -218,11 +218,11 @@ void atari_hotlist_add_page( const char * url, const char * title ) if(hl.tv == NULL ) return; - hotlist_open(); + atari_hotlist_open(); if( hl.tv->click.x >= 0 && hl.tv->click.y >= 0 ){ - hotlist_add_page_xy( url, hl.tv->click.x, hl.tv->click.y ); + hotlist_old_add_page_xy( url, hl.tv->click.x, hl.tv->click.y ); } else { - hotlist_add_page( url ); + hotlist_old_add_page( url ); } } diff --git a/atari/hotlist.h b/atari/hotlist.h index 9fbf38932..fc9cba615 100755 --- a/atari/hotlist.h +++ b/atari/hotlist.h @@ -34,13 +34,13 @@ struct atari_hotlist { extern struct atari_hotlist hl;
-void hotlist_init( void );
-void hotlist_open( void );
-void hotlist_close( void );
-void hotlist_destroy( void );
+void atari_hotlist_init( void );
+void atari_hotlist_open( void );
+void atari_hotlist_close( void );
+void atari_hotlist_destroy( void );
void atari_hotlist_add_page( const char * url, const char * title );
-void hotlist_redraw( void );
+void atari_hotlist_redraw( void );
#endif diff --git a/cocoa/BookmarksController.m b/cocoa/BookmarksController.m index ef5fc974e..c86562f6e 100644 --- a/cocoa/BookmarksController.m +++ b/cocoa/BookmarksController.m @@ -24,7 +24,7 @@ #import "cocoa/gui.h" #import "desktop/browser_private.h" -#import "desktop/hotlist.h" +#import "desktop/hotlist_old.h" #import "desktop/tree.h" #import "desktop/tree_url_node.h" #import "utils/messages.h" @@ -49,8 +49,8 @@ static const char *cocoa_hotlist_path( void ) { if ((self = [super initWithWindowNibName: @"BookmarksWindow"]) == nil) return nil; - tree = [[Tree alloc] initWithFlags: hotlist_get_tree_flags()]; - hotlist_initialise( [tree tree], cocoa_hotlist_path(), "directory.png" ); + tree = [[Tree alloc] initWithFlags: hotlist_old_get_tree_flags()]; + hotlist_old_initialise( [tree tree], cocoa_hotlist_path(), "directory.png" ); nodeForMenu = NSCreateMapTable( NSNonOwnedPointerMapKeyCallBacks, NSNonOwnedPointerMapValueCallBacks, 0 ); [[NSNotificationCenter defaultCenter] addObserver:self @@ -68,14 +68,14 @@ static const char *cocoa_hotlist_path( void ) - (void) save; { - hotlist_export( cocoa_hotlist_path() ); + hotlist_old_export( cocoa_hotlist_path() ); } - (void) dealloc; { [self setView: nil]; NSFreeMapTable( nodeForMenu ); - hotlist_cleanup( cocoa_hotlist_path() ); + hotlist_old_cleanup( cocoa_hotlist_path() ); [tree release]; [[NSNotificationCenter defaultCenter] removeObserver: self]; @@ -167,7 +167,7 @@ static const char *cocoa_hotlist_path( void ) struct browser_window *bw = [[(NetSurfApp *)NSApp frontTab] browser]; if (bw && bw->current_content) { const char *url = nsurl_access(hlcache_handle_get_url( bw->current_content )); - hotlist_add_page( url ); + hotlist_old_add_page( url ); } } @@ -184,8 +184,8 @@ static const char *cocoa_hotlist_path( void ) - (void) windowDidLoad; { - hotlist_expand_all(); - hotlist_collapse_all(); + hotlist_old_expand_all(); + hotlist_old_collapse_all(); [view setTree: tree]; } @@ -200,17 +200,17 @@ static const char *cocoa_hotlist_path( void ) - (IBAction) editSelected: (id) sender; { - hotlist_edit_selected(); + hotlist_old_edit_selected(); } - (IBAction) deleteSelected: (id) sender; { - hotlist_delete_selected(); + hotlist_old_delete_selected(); } - (IBAction) addFolder: (id) sender; { - hotlist_add_folder(true); + hotlist_old_add_folder(true); } @end diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c index 2c31da2d4..808bd8f3a 100644 --- a/content/fetchers/resource.c +++ b/content/fetchers/resource.c @@ -82,6 +82,7 @@ static const char *fetch_resource_paths[] = { "welcome.html", "favicon.ico", "netsurf.png", + "icons/arrow-l.png", "icons/content.png", "icons/directory.png", "icons/search.png" diff --git a/desktop/Makefile b/desktop/Makefile index 90ca5e011..03e9591c0 100644 --- a/desktop/Makefile +++ b/desktop/Makefile @@ -1,8 +1,8 @@ # Sources for desktop -S_DESKTOP := cookie_manager.c cookies_old.c history_global_core.c hotlist.c knockout.c \ +S_DESKTOP := cookie_manager.c cookies_old.c history_global_core.c hotlist_old.c knockout.c \ mouse.c plot_style.c print.c search.c searchweb.c \ - scrollbar.c sslcert.c textarea.c thumbnail.c tree.c \ + scrollbar.c sslcert_viewer.c textarea.c thumbnail.c tree.c \ tree_url_node.c version.c system_colour.c global_history.c treeview.c S_DESKTOP := $(addprefix desktop/,$(S_DESKTOP)) diff --git a/desktop/browser.c b/desktop/browser.c index 9f3636ed9..f0213a18e 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -48,7 +48,7 @@ #include "desktop/global_history.h" #include "desktop/gui.h" #include "desktop/history_global_core.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "desktop/knockout.h" #include "desktop/local_history.h" #include "utils/nsoption.h" @@ -1285,7 +1285,7 @@ static nserror browser_window_callback(hlcache_handle *c, browser_window_update_favicon(c, bw, NULL); history_update(bw->history, c); - hotlist_visited(c); + hotlist_old_visited(c); if (bw->refresh_interval != -1) schedule(bw->refresh_interval, diff --git a/desktop/hotlist.c b/desktop/hotlist_old.c index adc9e5f8f..bee38d3b4 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist_old.c @@ -24,7 +24,7 @@ #include "content/hlcache.h" #include "content/urldb.h" #include "desktop/browser.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "desktop/plotters.h" #include "desktop/tree.h" #include "desktop/tree_url_node.h" @@ -35,8 +35,8 @@ #define URL_CHUNK_LENGTH 512 -static struct tree *hotlist_tree; -static struct node *hotlist_tree_root; +static struct tree *hotlist_old_tree; +static struct node *hotlist_old_tree_root; static bool creating_node; static hlcache_handle *folder_icon; @@ -44,7 +44,7 @@ static hlcache_handle *folder_icon; static const struct { const char *url; const char *msg_key; -} hotlist_default_entries[] = { +} hotlist_old_default_entries[] = { { "http://www.netsurf-browser.org/", "HotlistHomepage" }, { "http://www.netsurf-browser.org/downloads/riscos/testbuilds", "HotlistTestBuild" }, @@ -55,9 +55,9 @@ static const struct { { "http://sourceforge.net/tracker/?atid=464315&group_id=51719", "HotlistFeatureRequest" } }; -#define HOTLIST_ENTRIES_COUNT (sizeof(hotlist_default_entries) / sizeof(hotlist_default_entries[0])) +#define hotlist_old_ENTRIES_COUNT (sizeof(hotlist_old_default_entries) / sizeof(hotlist_old_default_entries[0])) -static node_callback_resp hotlist_node_callback(void *user_data, +static node_callback_resp hotlist_old_node_callback(void *user_data, struct node_msg_data *msg_data) { struct node *node = msg_data->node; @@ -74,7 +74,7 @@ static node_callback_resp hotlist_node_callback(void *user_data, if (creating_node && !cancelled && (is_folder == false) && (msg_data->flag == TREE_ELEMENT_TITLE)) { - tree_url_node_edit_url(hotlist_tree, node); + tree_url_node_edit_url(hotlist_old_tree, node); } else { creating_node = false; } @@ -82,7 +82,7 @@ static node_callback_resp hotlist_node_callback(void *user_data, case NODE_ELEMENT_EDIT_FINISHING: if (creating_node && (is_folder == false)) - return tree_url_node_callback(hotlist_tree, msg_data); + return tree_url_node_callback(hotlist_old_tree, msg_data); if (is_folder == true) { text = msg_data->data.text; @@ -109,14 +109,14 @@ static node_callback_resp hotlist_node_callback(void *user_data, default: if (is_folder == false) - return tree_url_node_callback(hotlist_tree, msg_data); + return tree_url_node_callback(hotlist_old_tree, msg_data); } return NODE_CALLBACK_NOT_HANDLED; } /* exported interface documented in hotlist.h */ -bool hotlist_initialise(struct tree *tree, const char *hotlist_path, +bool hotlist_old_initialise(struct tree *tree, const char *hotlist_path, const char* folder_icon_name) { struct node *node; @@ -134,17 +134,17 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path, if (tree == NULL) return false; - hotlist_tree = tree; - hotlist_tree_root = tree_get_root(hotlist_tree); + hotlist_old_tree = tree; + hotlist_old_tree_root = tree_get_root(hotlist_old_tree); - if (tree_urlfile_load(hotlist_path, hotlist_tree, - hotlist_node_callback, NULL)) { + if (tree_urlfile_load(hotlist_path, hotlist_old_tree, + hotlist_old_node_callback, NULL)) { return true; } /* failed to load hotlist file, use default list */ - node = tree_create_folder_node(hotlist_tree, - hotlist_tree_root, + node = tree_create_folder_node(hotlist_old_tree, + hotlist_old_tree_root, messages_get("NetSurf"), true, false, @@ -154,12 +154,12 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path, return false; } - tree_set_node_user_callback(node, hotlist_node_callback, NULL); - tree_set_node_icon(hotlist_tree, node, folder_icon); + tree_set_node_user_callback(node, hotlist_old_node_callback, NULL); + tree_set_node_icon(hotlist_old_tree, node, folder_icon); - for (hlst_loop = 0; hlst_loop != HOTLIST_ENTRIES_COUNT; hlst_loop++) { + for (hlst_loop = 0; hlst_loop != hotlist_old_ENTRIES_COUNT; hlst_loop++) { nsurl *url; - if (nsurl_create(hotlist_default_entries[hlst_loop].url, + if (nsurl_create(hotlist_old_default_entries[hlst_loop].url, &url) != NSERROR_OK) { return false; } @@ -170,10 +170,10 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path, url_data = urldb_get_url_data(url); } if (url_data != NULL) { - tree_create_URL_node(hotlist_tree, node, url, - messages_get(hotlist_default_entries[hlst_loop].msg_key), - hotlist_node_callback, NULL); - tree_update_URL_node(hotlist_tree, node, url, url_data); + tree_create_URL_node(hotlist_old_tree, node, url, + messages_get(hotlist_old_default_entries[hlst_loop].msg_key), + hotlist_old_node_callback, NULL); + tree_update_URL_node(hotlist_old_tree, node, url, url_data); } nsurl_unref(url); } @@ -187,7 +187,7 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path, * * \return the flags */ -unsigned int hotlist_get_tree_flags(void) +unsigned int hotlist_old_get_tree_flags(void) { return TREE_MOVABLE | TREE_HOTLIST; } @@ -197,10 +197,10 @@ unsigned int hotlist_get_tree_flags(void) * Deletes the global history tree and saves the hotlist. * \param hotlist_path the path where the hotlist should be saved */ -void hotlist_cleanup(const char *hotlist_path) +void hotlist_old_cleanup(const char *hotlist_path) { LOG(("Exporting hotlist...")); - hotlist_export(hotlist_path); + hotlist_old_export(hotlist_path); LOG(("Releasing handles...")); hlcache_handle_release(folder_icon); LOG(("Clearing hotlist tree nodes...")); @@ -215,7 +215,7 @@ void hotlist_cleanup(const char *hotlist_path) * \param content the content visited * \param node the node to update siblings and children of */ -static void hotlist_visited_internal(hlcache_handle *content, struct node *node) +static void hotlist_old_visited_internal(hlcache_handle *content, struct node *node) { struct node *child; const char *text; @@ -224,7 +224,7 @@ static void hotlist_visited_internal(hlcache_handle *content, struct node *node) if (content == NULL || hlcache_handle_get_url(content) == NULL || - hotlist_tree == NULL) + hotlist_old_tree == NULL) return; nsurl = hlcache_handle_get_url(content); @@ -234,13 +234,13 @@ static void hotlist_visited_internal(hlcache_handle *content, struct node *node) if (!tree_node_is_folder(node)) { text = tree_url_node_get_url(node); if (strcmp(text, url) == 0) { - tree_update_URL_node(hotlist_tree, node, + tree_update_URL_node(hotlist_old_tree, node, nsurl, NULL); } } child = tree_node_get_child(node); if (child != NULL) { - hotlist_visited_internal(content, child); + hotlist_old_visited_internal(content, child); } } } @@ -250,10 +250,10 @@ static void hotlist_visited_internal(hlcache_handle *content, struct node *node) * * \param content the content visited */ -void hotlist_visited(hlcache_handle *content) +void hotlist_old_visited(hlcache_handle *content) { - if (hotlist_tree != NULL) { - hotlist_visited_internal(content, tree_get_root(hotlist_tree)); + if (hotlist_old_tree != NULL) { + hotlist_old_visited_internal(content, tree_get_root(hotlist_old_tree)); } } @@ -262,107 +262,107 @@ void hotlist_visited(hlcache_handle *content) * * \param path the path where the hotlist will be saved */ -bool hotlist_export(const char *path) +bool hotlist_old_export(const char *path) { - return tree_urlfile_save(hotlist_tree, path, "NetSurf hotlist"); + return tree_urlfile_save(hotlist_old_tree, path, "NetSurf hotlist"); } /** * Edit the node which is currently selected. Works only if one node is * selected. */ -void hotlist_edit_selected(void) +void hotlist_old_edit_selected(void) { struct node *node; struct node_element *element; - node = tree_get_selected_node(hotlist_tree_root); + node = tree_get_selected_node(hotlist_old_tree_root); if (node != NULL) { creating_node = true; element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL); - tree_start_edit(hotlist_tree, element); + tree_start_edit(hotlist_old_tree, element); } } /** * Delete nodes which are currently selected. */ -void hotlist_delete_selected(void) +void hotlist_old_delete_selected(void) { - tree_delete_selected_nodes(hotlist_tree, hotlist_tree_root); + tree_delete_selected_nodes(hotlist_old_tree, hotlist_old_tree_root); } /** * Select all nodes in the tree. */ -void hotlist_select_all(void) +void hotlist_old_select_all(void) { - tree_set_node_selected(hotlist_tree, hotlist_tree_root, + tree_set_node_selected(hotlist_old_tree, hotlist_old_tree_root, true, true); } /** * Unselect all nodes. */ -void hotlist_clear_selection(void) +void hotlist_old_clear_selection(void) { - tree_set_node_selected(hotlist_tree, hotlist_tree_root, + tree_set_node_selected(hotlist_old_tree, hotlist_old_tree_root, true, false); } /** * Expand grouping folders and history entries. */ -void hotlist_expand_all(void) +void hotlist_old_expand_all(void) { - tree_set_node_expanded(hotlist_tree, hotlist_tree_root, + tree_set_node_expanded(hotlist_old_tree, hotlist_old_tree_root, true, true, true); } /** * Expand grouping folders only. */ -void hotlist_expand_directories(void) +void hotlist_old_expand_directories(void) { - tree_set_node_expanded(hotlist_tree, hotlist_tree_root, + tree_set_node_expanded(hotlist_old_tree, hotlist_old_tree_root, true, true, false); } /** * Expand history entries only. */ -void hotlist_expand_addresses(void) +void hotlist_old_expand_addresses(void) { - tree_set_node_expanded(hotlist_tree, hotlist_tree_root, + tree_set_node_expanded(hotlist_old_tree, hotlist_old_tree_root, true, false, true); } /** * Collapse grouping folders and history entries. */ -void hotlist_collapse_all(void) +void hotlist_old_collapse_all(void) { - tree_set_node_expanded(hotlist_tree, hotlist_tree_root, + tree_set_node_expanded(hotlist_old_tree, hotlist_old_tree_root, false, true, true); } /** * Collapse grouping folders only. */ -void hotlist_collapse_directories(void) +void hotlist_old_collapse_directories(void) { - tree_set_node_expanded(hotlist_tree, hotlist_tree_root, + tree_set_node_expanded(hotlist_old_tree, hotlist_old_tree_root, false, true, false); } /** * Collapse history entries only. */ -void hotlist_collapse_addresses(void) +void hotlist_old_collapse_addresses(void) { - tree_set_node_expanded(hotlist_tree, - hotlist_tree_root, false, false, true); + tree_set_node_expanded(hotlist_old_tree, + hotlist_old_tree_root, false, false, true); } /** @@ -370,24 +370,24 @@ void hotlist_collapse_addresses(void) * * \param selected create the folder in the currently-selected node */ -void hotlist_add_folder(bool selected) +void hotlist_old_add_folder(bool selected) { struct node *node, *parent = NULL; creating_node = true; if (selected == true) { - parent = tree_get_selected_node(tree_get_root(hotlist_tree)); + parent = tree_get_selected_node(tree_get_root(hotlist_old_tree)); if (parent && (tree_node_is_folder(parent) == false)) { parent = tree_node_get_parent(parent); } } if (parent == NULL) { - parent = tree_get_default_folder_node(hotlist_tree); + parent = tree_get_default_folder_node(hotlist_old_tree); } - node = tree_create_folder_node(hotlist_tree, + node = tree_create_folder_node(hotlist_old_tree, parent, messages_get("Untitled"), true, @@ -398,9 +398,9 @@ void hotlist_add_folder(bool selected) return; } - tree_set_node_user_callback(node, hotlist_node_callback, NULL); - tree_set_node_icon(hotlist_tree, node, folder_icon); - tree_start_edit(hotlist_tree, + tree_set_node_user_callback(node, hotlist_old_node_callback, NULL); + tree_set_node_icon(hotlist_old_tree, node, folder_icon); + tree_start_edit(hotlist_old_tree, tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL)); } @@ -409,7 +409,7 @@ void hotlist_add_folder(bool selected) * * \param selected add the entry in the currently-selected node */ -void hotlist_add_entry(bool selected) +void hotlist_old_add_entry(bool selected) { struct node *node; struct node *parent = NULL; @@ -417,33 +417,33 @@ void hotlist_add_entry(bool selected) creating_node = true; if (selected == true) { - parent = tree_get_selected_node(tree_get_root(hotlist_tree)); + parent = tree_get_selected_node(tree_get_root(hotlist_old_tree)); if (parent && (tree_node_is_folder(parent) == false)) { parent = tree_node_get_parent(parent); } } if (parent == NULL) { - parent = tree_get_default_folder_node(hotlist_tree); + parent = tree_get_default_folder_node(hotlist_old_tree); } if (nsurl_create("http://netsurf-browser.org/", &url) != NSERROR_OK) return; - node = tree_create_URL_node(hotlist_tree, parent, url, "Untitled", - hotlist_node_callback, NULL); + node = tree_create_URL_node(hotlist_old_tree, parent, url, "Untitled", + hotlist_old_node_callback, NULL); nsurl_unref(url); if (node == NULL) return; - tree_set_node_user_callback(node, hotlist_node_callback, NULL); - tree_url_node_edit_title(hotlist_tree, node); + tree_set_node_user_callback(node, hotlist_old_node_callback, NULL); + tree_url_node_edit_title(hotlist_old_tree, node); } /** * Adds the currently viewed page to the hotlist */ -void hotlist_add_page(const char *url) +void hotlist_old_add_page(const char *url) { const struct url_data *data; struct node *node, *parent; @@ -459,10 +459,10 @@ void hotlist_add_page(const char *url) if (data == NULL) return; - parent = tree_get_default_folder_node(hotlist_tree); - node = tree_create_URL_node(hotlist_tree, parent, nsurl, NULL, - hotlist_node_callback, NULL); - tree_update_URL_node(hotlist_tree, node, nsurl, data); + parent = tree_get_default_folder_node(hotlist_old_tree); + node = tree_create_URL_node(hotlist_old_tree, parent, nsurl, NULL, + hotlist_old_node_callback, NULL); + tree_update_URL_node(hotlist_old_tree, node, nsurl, data); nsurl_unref(nsurl); } @@ -472,7 +472,7 @@ void hotlist_add_page(const char *url) * \param x X cooridinate with respect to tree origin * \param y Y cooridinate with respect to tree origin */ -void hotlist_add_page_xy(const char *url, int x, int y) +void hotlist_old_add_page_xy(const char *url, int x, int y) { const struct url_data *data; struct node *link, *node; @@ -492,10 +492,10 @@ void hotlist_add_page_xy(const char *url, int x, int y) data = urldb_get_url_data(nsurl); } if (data != NULL) { - link = tree_get_link_details(hotlist_tree, x, y, &before); + link = tree_get_link_details(hotlist_old_tree, x, y, &before); node = tree_create_URL_node(NULL, NULL, nsurl, - NULL, hotlist_node_callback, NULL); - tree_link_node(hotlist_tree, link, node, before); + NULL, hotlist_old_node_callback, NULL); + tree_link_node(hotlist_old_tree, link, node, before); } nsurl_unref(nsurl); } @@ -505,9 +505,9 @@ void hotlist_add_page_xy(const char *url, int x, int y) * * \param tabs open multiple entries in tabs in the new window */ -void hotlist_launch_selected(bool tabs) +void hotlist_old_launch_selected(bool tabs) { - tree_launch_selected(hotlist_tree, tabs); + tree_launch_selected(hotlist_old_tree, tabs); } /** @@ -515,12 +515,12 @@ void hotlist_launch_selected(bool tabs) * * \param clear reset the default to tree root */ -bool hotlist_set_default_folder(bool clear) +bool hotlist_old_set_default_folder(bool clear) { if (clear == true) { - tree_clear_default_folder_node(hotlist_tree); + tree_clear_default_folder_node(hotlist_old_tree); return true; } else { - return tree_set_default_folder_node(hotlist_tree, NULL); + return tree_set_default_folder_node(hotlist_old_tree, NULL); } } diff --git a/desktop/hotlist.h b/desktop/hotlist_old.h index fa7fee228..776bef290 100644 --- a/desktop/hotlist.h +++ b/desktop/hotlist_old.h @@ -23,8 +23,8 @@ * Hotlist (interface). */ -#ifndef _NETSURF_DESKTOP_HOTLIST_H_ -#define _NETSURF_DESKTOP_HOTLIST_H_ +#ifndef _NETSURF_DESKTOP_HOTLIST_OLD_H_ +#define _NETSURF_DESKTOP_HOTLIST_OLD_H_ #include <stdbool.h> @@ -37,28 +37,28 @@ * \param hotlist_path The file path to initialise the hotlist entries from. * \param folder_icon_name The name to use for folder icons. */ -bool hotlist_initialise(struct tree *tree, const char *hotlist_path, const char* folder_icon_name); +bool hotlist_old_initialise(struct tree *tree, const char *hotlist_path, const char* folder_icon_name); -unsigned int hotlist_get_tree_flags(void); -void hotlist_cleanup(const char *hotlist_path); +unsigned int hotlist_old_get_tree_flags(void); +void hotlist_old_cleanup(const char *hotlist_path); -void hotlist_visited(struct hlcache_handle *c); +void hotlist_old_visited(struct hlcache_handle *c); -bool hotlist_export(const char *path); -void hotlist_edit_selected(void); -void hotlist_delete_selected(void); -void hotlist_select_all(void); -void hotlist_clear_selection(void); -void hotlist_expand_all(void); -void hotlist_expand_directories(void); -void hotlist_expand_addresses(void); -void hotlist_collapse_all(void); -void hotlist_collapse_directories(void); -void hotlist_collapse_addresses(void); -void hotlist_add_folder(bool selected); -void hotlist_add_entry(bool selected); -void hotlist_add_page(const char *url); -void hotlist_add_page_xy(const char *url, int x, int y); -void hotlist_launch_selected(bool tabs); -bool hotlist_set_default_folder(bool clear); +bool hotlist_old_export(const char *path); +void hotlist_old_edit_selected(void); +void hotlist_old_delete_selected(void); +void hotlist_old_select_all(void); +void hotlist_old_clear_selection(void); +void hotlist_old_expand_all(void); +void hotlist_old_expand_directories(void); +void hotlist_old_expand_addresses(void); +void hotlist_old_collapse_all(void); +void hotlist_old_collapse_directories(void); +void hotlist_old_collapse_addresses(void); +void hotlist_old_add_folder(bool selected); +void hotlist_old_add_entry(bool selected); +void hotlist_old_add_page(const char *url); +void hotlist_old_add_page_xy(const char *url, int x, int y); +void hotlist_old_launch_selected(bool tabs); +bool hotlist_old_set_default_folder(bool clear); #endif diff --git a/desktop/sslcert.c b/desktop/sslcert.c deleted file mode 100644 index d5e7f6f55..000000000 --- a/desktop/sslcert.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/** \file - * SSL Certificate verification UI (implementation) - */ - -#include "utils/config.h" - -#include <assert.h> -#include <stdbool.h> -#include <string.h> -#include "content/content.h" -#include "content/fetch.h" -#include "content/hlcache.h" -#include "content/urldb.h" -#include "desktop/browser.h" -#include "desktop/sslcert.h" -#include "desktop/tree.h" -#include "utils/log.h" -#include "utils/messages.h" -#include "utils/nsurl.h" -#include "utils/utils.h" - -/** Flags for each type of ssl tree node. */ -enum tree_element_ssl { - TREE_ELEMENT_SSL_VERSION = 0x01, - TREE_ELEMENT_SSL_VALID_FROM = 0x02, - TREE_ELEMENT_SSL_VALID_TO = 0x03, - TREE_ELEMENT_SSL_CERT_TYPE = 0x04, - TREE_ELEMENT_SSL_SERIAL = 0x05, - TREE_ELEMENT_SSL_ISSUER = 0x06, -}; - -/** ssl certificate verification context. */ -struct sslcert_session_data { - unsigned long num; /**< The number of ssl certificates in the chain */ - nsurl *url; /**< The url of the certificate */ - struct tree *tree; /**< The root of the treeview */ - llcache_query_response cb; /**< callback when cert is accepted or rejected */ - void *cbpw; /**< context passed to callback */ -}; - -/** Handle for the window icon. */ -static hlcache_handle *sslcert_icon = NULL; - -/** Initialise ssl certificate window. */ -void sslcert_init(const char* icon_name) -{ - sslcert_icon = tree_load_icon(icon_name); -} - - -/** - * Get flags with which the sslcert tree should be created; - * - * \return the flags - */ -unsigned int sslcert_get_tree_flags(void) -{ - return TREE_NO_DRAGS | TREE_NO_SELECT | TREE_SSLCERT; -} - - -void sslcert_cleanup(void) -{ - if (sslcert_icon != NULL) - hlcache_handle_release(sslcert_icon); -} - -struct sslcert_session_data * -sslcert_create_session_data(unsigned long num, - nsurl *url, - llcache_query_response cb, - void *cbpw) -{ - struct sslcert_session_data *data; - - data = malloc(sizeof(struct sslcert_session_data)); - if (data == NULL) { - warn_user("NoMemory", 0); - return NULL; - } - data->url = nsurl_ref(url); - if (data->url == NULL) { - free(data); - warn_user("NoMemory", 0); - return NULL; - } - data->num = num; - data->cb = cb; - data->cbpw = cbpw; - - return data; -} - -static node_callback_resp sslcert_node_callback(void *user_data, - struct node_msg_data *msg_data) -{ - if (msg_data->msg == NODE_DELETE_ELEMENT_IMG) - return NODE_CALLBACK_HANDLED; - return NODE_CALLBACK_NOT_HANDLED; -} - -static struct node *sslcert_create_node(const struct ssl_cert_info *cert) -{ - struct node *node = NULL; - struct node_element *element; - char *text; - - text = messages_get_buff("SSL_Certificate_Subject", cert->subject); - if (text != NULL) { - node = tree_create_leaf_node(NULL, - NULL, - text, - false, false, false); - free(text); - } - if (node == NULL) { - return NULL; - } - - tree_set_node_user_callback(node, sslcert_node_callback, NULL); - - /* add issuer node */ - element = tree_create_node_element(node, NODE_ELEMENT_TEXT, - TREE_ELEMENT_SSL_ISSUER, false); - if (element != NULL) { - text = messages_get_buff("SSL_Certificate_Issuer", cert->issuer); - if (text == NULL) { - tree_delete_node(NULL, node, false); - return NULL; - } - tree_update_node_element(NULL, element, text, NULL); - } - - /* add version node */ - element = tree_create_node_element(node, NODE_ELEMENT_TEXT, - TREE_ELEMENT_SSL_VERSION, false); - if (element != NULL) { - text = messages_get_buff("SSL_Certificate_Version", cert->version); - if (text == NULL) { - tree_delete_node(NULL, node, false); - return NULL; - } - tree_update_node_element(NULL, element, text, NULL); - } - - /* add valid from node */ - element = tree_create_node_element(node, NODE_ELEMENT_TEXT, - TREE_ELEMENT_SSL_VALID_FROM, false); - if (element != NULL) { - text = messages_get_buff("SSL_Certificate_ValidFrom", cert->not_before); - if (text == NULL) { - tree_delete_node(NULL, node, false); - return NULL; - } - tree_update_node_element(NULL, element, text, NULL); - } - - - /* add valid to node */ - element = tree_create_node_element(node, NODE_ELEMENT_TEXT, - TREE_ELEMENT_SSL_VALID_TO, false); - if (element != NULL) { - text = messages_get_buff("SSL_Certificate_ValidTo", cert->not_after); - if (text == NULL) { - tree_delete_node(NULL, node, false); - return NULL; - } - tree_update_node_element(NULL, element, text, NULL); - } - - /* add certificate type */ - element = tree_create_node_element(node, NODE_ELEMENT_TEXT, - TREE_ELEMENT_SSL_CERT_TYPE, false); - if (element != NULL) { - text = messages_get_buff("SSL_Certificate_Type", cert->cert_type); - if (text == NULL) { - tree_delete_node(NULL, node, false); - return NULL; - } - tree_update_node_element(NULL, element, text, NULL); - } - - /* add serial node */ - element = tree_create_node_element(node, NODE_ELEMENT_TEXT, - TREE_ELEMENT_SSL_SERIAL, false); - if (element != NULL) { - text = messages_get_buff("SSL_Certificate_Serial", cert->serial); - if (text == NULL) { - tree_delete_node(NULL, node, false); - return NULL; - } - tree_update_node_element(NULL, element, text, NULL); - } - - /* set the display icon */ - tree_set_node_icon(NULL, node, sslcert_icon); - - return node; -} - -bool sslcert_load_tree(struct tree *tree, - const struct ssl_cert_info *certs, - struct sslcert_session_data *data) -{ - struct node *tree_root; - struct node *node; - unsigned long cert_loop; - - assert(data != NULL && certs != NULL && tree != NULL); - - tree_root = tree_get_root(tree); - - for (cert_loop = 0; cert_loop < data->num; cert_loop++) { - node = sslcert_create_node(&(certs[cert_loop])); - if (node != NULL) { - /* There is no problem creating the node - * add an entry for it in the root of the - * treeview . - */ - tree_link_node(tree, tree_root, node, false); - } - } - - data->tree = tree; - - return true; - -} - - -static void sslcert_cleanup_session(struct sslcert_session_data *session) -{ - assert(session != NULL); - - if (session->url) - nsurl_unref(session->url); - - free(session); -} - - - -bool sslcert_reject(struct sslcert_session_data *session) -{ - session->cb(false, session->cbpw); - sslcert_cleanup_session(session); - return true; -} - - -/** - * Handle acceptance of certificate - */ -bool sslcert_accept(struct sslcert_session_data *session) -{ - assert(session != NULL); - - urldb_set_cert_permissions(session->url, true); - - session->cb(true, session->cbpw); - - sslcert_cleanup_session(session); - - return true; -} diff --git a/desktop/sslcert.h b/desktop/sslcert.h deleted file mode 100644 index a9a2587fc..000000000 --- a/desktop/sslcert.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - -#ifndef _NETSURF_DESKTOP_SSLCERT_H_ -#define _NETSURF_DESKTOP_SSLCERT_H_ - -#include <stdbool.h> - -#include "desktop/tree.h" - -struct sslcert_session_data; - -void sslcert_init(const char* icon_name); -unsigned int sslcert_get_tree_flags(void); -void sslcert_cleanup(void); - -struct sslcert_session_data *sslcert_create_session_data(unsigned long num, - nsurl *url, llcache_query_response cb, void *cbpw); -bool sslcert_load_tree(struct tree *tree, - const struct ssl_cert_info *certs, - struct sslcert_session_data *data); - -bool sslcert_reject(struct sslcert_session_data *session); -bool sslcert_accept(struct sslcert_session_data *session); - - -#endif diff --git a/desktop/sslcert_viewer.c b/desktop/sslcert_viewer.c new file mode 100644 index 000000000..0f30f3f88 --- /dev/null +++ b/desktop/sslcert_viewer.c @@ -0,0 +1,507 @@ +/* + * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net> + * Copyright 2013 Michael Drake <tlsa@netsurf-browser.org> + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** \file + * SSL Certificate verification UI (implementation) + */ + +#include <assert.h> +#include <stdlib.h> + + +#include "content/fetch.h" +#include "content/urldb.h" +#include "desktop/browser.h" +#include "desktop/sslcert_viewer.h" +#include "desktop/treeview.h" +#include "utils/messages.h" +#include "utils/log.h" +#include "utils/utils.h" + +enum sslcert_viewer_field { + SSLCERT_V_SUBJECT, + SSLCERT_V_SERIAL, + SSLCERT_V_TYPE, + SSLCERT_V_VALID_UNTIL, + SSLCERT_V_VALID_FROM, + SSLCERT_V_VERSION, + SSLCERT_V_ISSUER, + SSLCERT_V_CERTIFICATES, + SSLCERT_V_N_FIELDS +}; + +/** ssl certificate verification context. */ +struct sslcert_session_data { + const struct ssl_cert_info *certs; /**< Certificates */ + unsigned long num; /**< Number of certificates in chain */ + nsurl *url; /**< The url of the certificate */ + llcache_query_response cb; /**< Cert accept/reject callback */ + void *cbpw; /**< Context passed to callback */ + + treeview *tree; /**< The treeview object */ + struct treeview_field_desc fields[SSLCERT_V_N_FIELDS]; +}; + +struct sslcert_entry { + treeview_node *entry; + char version[24]; + char serial[24]; + char type[24]; + struct treeview_field_data data[SSLCERT_V_N_FIELDS - 1]; +}; + + +/** + * Free a sll certificate viewer entry's treeview field data. + * + * \param e Entry to free data from + */ +static void sslcert_viewer_free_treeview_field_data( + struct sslcert_entry *e) +{ +} + + +/** + * Build a sslcert viewer treeview field from given text + * + * \param field SSL certificate treeview field to build + * \param data SSL certificate entry field data to set + * \param value Text to set in field, ownership yielded + * \param ssl_d SSL certificate session data + * \return NSERROR_OK on success, appropriate error otherwise + */ +static inline nserror sslcert_viewer_field_builder( + enum sslcert_viewer_field field, + struct treeview_field_data *data, + const char *value, + struct sslcert_session_data *ssl_d) +{ + data->field = ssl_d->fields[field].field; + data->value = value; + data->value_len = (value != NULL) ? strlen(value) : 0; + + return NSERROR_OK; +} + + +/** + * Set a sslcert viewer entry's data from the certificate. + * + * \param e Entry to set up + * \param cert Data associated with entry's certificate + * \param ssl_d SSL certificate session data + * \return NSERROR_OK on success, appropriate error otherwise + */ +static nserror sslcert_viewer_set_treeview_field_data( + struct sslcert_entry *e, + const struct ssl_cert_info *cert, + struct sslcert_session_data *ssl_d) +{ + unsigned int written; + + assert(e != NULL); + assert(cert != NULL); + assert(ssl_d != NULL); + + /* Set the fields up */ + sslcert_viewer_field_builder(SSLCERT_V_SUBJECT, + &e->data[SSLCERT_V_SUBJECT], + cert->subject, ssl_d); + + written = snprintf(e->serial, sizeof(e->serial), "%li", cert->serial); + assert(written < sizeof(e->serial)); + sslcert_viewer_field_builder(SSLCERT_V_SERIAL, + &e->data[SSLCERT_V_SERIAL], + e->serial, ssl_d); + + written = snprintf(e->type, sizeof(e->type), "%i", cert->cert_type); + assert(written < sizeof(e->type)); + sslcert_viewer_field_builder(SSLCERT_V_TYPE, + &e->data[SSLCERT_V_TYPE], + e->type, ssl_d); + + sslcert_viewer_field_builder(SSLCERT_V_VALID_UNTIL, + &e->data[SSLCERT_V_VALID_UNTIL], + cert->not_after, ssl_d); + + sslcert_viewer_field_builder(SSLCERT_V_VALID_FROM, + &e->data[SSLCERT_V_VALID_FROM], + cert->not_before, ssl_d); + + written = snprintf(e->version, sizeof(e->version), + "%li", cert->version); + assert(written < sizeof(e->version)); + sslcert_viewer_field_builder(SSLCERT_V_VERSION, + &e->data[SSLCERT_V_VERSION], + e->version, ssl_d); + + sslcert_viewer_field_builder(SSLCERT_V_ISSUER, + &e->data[SSLCERT_V_ISSUER], + cert->issuer, ssl_d); + + return NSERROR_OK; +} + + +/** + * Create a treeview node for a certificate + * + * \param ssl_d SSL certificate session data + * \param n Number of SSL certificate in chain, to make node for + * \return true on success, false on memory exhaustion + */ +static nserror sslcert_viewer_create_node( + struct sslcert_session_data *ssl_d, int n) +{ + struct sslcert_entry *e; + const struct ssl_cert_info *cert = &(ssl_d->certs[n]); + nserror err; + + /* Create new certificate viewer entry */ + e = malloc(sizeof(struct sslcert_entry)); + if (e == NULL) { + return NSERROR_NOMEM; + } + + err = sslcert_viewer_set_treeview_field_data(e, cert, ssl_d); + if (err != NSERROR_OK) { + free(e); + return err; + } + + /* Create the new treeview node */ + err = treeview_create_node_entry(ssl_d->tree, &(e->entry), + NULL, TREE_REL_FIRST_CHILD, + e->data, e, TREE_CREATE_NONE); + if (err != NSERROR_OK) { + sslcert_viewer_free_treeview_field_data(e); + free(e); + return err; + } + + return NSERROR_OK; +} + + +/** + * Initialise the treeview entry feilds + * + * \param ssl_d SSL certificate session data + * \return true on success, false on memory exhaustion + */ +static nserror sslcert_init_entry_fields(struct sslcert_session_data *ssl_d) +{ + int i; + const char *label; + + for (i = 0; i < SSLCERT_V_N_FIELDS; i++) + ssl_d->fields[i].field = NULL; + + ssl_d->fields[SSLCERT_V_SUBJECT].flags = TREE_FLAG_DEFAULT; + label = "TreeviewLabelSubject"; + label = messages_get(label); + if (lwc_intern_string(label, strlen(label), + &ssl_d->fields[SSLCERT_V_SUBJECT].field) != + lwc_error_ok) { + goto error; + } + + ssl_d->fields[SSLCERT_V_SERIAL].flags = TREE_FLAG_SHOW_NAME; + label = "TreeviewLabelSerial"; + label = messages_get(label); + if (lwc_intern_string(label, strlen(label), + &ssl_d->fields[SSLCERT_V_SERIAL].field) != + lwc_error_ok) { + goto error; + } + + ssl_d->fields[SSLCERT_V_TYPE].flags = TREE_FLAG_SHOW_NAME; + label = "TreeviewLabelType"; + label = messages_get(label); + if (lwc_intern_string(label, strlen(label), + &ssl_d->fields[SSLCERT_V_TYPE].field) != + lwc_error_ok) { + goto error; + } + + ssl_d->fields[SSLCERT_V_VALID_UNTIL].flags = TREE_FLAG_SHOW_NAME; + label = "TreeviewLabelValidUntil"; + label = messages_get(label); + if (lwc_intern_string(label, strlen(label), + &ssl_d->fields[SSLCERT_V_VALID_UNTIL].field) != + lwc_error_ok) { + goto error; + } + + ssl_d->fields[SSLCERT_V_VALID_FROM].flags = TREE_FLAG_SHOW_NAME; + label = "TreeviewLabelValidFrom"; + label = messages_get(label); + if (lwc_intern_string(label, strlen(label), + &ssl_d->fields[SSLCERT_V_VALID_FROM].field) != + lwc_error_ok) { + goto error; + } + + ssl_d->fields[SSLCERT_V_VERSION].flags = TREE_FLAG_SHOW_NAME; + label = "TreeviewLabelVersion"; + label = messages_get(label); + if (lwc_intern_string(label, strlen(label), + &ssl_d->fields[SSLCERT_V_VERSION].field) != + lwc_error_ok) { + goto error; + } + + ssl_d->fields[SSLCERT_V_ISSUER].flags = TREE_FLAG_SHOW_NAME; + label = "TreeviewLabelIssuer"; + label = messages_get(label); + if (lwc_intern_string(label, strlen(label), + &ssl_d->fields[SSLCERT_V_ISSUER].field) != + lwc_error_ok) { + goto error; + } + + ssl_d->fields[SSLCERT_V_CERTIFICATES].flags = TREE_FLAG_DEFAULT; + label = "TreeviewLabelCertificates"; + label = messages_get(label); + if (lwc_intern_string(label, strlen(label), + &ssl_d->fields[SSLCERT_V_CERTIFICATES].field) != + lwc_error_ok) { + return false; + } + + return NSERROR_OK; + +error: + for (i = 0; i < SSLCERT_V_N_FIELDS; i++) + if (ssl_d->fields[i].field != NULL) + lwc_string_unref(ssl_d->fields[i].field); + + return NSERROR_UNKNOWN; +} + + +/** + * Delete ssl certificate viewer entries + * + * \param e Entry to delete. + */ +static void sslcert_viewer_delete_entry(struct sslcert_entry *e) +{ + sslcert_viewer_free_treeview_field_data(e); + free(e); +} + + +static nserror sslcert_viewer_tree_node_folder_cb( + struct treeview_node_msg msg, void *data) +{ + switch (msg.msg) { + case TREE_MSG_NODE_DELETE: + case TREE_MSG_NODE_EDIT: + case TREE_MSG_NODE_LAUNCH: + break; + } + + return NSERROR_OK; +} +static nserror sslcert_viewer_tree_node_entry_cb( + struct treeview_node_msg msg, void *data) +{ + struct sslcert_entry *e = data; + + switch (msg.msg) { + case TREE_MSG_NODE_DELETE: + e->entry = NULL; + sslcert_viewer_delete_entry(e); + break; + + case TREE_MSG_NODE_EDIT: + case TREE_MSG_NODE_LAUNCH: + break; + } + + return NSERROR_OK; +} +struct treeview_callback_table sslv_tree_cb_t = { + .folder = sslcert_viewer_tree_node_folder_cb, + .entry = sslcert_viewer_tree_node_entry_cb +}; + + +/* Exported interface, documented in sslcert_viewer.h */ +nserror sslcert_viewer_init(struct core_window_callback_table *cw_t, + void *core_window_handle, struct sslcert_session_data *ssl_d) +{ + nserror err; + int cert_loop; + + assert(ssl_d != NULL); + + LOG(("Building certificate viewer")); + + /* Init. certificate chain treeview entry fields */ + err = sslcert_init_entry_fields(ssl_d); + if (err != NSERROR_OK) { + ssl_d->tree = NULL; + return err; + } + + /* Create the certificate treeview */ + err = treeview_create(&ssl_d->tree, &sslv_tree_cb_t, + SSLCERT_V_N_FIELDS, ssl_d->fields, + cw_t, core_window_handle, TREEVIEW_READ_ONLY); + if (err != NSERROR_OK) { + ssl_d->tree = NULL; + return err; + } + + /* Build treeview nodes from certificate chain */ + for (cert_loop = ssl_d->num - 1; cert_loop >= 0; cert_loop--) { + err = sslcert_viewer_create_node(ssl_d, cert_loop); + if (err != NSERROR_OK) { + return err; + } + } + + LOG(("Built certificate viewer")); + + return NSERROR_OK; +} + + +/** + * Free SSL certificate session data + * + * \param ssl_d SSL certificate session data + */ +static void sslcert_cleanup_session(struct sslcert_session_data *ssl_d) +{ + assert(ssl_d != NULL); + + if (ssl_d->url) + nsurl_unref(ssl_d->url); + + free(ssl_d); +} + + +/* Exported interface, documented in sslcert_viewer.h */ +nserror sslcert_viewer_fini(struct sslcert_session_data *ssl_d) +{ + int i; + nserror err; + + LOG(("Finalising ssl certificate viewer")); + + /* Destroy the treeview */ + err = treeview_destroy(ssl_d->tree); + + /* Free treeview entry fields */ + for (i = 0; i < SSLCERT_V_N_FIELDS; i++) + if (ssl_d->fields[i].field != NULL) + lwc_string_unref(ssl_d->fields[i].field); + + /* Destroy the sslcert_session_data */ + sslcert_cleanup_session(ssl_d); + + LOG(("Finalised ssl certificate viewer")); + + return err; +} + + +/* Exported interface, documented in sslcert_viewer.h */ +nserror sslcert_viewer_create_session_data(unsigned long num, nsurl *url, + llcache_query_response cb, void *cbpw, + const struct ssl_cert_info *certs, + struct sslcert_session_data **ssl_d) +{ + struct sslcert_session_data *data; + + assert(url != NULL); + assert(certs != NULL); + + data = malloc(sizeof(struct sslcert_session_data)); + if (data == NULL) { + warn_user("NoMemory", 0); + *ssl_d = NULL; + return NSERROR_NOMEM; + } + + data->certs = certs; + data->url = nsurl_ref(url); + data->num = num; + data->cb = cb; + data->cbpw = cbpw; + + data->tree = NULL; + + *ssl_d = data; + return NSERROR_OK; +} + + +/* Exported interface, documented in sslcert_viewer.h */ +nserror sslcert_viewer_reject(struct sslcert_session_data *ssl_d) +{ + assert(ssl_d != NULL); + + ssl_d->cb(false, ssl_d->cbpw); + + return NSERROR_OK; +} + + +/* Exported interface, documented in sslcert_viewer.h */ +nserror sslcert_viewer_accept(struct sslcert_session_data *ssl_d) +{ + assert(ssl_d != NULL); + + urldb_set_cert_permissions(ssl_d->url, true); + + ssl_d->cb(true, ssl_d->cbpw); + + return NSERROR_OK; +} + + +/* Exported interface, documented in sslcert_viewer.h */ +void sslcert_viewer_redraw(struct sslcert_session_data *ssl_d, + int x, int y, struct rect *clip, + const struct redraw_context *ctx) +{ + treeview_redraw(ssl_d->tree, x, y, clip, ctx); +} + + +/* Exported interface, documented in sslcert_viewer.h */ +void sslcert_viewer_mouse_action(struct sslcert_session_data *ssl_d, + browser_mouse_state mouse, int x, int y) +{ + treeview_mouse_action(ssl_d->tree, mouse, x, y); +} + + +/* Exported interface, documented in sslcert_viewer.h */ +void sslcert_viewer_keypress(struct sslcert_session_data *ssl_d, + uint32_t key) +{ + treeview_keypress(ssl_d->tree, key); +} diff --git a/desktop/sslcert_viewer.h b/desktop/sslcert_viewer.h new file mode 100644 index 000000000..4d06461b2 --- /dev/null +++ b/desktop/sslcert_viewer.h @@ -0,0 +1,125 @@ +/* + * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net> + * Copyright 2013 Michael Drake <tlsa@netsurf-browser.org> + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _NETSURF_DESKTOP_SSLCERT_VIEWER_H_ +#define _NETSURF_DESKTOP_SSLCERT_VIEWER_H_ + +#include <stdbool.h> + +#include "desktop/core_window.h" + +struct sslcert_session_data; + + +/** + * Create ssl certificate viewer session data. + * + * \param num The number of certificates in the chain + * \param url Address of the page we're inspecting certificates of + * \param cb Low level cache callback + * \param cbpw Low level cache private data + * \param certs The SSL certificates + * \param ssl_d Updated to SSL certificate session data + * \return NSERROR_OK on success, appropriate error otherwise + * + * Pass the session data to sslcert_viewer_init. + * sslcert_viewer_fini destroys the session data. + */ +nserror sslcert_viewer_create_session_data( + unsigned long num, nsurl *url, llcache_query_response cb, + void *cbpw, const struct ssl_cert_info *certs, + struct sslcert_session_data **ssl_d); + +/** + * Initialise a ssl certificate viewer from session data. + * + * This iterates through the certificates, building a treeview. + * + * \param cw_t Callback table for cert viewer's core_window + * \param cw The core_window in which the cert viewer is shown + * \param ssl_d SSL certificate session data + * \return NSERROR_OK on success, appropriate error otherwise + */ +nserror sslcert_viewer_init(struct core_window_callback_table *cw_t, + void *core_window_handle, struct sslcert_session_data *ssl_d); + +/** + * Finalise a ssl certificate viewer. + * + * This destroys the certificate treeview and the certificate viewer module's + * session data. + * + * \param ssl_d SSL certificate session data + * \return NSERROR_OK on success, appropriate error otherwise + */ +nserror sslcert_viewer_fini(struct sslcert_session_data *ssl_d); + +/** + * Reject a certificate chain. + * + * \param ssl_d SSL certificate session data + * \return NSERROR_OK on success, appropriate error otherwise + */ +nserror sslcert_viewer_reject(struct sslcert_session_data *ssl_d); + +/** + * Accept a certificate chain. + * + * \param ssl_d SSL certificate session data + * \return NSERROR_OK on success, appropriate error otherwise + */ +nserror sslcert_viewer_accept(struct sslcert_session_data *ssl_d); + +/** + * Redraw the ssl certificate viewer. + * + * \param ssl_d SSL certificate session data + * \param x X coordinate to render treeview at + * \param x Y coordinate to render treeview at + * \param clip Current clip rectangle (wrt tree origin) + * \param ctx Current redraw context + */ +void sslcert_viewer_redraw(struct sslcert_session_data *ssl_d, + int x, int y, struct rect *clip, + const struct redraw_context *ctx); + +/** + * Handles all kinds of mouse action + * + * \param ssl_d SSL certificate session data + * \param mouse The current mouse state + * \param x X coordinate + * \param y Y coordinate + */ +void sslcert_viewer_mouse_action(struct sslcert_session_data *ssl_d, + browser_mouse_state mouse, int x, int y); + + +/** + * Key press handling. + * + * \param ssl_d SSL certificate session data + * \param key The ucs4 character codepoint + * \return true if the keypress is dealt with, false otherwise. + */ +void sslcert_viewer_keypress(struct sslcert_session_data *ssl_d, + uint32_t key); + +#endif diff --git a/desktop/tree.c b/desktop/tree.c index 7cac1cbda..0f5697203 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -179,6 +179,7 @@ struct tree { #include "desktop/treeview.h" #include "desktop/cookie_manager.h" #include "desktop/global_history.h" +#include "desktop/sslcert_viewer.h" int treeview_inits; @@ -238,6 +239,22 @@ static bool treeview_test_init(struct tree *tree) { nserror err; + if (tree->flags & TREE_SSLCERT) { + + treeview_inits++; + + if (treeview_inits == 1) + treeview_init(); + + err = sslcert_viewer_init(&cw_t, (struct core_window *)tree, + ssl_current_session); + if (err != NSERROR_OK) { + warn_user("Couldn't init new sslcert viewer.", 0); + } + return true; + } + + /* Check if we're testing the new treeview */ if (nsoption_bool(temp_treeview_test) == false) return false; @@ -266,6 +283,20 @@ static bool treeview_test_fini(struct tree *tree) { nserror err; + if (tree->flags & TREE_SSLCERT) { + err = sslcert_viewer_fini(ssl_current_session); + if (err != NSERROR_OK) { + warn_user("Couldn't finalise sslcert viewer.", 0); + } + + if (treeview_inits == 1) + treeview_fini(); + treeview_inits--; + + return true; + } + + /* Check if we're testing the new treeview */ if (nsoption_bool(temp_treeview_test) == false) return false; @@ -295,14 +326,20 @@ static bool treeview_test_redraw(struct tree *tree, int x, int y, { struct rect clip; - if (nsoption_bool(temp_treeview_test) == false) - return false; - clip.x0 = clip_x; clip.y0 = clip_y; clip.x1 = clip_x + clip_width; clip.y1 = clip_y + clip_height; + if (tree->flags & TREE_SSLCERT) { + sslcert_viewer_redraw(ssl_current_session, x, y, &clip, ctx); + return true; + } + + /* Check if we're testing the new treeview */ + if (nsoption_bool(temp_treeview_test) == false) + return false; + if (tree->flags & TREE_COOKIES) { cookie_manager_redraw(x, y, &clip, ctx); return true; @@ -318,6 +355,12 @@ static bool treeview_test_redraw(struct tree *tree, int x, int y, static bool treeview_test_mouse_action(struct tree *tree, browser_mouse_state mouse, int x, int y) { + if (tree->flags & TREE_SSLCERT) { + sslcert_viewer_mouse_action(ssl_current_session, mouse, x, y); + return true; + } + + /* Check if we're testing the new treeview */ if (nsoption_bool(temp_treeview_test) == false) return false; @@ -335,6 +378,12 @@ static bool treeview_test_mouse_action(struct tree *tree, static bool treeview_test_keypress(struct tree *tree, uint32_t key) { + if (tree->flags & TREE_SSLCERT) { + sslcert_viewer_keypress(ssl_current_session, key); + return true; + } + + /* Check if we're testing the new treeview */ if (nsoption_bool(temp_treeview_test) == false) return false; diff --git a/desktop/tree.h b/desktop/tree.h index 7074f6090..a69a537e9 100644 --- a/desktop/tree.h +++ b/desktop/tree.h @@ -30,6 +30,10 @@ #include "desktop/browser.h" #include "image/bitmap.h" +struct sslcert_session_data; +struct sslcert_session_data *ssl_current_session; + + struct hlcache_handle; /* Tree flags */ diff --git a/desktop/treeview.c b/desktop/treeview.c index c45e91435..5b52db5f7 100644 --- a/desktop/treeview.c +++ b/desktop/treeview.c @@ -148,12 +148,14 @@ struct treeview_resource { bool ready; }; /**< Treeview content resource data */ enum treeview_resource_id { - TREE_RES_CONTENT = 0, + TREE_RES_ARROW = 0, + TREE_RES_CONTENT, TREE_RES_FOLDER, TREE_RES_SEARCH, TREE_RES_LAST }; static struct treeview_resource treeview_res[TREE_RES_LAST] = { + { "resource:icons/arrow-l.png", NULL, 0, false }, { "resource:icons/content.png", NULL, 0, false }, { "resource:icons/directory.png", NULL, 0, false }, { "resource:icons/search.png", NULL, 0, false } @@ -53,7 +53,7 @@ #include "desktop/save_complete.h" #include "desktop/save_pdf/pdf_plotters.h" #include "desktop/searchweb.h" -#include "desktop/sslcert.h" +#include "desktop/sslcert_viewer.h" #include "desktop/textinput.h" #include "desktop/tree.h" #include "css/utils.h" @@ -461,8 +461,6 @@ static void gui_init(int argc, char** argv, char **respath) if (nsgtk_hotlist_init(glade_file_location->hotlist) == false) die("Unable to initialise hotlist window.\n"); - sslcert_init(tree_content_icon_name); - /* If there is a url specified on the command line use it */ if (argc > 1) { addr = argv[1]; @@ -663,7 +661,6 @@ void gui_quit(void) nsgtk_cookies_destroy(); nsgtk_history_destroy(); nsgtk_hotlist_destroy(); - sslcert_cleanup(); free(print_options_file_location); free(search_engines_file_location); free(search_default_ico_location); @@ -787,20 +784,20 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, return; } - data = sslcert_create_session_data(num, url, cb, cbpw); - + sslcert_viewer_create_session_data(num, url, cb, cbpw, certs, + &data); + ssl_current_session = data; + window = GTK_WINDOW(gtk_builder_get_object(builder, "wndSSLProblem")); scrolled = GTK_SCROLLED_WINDOW(gtk_builder_get_object(builder, "SSLScrolled")); drawing_area = GTK_DRAWING_AREA(gtk_builder_get_object(builder, "SSLDrawingArea")); - ssl_window = nsgtk_treeview_create(sslcert_get_tree_flags(), - window, scrolled, drawing_area); + ssl_window = nsgtk_treeview_create(TREE_SSLCERT, window, scrolled, + drawing_area); if (ssl_window == NULL) return; - sslcert_load_tree(nsgtk_treeview_get_tree(ssl_window), certs, data); - accept = GTK_BUTTON(gtk_builder_get_object(builder, "sslaccept")); reject = GTK_BUTTON(gtk_builder_get_object(builder, "sslreject")); @@ -826,7 +823,7 @@ void nsgtk_ssl_accept(GtkButton *w, gpointer data) struct nsgtk_treeview *wnd = session[1]; struct sslcert_session_data *ssl_data = session[2]; - sslcert_accept(ssl_data); + sslcert_viewer_accept(ssl_data); nsgtk_treeview_destroy(wnd); g_object_unref(G_OBJECT(x)); @@ -840,7 +837,7 @@ void nsgtk_ssl_reject(GtkWidget *w, gpointer data) struct nsgtk_treeview *wnd = session[1]; struct sslcert_session_data *ssl_data = session[2]; - sslcert_reject(ssl_data); + sslcert_viewer_reject(ssl_data); nsgtk_treeview_destroy(wnd); g_object_unref(G_OBJECT(x)); diff --git a/gtk/hotlist.c b/gtk/hotlist.c index d249d3444..834699a1d 100644 --- a/gtk/hotlist.c +++ b/gtk/hotlist.c @@ -17,7 +17,7 @@ */ -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "utils/nsoption.h" #include "desktop/plotters.h" #include "desktop/tree.h" @@ -121,7 +121,7 @@ bool nsgtk_hotlist_init(const char *glade_file_location) "hotlistDrawingArea")); - hotlist_window = nsgtk_treeview_create(hotlist_get_tree_flags(), window, + hotlist_window = nsgtk_treeview_create(hotlist_old_get_tree_flags(), window, scrolled, drawing_area); if (hotlist_window == NULL) @@ -133,7 +133,7 @@ bool nsgtk_hotlist_init(const char *glade_file_location) CONNECT(window, "delete_event", gtk_widget_hide_on_delete, NULL); CONNECT(window, "hide", nsgtk_tree_window_hide, hotlist_window); - hotlist_initialise(nsgtk_treeview_get_tree(hotlist_window), + hotlist_old_initialise(nsgtk_treeview_get_tree(hotlist_window), nsoption_charp(hotlist_path), tree_directory_icon_name); @@ -168,7 +168,7 @@ void nsgtk_hotlist_init_menu(void) void nsgtk_hotlist_destroy(void) { /* TODO: what about gladeFile? */ - hotlist_cleanup(nsoption_charp(hotlist_path)); + hotlist_old_cleanup(nsoption_charp(hotlist_path)); nsgtk_treeview_destroy(hotlist_window); } @@ -194,7 +194,7 @@ MENUHANDLER(export) gchar *filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(save_dialog)); - hotlist_export(filename); + hotlist_old_export(filename); g_free(filename); } @@ -205,80 +205,80 @@ MENUHANDLER(export) MENUHANDLER(new_folder) { - hotlist_add_folder(true); + hotlist_old_add_folder(true); return TRUE; } MENUHANDLER(new_entry) { - hotlist_add_entry(true); + hotlist_old_add_entry(true); return TRUE; } /* edit menu */ MENUHANDLER(edit_selected) { - hotlist_edit_selected(); + hotlist_old_edit_selected(); return TRUE; } MENUHANDLER(delete_selected) { - hotlist_delete_selected(); + hotlist_old_delete_selected(); return TRUE; } MENUHANDLER(select_all) { - hotlist_select_all(); + hotlist_old_select_all(); return TRUE; } MENUHANDLER(clear_selection) { - hotlist_clear_selection(); + hotlist_old_clear_selection(); return TRUE; } /* view menu*/ MENUHANDLER(expand_all) { - hotlist_expand_all(); + hotlist_old_expand_all(); return TRUE; } MENUHANDLER(expand_directories) { - hotlist_expand_directories(); + hotlist_old_expand_directories(); return TRUE; } MENUHANDLER(expand_addresses) { - hotlist_expand_addresses(); + hotlist_old_expand_addresses(); return TRUE; } MENUHANDLER(collapse_all) { - hotlist_collapse_all(); + hotlist_old_collapse_all(); return TRUE; } MENUHANDLER(collapse_directories) { - hotlist_collapse_directories(); + hotlist_old_collapse_directories(); return TRUE; } MENUHANDLER(collapse_addresses) { - hotlist_collapse_addresses(); + hotlist_old_collapse_addresses(); return TRUE; } MENUHANDLER(launch) { - hotlist_launch_selected(true); + hotlist_old_launch_selected(true); return TRUE; } diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c index c0736985c..d2aabafb4 100644 --- a/gtk/scaffolding.c +++ b/gtk/scaffolding.c @@ -34,7 +34,7 @@ #include "css/utils.h" #include "desktop/browser_private.h" #include "desktop/local_history.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "desktop/gui.h" #include "desktop/netsurf.h" #include "utils/nsoption.h" @@ -1540,7 +1540,7 @@ MULTIHANDLER(addbookmarks) if (bw == NULL || bw->current_content == NULL || hlcache_handle_get_url(bw->current_content) == NULL) return TRUE; - hotlist_add_page(nsurl_access(hlcache_handle_get_url(bw->current_content))); + hotlist_old_add_page(nsurl_access(hlcache_handle_get_url(bw->current_content))); return TRUE; } diff --git a/monkey/main.c b/monkey/main.c index e806b0eb3..95432e3c7 100644 --- a/monkey/main.c +++ b/monkey/main.c @@ -30,7 +30,6 @@ #include "content/fetchers/resource.h" #include "desktop/gui.h" #include "desktop/netsurf.h" -#include "desktop/sslcert.h" #include "utils/log.h" #include "utils/filepath.h" #include "utils/url.h" @@ -60,10 +59,9 @@ void gui_quit(void) { urldb_save_cookies(nsoption_charp(cookie_jar)); urldb_save(nsoption_charp(url_file)); - sslcert_cleanup(); - free(nsoption_charp(cookie_file)); - free(nsoption_charp(cookie_jar)); - gtk_fetch_filetype_fin(); + free(nsoption_charp(cookie_file)); + free(nsoption_charp(cookie_jar)); + gtk_fetch_filetype_fin(); } nsurl *gui_get_resource_url(const char *path) @@ -159,8 +157,6 @@ main(int argc, char **argv) urldb_load(nsoption_charp(url_file)); urldb_load_cookies(nsoption_charp(cookie_file)); - - sslcert_init("content.png"); monkey_prepare_input(); monkey_register_handler("QUIT", quit_handler); diff --git a/resources/FatMessages b/resources/FatMessages index 283c76c18..086a63588 100644 --- a/resources/FatMessages +++ b/resources/FatMessages @@ -1223,6 +1223,32 @@ fr.all.TreeviewLabelDomainFolder:Domain folder it.all.TreeviewLabelDomainFolder:Domain folder nl.all.TreeviewLabelDomainFolder:Domain folder +en.all.TreeviewLabelSerial:Serial +de.all.TreeviewLabelSerial:Serial +fr.all.TreeviewLabelSerial:Serial +it.all.TreeviewLabelSerial:Serial +nl.all.TreeviewLabelSerial:Serial +en.all.TreeviewLabelType:Type +de.all.TreeviewLabelType:Type +fr.all.TreeviewLabelType:Type +it.all.TreeviewLabelType:Type +nl.all.TreeviewLabelType:Type +en.all.TreeviewLabelValidUntil:Valid until +de.all.TreeviewLabelValidUntil:Valid until +fr.all.TreeviewLabelValidUntil:Valid until +it.all.TreeviewLabelValidUntil:Valid until +nl.all.TreeviewLabelValidUntil:Valid until +en.all.TreeviewLabelValidFrom:Valid from +de.all.TreeviewLabelValidFrom:Valid from +fr.all.TreeviewLabelValidFrom:Valid from +it.all.TreeviewLabelValidFrom:Valid from +nl.all.TreeviewLabelValidFrom:Valid from +en.all.TreeviewLabelIssuer:Issuer +de.all.TreeviewLabelIssuer:Issuer +fr.all.TreeviewLabelIssuer:Issuer +it.all.TreeviewLabelIssuer:Issuer +nl.all.TreeviewLabelIssuer:Issuer + # Cookie Manager field values # diff --git a/riscos/gui.c b/riscos/gui.c index 81b8a6309..3365d813c 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -58,11 +58,10 @@ #include "desktop/cookies_old.h" #include "desktop/gui.h" #include "desktop/history_global_core.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "desktop/netsurf.h" #include "utils/nsoption.h" #include "desktop/save_complete.h" -#include "desktop/sslcert.h" #include "desktop/tree.h" #include "desktop/tree_url_node.h" #include "render/font.h" @@ -943,8 +942,7 @@ void gui_quit(void) ro_gui_window_quit(); history_global_cleanup(); cookies_cleanup(); - hotlist_cleanup(nsoption_charp(hotlist_save)); - sslcert_cleanup(); + hotlist_old_cleanup(nsoption_charp(hotlist_save)); ro_gui_saveas_quit(); rufl_quit(); free(gui_sprites); diff --git a/riscos/hotlist.c b/riscos/hotlist.c index b8449cd21..fc97a0287 100644 --- a/riscos/hotlist.c +++ b/riscos/hotlist.c @@ -33,7 +33,7 @@ #include "content/content.h" #include "content/hlcache.h" #include "content/urldb.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "desktop/tree.h" #include "riscos/dialog.h" #include "riscos/hotlist.h" @@ -131,7 +131,7 @@ void ro_gui_hotlist_postinitialise(void) hotlist_window.tv = ro_treeview_create(hotlist_window.window, hotlist_window.toolbar, &ro_hotlist_treeview_callbacks, - hotlist_get_tree_flags()); + hotlist_old_get_tree_flags()); if (hotlist_window.tv == NULL) { LOG(("Failed to allocate treeview")); return; @@ -142,7 +142,7 @@ void ro_gui_hotlist_postinitialise(void) /* Initialise the hotlist into the tree. */ - hotlist_initialise(ro_treeview_get_tree(hotlist_window.tv), + hotlist_old_initialise(ro_treeview_get_tree(hotlist_window.tv), nsoption_charp(hotlist_path), tree_directory_icon_name); @@ -236,31 +236,31 @@ void ro_gui_hotlist_toolbar_click(button_bar_action action) { switch (action) { case TOOLBAR_BUTTON_DELETE: - hotlist_delete_selected(); + hotlist_old_delete_selected(); break; case TOOLBAR_BUTTON_EXPAND: - hotlist_expand_addresses(); + hotlist_old_expand_addresses(); break; case TOOLBAR_BUTTON_COLLAPSE: - hotlist_collapse_addresses(); + hotlist_old_collapse_addresses(); break; case TOOLBAR_BUTTON_OPEN: - hotlist_expand_directories(); + hotlist_old_expand_directories(); break; case TOOLBAR_BUTTON_CLOSE: - hotlist_collapse_directories(); + hotlist_old_collapse_directories(); break; case TOOLBAR_BUTTON_LAUNCH: - hotlist_launch_selected(false); + hotlist_old_launch_selected(false); break; case TOOLBAR_BUTTON_CREATE: - hotlist_add_folder(true); + hotlist_old_add_folder(true); break; default: @@ -375,43 +375,43 @@ bool ro_gui_hotlist_menu_select(wimp_w w, wimp_i i, wimp_menu *menu, ro_gui_dialog_open_persistent(w, dialog_saveas, true); return true; case TREE_NEW_FOLDER: - hotlist_add_folder(true); + hotlist_old_add_folder(true); return true; case TREE_NEW_LINK: - hotlist_add_entry(true); + hotlist_old_add_entry(true); return true; case TREE_EXPAND_ALL: - hotlist_expand_all(); + hotlist_old_expand_all(); return true; case TREE_EXPAND_FOLDERS: - hotlist_expand_directories(); + hotlist_old_expand_directories(); return true; case TREE_EXPAND_LINKS: - hotlist_expand_addresses(); + hotlist_old_expand_addresses(); return true; case TREE_COLLAPSE_ALL: - hotlist_collapse_all(); + hotlist_old_collapse_all(); return true; case TREE_COLLAPSE_FOLDERS: - hotlist_collapse_directories(); + hotlist_old_collapse_directories(); return true; case TREE_COLLAPSE_LINKS: - hotlist_collapse_addresses(); + hotlist_old_collapse_addresses(); return true; case TREE_SELECTION_EDIT: - hotlist_edit_selected(); + hotlist_old_edit_selected(); return true; case TREE_SELECTION_LAUNCH: - hotlist_launch_selected(false); + hotlist_old_launch_selected(false); return true; case TREE_SELECTION_DELETE: - hotlist_delete_selected(); + hotlist_old_delete_selected(); return true; case TREE_SELECT_ALL: - hotlist_select_all(); + hotlist_old_select_all(); return true; case TREE_CLEAR_SELECTION: - hotlist_clear_selection(); + hotlist_old_clear_selection(); return true; case TOOLBAR_BUTTONS: ro_toolbar_set_display_buttons(hotlist_window.toolbar, @@ -482,7 +482,7 @@ void ro_gui_hotlist_add_page(const char *url) */ if (!nsoption_bool(external_hotlists)) { - hotlist_add_page(url); + hotlist_old_add_page(url); return; } @@ -543,7 +543,7 @@ static void ro_gui_hotlist_addurl_bounce(wimp_message *message) LOG(("Hotlist AddURL Bounced")); if (hotlist_url != NULL) - hotlist_add_page(hotlist_url); + hotlist_old_add_page(hotlist_url); ro_gui_hotlist_add_cleanup(); @@ -606,7 +606,7 @@ void ro_gui_hotlist_url_drop(wimp_message *message, const char *url) message->data.data_xfer.pos.x, message->data.data_xfer.pos.y, &x, &y); - hotlist_add_page_xy(url, x, y); + hotlist_old_add_page_xy(url, x, y); } #endif diff --git a/riscos/menus.c b/riscos/menus.c index bf9fa84a2..5a576f879 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -39,7 +39,6 @@ #include "desktop/gui.h" #include "desktop/history_global_core.h" #include "desktop/local_history.h" -#include "desktop/hotlist.h" #include "desktop/netsurf.h" #include "desktop/textinput.h" #include "riscos/dialog.h" diff --git a/riscos/save.c b/riscos/save.c index 390165d3b..0a9114080 100644 --- a/riscos/save.c +++ b/riscos/save.c @@ -37,7 +37,7 @@ #include "oslib/wimpspriteop.h" #include "content/content.h" #include "content/hlcache.h" -#include "desktop/hotlist.h" +#include "desktop/hotlist_old.h" #include "desktop/history_global_core.h" #include "desktop/netsurf.h" #include "desktop/save_complete.h" @@ -882,7 +882,7 @@ bool ro_gui_save_content(hlcache_handle *h, char *path, bool force_overwrite) LINK_TEXT, path); case GUI_SAVE_HOTLIST_EXPORT_HTML: - if (!hotlist_export(path)) + if (!hotlist_old_export(path)) return false; error = xosfile_set_type(path, 0xfaf); if (error) diff --git a/riscos/sslcert.c b/riscos/sslcert.c index 2490e2e6c..4835817da 100644 --- a/riscos/sslcert.c +++ b/riscos/sslcert.c @@ -33,7 +33,7 @@ #include "content/fetch.h" #include "content/urldb.h" #include "desktop/browser.h" -#include "desktop/sslcert.h" +#include "desktop/sslcert_viewer.h" #include "desktop/gui.h" #include "desktop/tree.h" #include "riscos/dialog.h" @@ -94,8 +94,6 @@ void ro_gui_cert_preinitialise(void) void ro_gui_cert_postinitialise(void) { /* Initialise the SSL module. */ - - sslcert_init(tree_content_icon_name); } /** @@ -148,19 +146,18 @@ void gui_cert_verify(nsurl *url, } /* Create the SSL data and build a tree from it. */ + sslcert_viewer_create_session_data(num, url, + cb, cbpw, certs, &sslcert_window->data); + ssl_current_session = sslcert_window->data; sslcert_window->tv = ro_treeview_create(sslcert_window->pane, - NULL, NULL, sslcert_get_tree_flags()); + NULL, NULL, TREE_SSLCERT); if (sslcert_window->tv == NULL) { LOG(("Failed to allocate treeview")); free(sslcert_window); return; } - sslcert_window->data = sslcert_create_session_data(num, url, cb, cbpw); - sslcert_load_tree(ro_treeview_get_tree(sslcert_window->tv), - certs, sslcert_window->data); - tree_set_redraw(ro_treeview_get_tree(sslcert_window->tv), true); /* Set up the certificate window event handling. @@ -284,7 +281,7 @@ void ro_gui_cert_accept(wimp_pointer *pointer) s = (struct ro_sslcert *) ro_gui_wimp_event_get_user_data(pointer->w); if (s != NULL) { - sslcert_accept(s->data); + sslcert_viewer_accept(s->data); ro_gui_dialog_close(s->window); ro_gui_cert_release_window(s); } @@ -303,7 +300,7 @@ void ro_gui_cert_reject(wimp_pointer *pointer) s = (struct ro_sslcert *) ro_gui_wimp_event_get_user_data(pointer->w); if (s != NULL) { - sslcert_reject(s->data); + sslcert_viewer_reject(s->data); ro_gui_dialog_close(s->window); ro_gui_cert_release_window(s); } diff --git a/riscos/window.c b/riscos/window.c index cbb31cf63..797176378 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -50,7 +50,6 @@ #include "desktop/scrollbar.h" #include "desktop/frames.h" #include "desktop/local_history.h" -#include "desktop/hotlist.h" #include "desktop/mouse.h" #include "desktop/plotters.h" #include "desktop/textinput.h" |