mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Add API to control bundle auto-updating
This commit is contained in:
@@ -231,6 +231,7 @@ BOOL HasDocumentWindow (NSArray* windows)
|
||||
|
||||
[TerminalPreferences updateMateIfRequired];
|
||||
[AboutWindowController showChangesIfUpdated];
|
||||
[[BundlesManager sharedInstance] setAutoUpdateBundles:YES];
|
||||
|
||||
[[CrashReporter sharedInstance] applicationDidFinishLaunching:aNotification];
|
||||
[[CrashReporter sharedInstance] postNewCrashReportsToURLString:REST_API @"/crashes"];
|
||||
|
||||
@@ -5,6 +5,8 @@ PUBLIC extern NSString* const kUserDefaultsLastBundleUpdateCheckKey;
|
||||
PUBLIC extern NSString* const BundlesManagerBundlesDidChangeNotification;
|
||||
|
||||
PUBLIC @interface BundlesManager : NSObject
|
||||
@property (nonatomic) BOOL autoUpdateBundles;
|
||||
|
||||
@property (nonatomic, readonly) BOOL isBusy;
|
||||
@property (nonatomic, readonly) NSString* activityText;
|
||||
@property (nonatomic, readonly) double progress;
|
||||
|
||||
@@ -18,6 +18,7 @@ static std::string const kInstallDirectory = NULL_STR;
|
||||
NSUInteger scheduledTasks;
|
||||
std::set<oak::uuid_t> installing;
|
||||
}
|
||||
@property (nonatomic) NSTimer* updateTimer;
|
||||
@property (nonatomic) BOOL isBusy;
|
||||
@property (nonatomic) NSString* activityText;
|
||||
@property (nonatomic) double progress;
|
||||
@@ -135,13 +136,27 @@ namespace
|
||||
bundlesIndex = bundles_db::index(kInstallDirectory);
|
||||
|
||||
load_bundles(path::join(path::home(), "Library/Application Support/TextMate/Cache"));
|
||||
|
||||
[self updateSources:nil];
|
||||
[NSTimer scheduledTimerWithTimeInterval:4*60*60 target:self selector:@selector(updateSources:) userInfo:nil repeats:YES];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setAutoUpdateBundles:(BOOL)flag
|
||||
{
|
||||
if(_autoUpdateBundles == flag)
|
||||
return;
|
||||
|
||||
if(_autoUpdateBundles = flag)
|
||||
{
|
||||
[self updateSources:nil];
|
||||
self.updateTimer = [NSTimer scheduledTimerWithTimeInterval:4*60*60 target:self selector:@selector(updateSources:) userInfo:nil repeats:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.updateTimer invalidate];
|
||||
self.updateTimer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateProgress:(NSTimer*)aTimer
|
||||
{
|
||||
self.progress = self.threadProgress;
|
||||
|
||||
Reference in New Issue
Block a user