From 81e295d8c94c3c2d7c6bcc3d71ae114b4d984ce6 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Tue, 1 Feb 2011 10:37:13 +0000 Subject: Using real path from options for the bookmarks file instead of hardcoded test string. svn path=/trunk/netsurf/; revision=11580 --- cocoa/BookmarksController.m | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'cocoa/BookmarksController.m') diff --git a/cocoa/BookmarksController.m b/cocoa/BookmarksController.m index 6e0c963d2..e78d76529 100644 --- a/cocoa/BookmarksController.m +++ b/cocoa/BookmarksController.m @@ -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 -- cgit v1.2.3