From eab55f2c5ab33ec1ebf96086adf5a7ac81b8a407 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 15 Mar 2009 11:21:46 +0000 Subject: Fix warnings Fall back to default theme if specified one can't be found svn path=/trunk/netsurf/; revision=6785 --- amiga/gui.c | 53 ++++++++++++++++++++++++++++++++------------------- amiga/gui.h | 3 ++- amiga/history.h | 3 ++- amiga/history_local.c | 2 ++ amiga/history_local.h | 1 + 5 files changed, 40 insertions(+), 22 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 8941cf38c..2c90103dc 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -72,6 +72,7 @@ #include "amiga/search.h" #include #include "amiga/history_local.h" +#include "amiga/font.h" #ifdef NS_AMIGA_CAIRO #include @@ -246,16 +247,16 @@ void gui_init(int argc, char** argv) for(i=0;i<10;i++) { - strcpy(&lang,"Resources/"); + strcpy(lang,"Resources/"); if(locale->loc_PrefLanguages[i]) { - strcat(&lang,messages_get(locale->loc_PrefLanguages[i])); + strcat(lang,messages_get(locale->loc_PrefLanguages[i])); } else { continue; } - strcat(&lang,"/messages"); + strcat(lang,"/messages"); // printf("%s\n",lang); if(lock=Lock(lang,ACCESS_READ)) { @@ -267,7 +268,7 @@ void gui_init(int argc, char** argv) if(!found) { - strcpy(&lang,"Resources/en/messages"); + strcpy(lang,"Resources/en/messages"); } CloseLocale(locale); @@ -374,13 +375,28 @@ void gui_init(int argc, char** argv) ami_cookies_initialise(); save_complete_init(); - strcpy(&throbberfile,option_theme); - AddPart(&throbberfile,"Theme",100); + strcpy(throbberfile,option_theme); + AddPart(throbberfile,"Theme",100); + + lock = Lock(throbberfile,ACCESS_READ); + + if(!lock) + { + warn_user("ThemeApplyErr",option_theme); + strcpy(throbberfile,"Resources/Themes/Default/Theme"); + free(option_theme); + option_theme = (char *)strdup("Resources/Themes/Default"); + } + else + { + UnLock(lock); + } + messages_load(throbberfile); ami_init_mouse_pointers(); - ami_get_theme_filename(&throbberfile,"theme_throbber"); + ami_get_theme_filename(throbberfile,"theme_throbber"); throbber_frames=atoi(messages_get("theme_throbber_frames")); if(dto = NewDTObject(throbberfile, @@ -575,8 +591,8 @@ void gui_init2(int argc, char** argv) if(i==0) continue; if((wbarg->wa_Lock)&&(*wbarg->wa_Name)) { - DevNameFromLock(wbarg->wa_Lock,&fullpath,1024,DN_FULLPATH); - AddPart(&fullpath,wbarg->wa_Name,1024); + DevNameFromLock(wbarg->wa_Lock,fullpath,1024,DN_FULLPATH); + AddPart(fullpath,wbarg->wa_Name,1024); if(!temp_homepage_url) temp_homepage_url = path_to_url(fullpath); @@ -754,7 +770,7 @@ void ami_handle_msg(void) if(option_context_menu && rmbtrapped == FALSE) { - SetWindowAttr(gwin->win,WA_RMBTrap,TRUE,1); + SetWindowAttr(gwin->win,WA_RMBTrap,(APTR)TRUE,1); rmbtrapped=TRUE; // crash points to this line } @@ -1611,7 +1627,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, return NULL; } - gwin->shared->scrollerhook.h_Entry = ami_scroller_hook; + gwin->shared->scrollerhook.h_Entry = (void *)ami_scroller_hook; gwin->shared->scrollerhook.h_Data = gwin->shared; switch(bw->browser_window_type) @@ -1986,6 +2002,8 @@ void gui_window_destroy(struct gui_window *g) // if(g->shared->searchwin) // if(g->shared->searchwin->gwin == g) ami_search_close(); +// if(g->hw) ami_history_close(g->hw); + if(g->shared->tabs > 1) { SetGadgetAttrs(g->shared->gadgets[GID_TABS],g->shared->win,NULL, @@ -2045,7 +2063,7 @@ void gui_window_set_title(struct gui_window *g, const char *title) SetGadgetAttrs(g->shared->gadgets[GID_TABS],g->shared->win,NULL, CLICKTAB_Labels,~0, TAG_DONE); - newtitle = ami_utf8_easy(title); + newtitle = ami_utf8_easy((char *)title); SetClickTabNodeAttrs(node,TNA_Text,newtitle,TAG_DONE); if(newtitle) ami_utf8_free(newtitle); RefreshSetGadgetAttrs(g->shared->gadgets[GID_TABS],g->shared->win,NULL, @@ -2059,7 +2077,7 @@ void gui_window_set_title(struct gui_window *g, const char *title) if((cur_tab == g->tab) || (g->shared->tabs == 0)) { if(g->shared->win->Title) ami_utf8_free(g->shared->win->Title); - SetWindowTitles(g->shared->win,ami_utf8_easy(title),nsscreentitle); + SetWindowTitles(g->shared->win,ami_utf8_easy((char *)title),nsscreentitle); } } @@ -2162,10 +2180,7 @@ void gui_window_redraw_window(struct gui_window *g) if(g->tab_node) GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab); if((cur_tab == g->tab) || (g->shared->tabs == 0)) - { g->shared->redraw_required = true; - g->shared->redraw_data = NULL; - } } void gui_window_update_box(struct gui_window *g, @@ -2279,7 +2294,6 @@ void ami_do_redraw(struct gui_window_2 *g,bool scroll) g->oldv = vcurrent; g->redraw_required = false; - g->redraw_data = NULL; } bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) @@ -2312,7 +2326,6 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy) TAG_DONE); g->shared->redraw_required = true; - g->shared->redraw_data = NULL; g->scrollx = sx; g->scrolly = sy; @@ -2488,7 +2501,7 @@ void ami_init_mouse_pointers(void) if(option_truecolour_mouse_pointers) { - ami_get_theme_filename(&ptrfname,ptrs32[i]); + ami_get_theme_filename(ptrfname,ptrs32[i]); if(dobj = GetIconTags(ptrfname,ICONGETA_UseFriendBitMap,TRUE,TAG_DONE)) { if(IconControl(dobj, ICONCTRLA_GetImageDataFormat, &format, TAG_DONE)) @@ -2540,7 +2553,7 @@ void ami_init_mouse_pointers(void) if(!mouseptrobj[i]) { - ami_get_theme_filename(&ptrfname,ptrs[i]); + ami_get_theme_filename(ptrfname,ptrs[i]); if(ptrfile = Open(ptrfname,MODE_OLDFILE)) { int mx,my; diff --git a/amiga/gui.h b/amiga/gui.h index a496c26d7..52d6179a9 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -71,6 +71,7 @@ enum }; struct find_window; +struct history_window; struct gui_download_window { struct Window *win; @@ -97,7 +98,6 @@ struct gui_window_2 { struct Hook scrollerhook; struct Hook popuphook; struct form_control *control; - union content_msg_data *redraw_data; browser_mouse_state mouse_state; browser_mouse_state key_state; ULONG throbber_update_count; @@ -117,6 +117,7 @@ struct gui_window int scrollx; int scrolly; char *dlfilename; + struct history_window *hw; }; struct gui_globals diff --git a/amiga/history.h b/amiga/history.h index 5e9bca88c..c9f8254dc 100755 --- a/amiga/history.h +++ b/amiga/history.h @@ -1,5 +1,5 @@ /* - * Copyright 2008 Chris Young + * Copyright 2008,2009 Chris Young * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -23,6 +23,7 @@ #define GLOBAL_HISTORY_RECENT_URLS 16 void ami_global_history_initialise(void); +void ami_global_history_free(void); struct tree *global_history_tree; #endif diff --git a/amiga/history_local.c b/amiga/history_local.c index 9a30aa11b..754726240 100755 --- a/amiga/history_local.c +++ b/amiga/history_local.c @@ -139,6 +139,7 @@ void ami_history_open(struct browser_window *bw, struct history *history) } hwindow->bw = bw; + bw->window->hw = hwindow; ami_history_redraw(hwindow); } @@ -217,6 +218,7 @@ bool ami_history_click(struct history_window *hw,uint16 code) void ami_history_close(struct history_window *hw) { + hw->bw->window->hw = NULL; DisposeObject(hw->objects[OID_MAIN]); DelObject(hw->node); hwindow = NULL; diff --git a/amiga/history_local.h b/amiga/history_local.h index c649f7501..5330958a1 100755 --- a/amiga/history_local.h +++ b/amiga/history_local.h @@ -35,4 +35,5 @@ struct history_window { void ami_history_open(struct browser_window *bw, struct history *history); void ami_history_close(struct history_window *hw); +BOOL ami_history_event(struct history_window *hw); #endif -- cgit v1.2.3