Using real path from options for the bookmarks file instead of hardcoded test string.

svn path=/trunk/netsurf/; revision=11580
This commit is contained in:
Sven Weidauer 2011-02-01 10:37:13 +00:00
parent fac17d747b
commit 81e295d8c9
3 changed files with 20 additions and 5 deletions

View File

@ -20,6 +20,7 @@
#import "cocoa/Tree.h"
#import "cocoa/NetsurfApp.h"
#import "cocoa/BrowserViewController.h"
#import "cocoa/gui.h"
#import "desktop/hotlist.h"
#import "desktop/tree.h"
@ -29,12 +30,18 @@
@synthesize defaultMenu;
static const char *cocoa_hotlist_path( void )
{
NSString *path = [[NSUserDefaults standardUserDefaults] stringForKey: kHotlistFileOption];
return [path UTF8String];
}
- init;
{
if ((self = [super init]) == nil) return nil;
tree = [[Tree alloc] initWithFlags: hotlist_get_tree_flags()];
hotlist_initialise( [tree tree], "/Users/sven/hotlist", "" );
hotlist_initialise( [tree tree], cocoa_hotlist_path(), "" );
nodeForMenu = NSCreateMapTable( NSNonOwnedPointerMapKeyCallBacks, NSNonOwnedPointerMapValueCallBacks, 0 );
return self;
@ -43,7 +50,7 @@
- (void) dealloc;
{
NSFreeMapTable( nodeForMenu );
hotlist_cleanup( "/Users/sven/hotlist" );
hotlist_cleanup( cocoa_hotlist_path() );
[tree release];
[super dealloc];
}
@ -126,4 +133,12 @@
return YES;
}
+ (void) initialize;
{
[[NSUserDefaults standardUserDefaults] registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
cocoa_get_user_path( @"Bookmarks.html" ), kHotlistFileOption,
nil]];
}
@end

View File

@ -27,3 +27,5 @@
@property (readwrite, assign, nonatomic) BrowserViewController *frontTab;
@end
NSString *cocoa_get_user_path( NSString *fileName );

View File

@ -44,7 +44,6 @@
#define NETSURF_HOMEPAGE "http://www.netsurf-browser.org/welcome/"
#endif
static NSString *cocoa_get_user_path( NSString *fileName ) ;
@implementation NetSurfApp
@ -56,7 +55,6 @@ static NSString *cocoa_get_user_path( NSString *fileName ) ;
[defaults registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
cocoa_get_user_path( @"Cookies" ), kCookiesFileOption,
cocoa_get_user_path( @"URLs" ), kURLsFileOption,
cocoa_get_user_path( @"Hotlist" ), kHotlistFileOption,
[NSString stringWithUTF8String: NETSURF_HOMEPAGE], kHomepageURLOption,
nil]];
@ -134,7 +132,7 @@ static NSString *cocoa_get_preferences_path( void )
return netsurfPath;
}
static NSString *cocoa_get_user_path( NSString *fileName )
NSString *cocoa_get_user_path( NSString *fileName )
{
return [cocoa_get_preferences_path() stringByAppendingPathComponent: fileName];
}