Skip to content

Commit

Permalink
optionally hide main window instead of closing
Browse files Browse the repository at this point in the history
closes psychs#104
  • Loading branch information
rolandwalker committed Jun 23, 2014
1 parent 0043fe0 commit f3d491d
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 83 deletions.
8 changes: 7 additions & 1 deletion Classes/Controllers/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,13 @@ - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client

- (BOOL)windowShouldClose:(id)sender
{
return [self queryTerminate];
if ([Preferences hideWindowOnClose]) {
[sender orderOut:self];
return NO;
}
else {
return [self queryTerminate];
}
}

- (void)windowWillClose:(NSNotification *)note
Expand Down
1 change: 1 addition & 0 deletions Classes/Preferences/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ typedef enum {
+ (BOOL)logTranscript;
+ (MainWindowLayoutType)mainWindowLayout;
+ (BOOL)openBrowserInBackground;
+ (BOOL)hideWindowOnClose;
+ (BOOL)showInlineImages;
+ (BOOL)showJoinLeave;
+ (BOOL)showRename;
Expand Down
6 changes: 6 additions & 0 deletions Classes/Preferences/Preferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ + (BOOL)openBrowserInBackground
return [ud boolForKey:@"Preferences.General.open_browser_in_background"];
}

+ (BOOL)hideWindowOnClose
{
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
return [ud boolForKey:@"Preferences.General.hide_window_on_close"];
}

+ (BOOL)showInlineImages
{
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
Expand Down
Loading

0 comments on commit f3d491d

Please sign in to comment.