jessegrosjean / bdocuments

This URL has Read+Write access

bdocuments / BCloudSyncWindowController.m
100644 60 lines (47 sloc) 1.322 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// BCloudSyncWindowController.m
// BDocuments
//
// Created by Jesse Grosjean on 2/27/09.
// Copyright 2009 Hog Bay Software. All rights reserved.
//
 
#import "BCloudSyncWindowController.h"
#import "BCloudDocumentsService.h"
 
 
@implementation BCloudSyncWindowController
 
+ (id)sharedInstance {
    static id sharedInstance = nil;
    if (sharedInstance == nil) {
        sharedInstance = [[self alloc] init];
    }
    return sharedInstance;
}
 
- (id)init {
if (self = [super initWithWindowNibName:@"BCloudSyncWindow"]) {
}
return self;
}
 
- (void)awakeFromNib {
[progressIndicator setUsesThreadedAnimation:YES];
[progressIndicator setMaxValue:1.0];
[[self window] setTitle:[NSString stringWithFormat:BLocalizedString(@"%@ Sync...", nil), [[BCloudDocumentsService sharedInstance] serviceLabel]]];
[[self window] setLevel:NSFloatingWindowLevel];
}
 
- (double)progress {
return [progressIndicator doubleValue];
}
 
- (void)setProgress:(double)progress {
[progressIndicator setDoubleValue:progress];
}
 
- (IBAction)showWindow:(id)sender {
[[self window] center];
[progressIndicator startAnimation:nil];
[super showWindow:sender];
}
 
- (IBAction)cancel:(id)sender {
[[BCloudDocumentsService sharedInstance] cancelSync:nil];
}
 
- (void)close {
[super close];
[progressIndicator stopAnimation:nil];
}
 
@end