Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 92 lines (78 sloc) 3.191 kb
b268543 Mo McRoberts Import r1.0.1 (20081026)
authored
1 /*
2 * DropLook: A simple wrapper for QuickLook.
3 * @(#) $Id$
4 */
5
6 /*
7 * Copyright (c) 2008 Mo McRoberts.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. The names of the author(s) of this software may not be used to endorse
18 * or promote products derived from this software without specific prior
19 * written permission.
20 *
9641840 Remove whitespace [WhitespaceBot]
Gun.io Whitespace Robot authored
21 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
b268543 Mo McRoberts Import r1.0.1 (20081026)
authored
23 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
24 * AUTHORS OF THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
9641840 Remove whitespace [WhitespaceBot]
Gun.io Whitespace Robot authored
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
b268543 Mo McRoberts Import r1.0.1 (20081026)
authored
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifdef HAVE_CONFIG_H
34 # include "config.h"
35 #endif
36
37 #import "Sparkle/SUUpdater.h"
38 #import "PrefsController.h"
39
40
41 @implementation PrefsController
42
43 - (NSWindow *)window
44 {
45 return window;
46 }
47
48 - (void)awakeFromNib
49 {
50 updater = [SUUpdater sharedUpdater];
51 updateDateFormatter = [[NSDateFormatter alloc] init];
52 [updateDateFormatter setDateStyle:NSDateFormatterLongStyle];
53 [updateDateFormatter setTimeStyle:NSDateFormatterMediumStyle];
54 lastCheckedString = NSLocalizedStringFromTable(@"Last checked for updates: %@", @"DropLook", @"Message displayed in preferences window showing last software update check.");
55 updateInProgressString = NSLocalizedStringFromTable(@"Checking for updates", @"DropLook", @"Message displayed in preferences window showing that an update is in progress.");
56 neverCheckedString = NSLocalizedStringFromTable(@"Never checked for updates.", @"DropLook", @"Message displayed in preferences window showing that automatic updates haven't yet run.");
57 [self showLastUpdated];
58 [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(timerTick:) userInfo:NULL repeats:YES];
9641840 Remove whitespace [WhitespaceBot]
Gun.io Whitespace Robot authored
59
b268543 Mo McRoberts Import r1.0.1 (20081026)
authored
60 }
61
62 - (IBAction)checkNow:(id)sender
63 {
64 [updater checkForUpdatesInBackground];
65 [self showLastUpdated];
66 }
67
68 - (void)timerTick:(NSTimer*)theTimer
69 {
70 [self showLastUpdated];
71 }
72
73 - (void)showLastUpdated
74 {
75 NSDate *dt;
9641840 Remove whitespace [WhitespaceBot]
Gun.io Whitespace Robot authored
76
b268543 Mo McRoberts Import r1.0.1 (20081026)
authored
77 if([updater updateInProgress])
78 {
79 [lastUpdated setStringValue:updateInProgressString];
80 }
81 else if(dt = [updater lastUpdateCheckDate])
82 {
83 [lastUpdated setStringValue:[NSString stringWithFormat:lastCheckedString, [updateDateFormatter stringFromDate:dt]]];
84 }
85 else
86 {
87 [lastUpdated setStringValue:neverCheckedString];
88 }
89 }
90
91 @end
Something went wrong with that request. Please try again.