Fix warnings

Fall back to default theme if specified one can't be found

svn path=/trunk/netsurf/; revision=6785
This commit is contained in:
Chris Young 2009-03-15 11:21:46 +00:00
parent d3d7fc7c66
commit eab55f2c5a
5 changed files with 40 additions and 22 deletions

View File

@ -72,6 +72,7 @@
#include "amiga/search.h"
#include <devices/inputevent.h>
#include "amiga/history_local.h"
#include "amiga/font.h"
#ifdef NS_AMIGA_CAIRO
#include <cairo/cairo-amigaos.h>
@ -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;

View File

@ -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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
* Copyright 2008,2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* 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

View File

@ -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;

View File

@ -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