Implemented gui_find_resource and using resource: URIs for builtin stylesheets.

svn path=/trunk/netsurf/; revision=11819
This commit is contained in:
Sven Weidauer 2011-02-26 09:43:48 +00:00
parent ceadbafcbc
commit bccdea6026
2 changed files with 7 additions and 15 deletions

View File

@ -106,12 +106,6 @@
#pragma mark -
static char *cocoa_get_resource_url( NSString *name, NSString *type )
{
NSString *path = [[NSBundle mainBundle] pathForResource: name ofType: type];
return strdup( [[[NSURL fileURLWithPath: path] absoluteString] UTF8String] );
}
static NSString *cocoa_get_preferences_path( void )
{
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSApplicationSupportDirectory, NSUserDomainMask, YES );
@ -176,11 +170,7 @@ void cocoa_autorelease( void )
int main( int argc, char **argv )
{
cocoa_autorelease();
default_stylesheet_url = cocoa_get_resource_url( @"default", @"css" );
quirks_stylesheet_url = cocoa_get_resource_url( @"quirks", @"css" );
adblock_stylesheet_url = cocoa_get_resource_url( @"adblock", @"css" );
const char * const messages = [[[NSBundle mainBundle] pathForResource: @"Messages" ofType: @""] UTF8String];
const char * const options = cocoa_get_options_file();

View File

@ -36,9 +36,9 @@
#import "image/ico.h"
#import "content/fetchers/resource.h"
char *default_stylesheet_url;
char *adblock_stylesheet_url;
char *quirks_stylesheet_url;
char *default_stylesheet_url = (char *)"resource:default.css";
char *adblock_stylesheet_url = (char *)"resource:adblock.css";
char *quirks_stylesheet_url = (char *)"resource:quirks.css";
NSString * const kCookiesFileOption = @"CookiesFile";
NSString * const kURLsFileOption = @"URLsFile";
@ -52,7 +52,9 @@ NSString * const kAlwaysCloseMultipleTabs = @"AlwaysCloseMultipleTabs";
char* gui_find_resource(const char *filename)
{
return NULL;
NSString *path = [[NSBundle mainBundle] pathForResource: [NSString stringWithUTF8String: filename] ofType: @""];
if (path == nil) return NULL;
return strdup( [[[NSURL fileURLWithPath: path] absoluteString] UTF8String] );
}
void gui_multitask(void)