mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-02 07:35:25 +03:00
Saving bookmarks before quitting NetSurf.
svn path=/trunk/netsurf/; revision=11794
This commit is contained in:
parent
2e04c57929
commit
ba20058f2c
@ -27,6 +27,11 @@
|
||||
#import "desktop/tree.h"
|
||||
#import "desktop/tree_url_node.h"
|
||||
|
||||
@interface BookmarksController ()
|
||||
- (void) noteAppWillTerminate: (NSNotification *) note;
|
||||
- (void) save;
|
||||
@end
|
||||
|
||||
@implementation BookmarksController
|
||||
|
||||
@synthesize defaultMenu;
|
||||
@ -46,9 +51,24 @@ static const char *cocoa_hotlist_path( void )
|
||||
hotlist_initialise( [tree tree], cocoa_hotlist_path(), "" );
|
||||
nodeForMenu = NSCreateMapTable( NSNonOwnedPointerMapKeyCallBacks, NSNonOwnedPointerMapValueCallBacks, 0 );
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector( noteAppWillTerminate: )
|
||||
name:NSApplicationWillTerminateNotification
|
||||
object:NSApp];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) noteAppWillTerminate: (NSNotification *) note;
|
||||
{
|
||||
[self save];
|
||||
}
|
||||
|
||||
- (void) save;
|
||||
{
|
||||
hotlist_export( cocoa_hotlist_path() );
|
||||
}
|
||||
|
||||
- (void) dealloc;
|
||||
{
|
||||
[self setView: nil];
|
||||
@ -56,6 +76,8 @@ static const char *cocoa_hotlist_path( void )
|
||||
hotlist_cleanup( cocoa_hotlist_path() );
|
||||
[tree release];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,8 @@
|
||||
|
||||
-(void) terminate: (id)sender;
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationWillTerminateNotification object:self];
|
||||
|
||||
netsurf_quit = true;
|
||||
[self postEvent: [NSEvent otherEventWithType: NSApplicationDefined location: NSZeroPoint
|
||||
modifierFlags: 0 timestamp: 0 windowNumber: 0 context: NULL
|
||||
|
Loading…
x
Reference in New Issue
Block a user