-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathSWStorageWidgetView.m
More file actions
33 lines (29 loc) · 1.15 KB
/
SWStorageWidgetView.m
File metadata and controls
33 lines (29 loc) · 1.15 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
#import "SWStorageWidgetView.h"
@implementation SWStorageWidgetView
-(NSString *)iconImage {
return @"storageicon";
}
-(NSString *)widgetHeaderLocalizationString {
return @"STORAGE_WIDGET_HEADER";
}
-(NSString *)prefsURL {
return @"prefs:root=General&path=STORAGE_MGMT%23OFFLOAD";
}
-(SWDiskUsageView *)diskUsageView {
return _diskUsageView;
}
-(void)additionalSetup {
_diskUsageView = [[SWDiskUsageView alloc] init];
_diskUsageView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview: _diskUsageView];
[_diskUsageView.bottomAnchor constraintEqualToAnchor: self.bottomAnchor constant:-10].active = YES;
[_diskUsageView.leadingAnchor constraintEqualToAnchor: self.leadingAnchor].active = YES;
[_diskUsageView.trailingAnchor constraintEqualToAnchor: self.trailingAnchor].active = YES;
[_diskUsageView setup];
}
-(void)updateForData:(NSDictionary *)receievedData {
NSUInteger usedDiskSpace = [receievedData[@"usedDiskSpace"] integerValue];
NSUInteger totalDiskSpace = [receievedData[@"totalDiskSpace"] integerValue];
[_diskUsageView updateDiskBarForUsedDiskSpace:usedDiskSpace totalSpace:totalDiskSpace];
}
@end