Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 67 lines (55 sloc) 1.64 kb
76d2a5b Michael G. Ströck
mstroeck authored
1 //
2 // EmptyTrashWarning.m
3 // Vienna
4 //
5 // Created by Jeffrey Johnson on 12/26/06.
6 // Copyright (c) 2004-2006 Jeffrey Johnson. All rights reserved.
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 //
20
21 #import "EmptyTrashWarning.h"
22 #import "Constants.h"
23 #import "Preferences.h"
24
25 enum
26 {
27 MA_EmptyTrashReturnCode_No = 0,
28 MA_EmptyTrashReturnCode_Yes = 1,
29 };
30
31 @implementation EmptyTrashWarning
32
33 -(id)init
34 {
35 return [super initWithWindowNibName:@"EmptyTrashWarning"];
36 }
37
38 -(void)windowWillLoad
39 {
40 [doNotShowWarningAgain setState:NSOffState];
41 }
42
43 -(BOOL)shouldEmptyTrash
44 {
45 BOOL shouldEmptyTrash = ([NSApp runModalForWindow:[self window]] == MA_EmptyTrashReturnCode_Yes);
46
47 if ([doNotShowWarningAgain state] == NSOnState)
48 {
49 [[Preferences standardPreferences] setInteger:(shouldEmptyTrash ? MA_EmptyTrash_WithoutWarning : MA_EmptyTrash_None) forKey:MAPref_EmptyTrashNotification];
50 }
51
52 [self close];
53
54 return shouldEmptyTrash;
55 }
56
57 -(IBAction)doNotEmptyTrash:(id)sender
58 {
59 [NSApp stopModalWithCode:MA_EmptyTrashReturnCode_No];
60 }
61
62 -(IBAction)emptyTrash:(id)sender
63 {
64 [NSApp stopModalWithCode:MA_EmptyTrashReturnCode_Yes];
65 }
66 @end
Something went wrong with that request. Please try again.